Improve crash reporting of ART tools during build.
ANDROID_BUILD_TOP is not defined when called from soong,
so try the current working dir instead.
Using unqualified path is forbidden since it not hermetic,
and will fail.
Test: Check that crashes produce line numbers.
Change-Id: I379f81e65aade1ee7f1f982e9502417e4fb16cf4
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index be41a68..d35188d 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -74,11 +74,11 @@
#endif
#if defined(ART_CLANG_PATH)
const char* env_value = getenv("ANDROID_BUILD_TOP");
- if (env_value != nullptr) {
- return std::string(env_value) + "/" + ART_CLANG_PATH + "/bin/llvm-addr2line";
- }
-#endif
+ std::string_view top(env_value != nullptr ? env_value : ".");
+ return std::string(top) + "/" + ART_CLANG_PATH + "/bin/llvm-addr2line";
+#else
return std::string("llvm-addr2line");
+#endif
}
ALWAYS_INLINE