From c2042a191fbaea8f2c51aa76a85f73c4d937a695 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Thu, 23 Feb 2023 17:09:32 +0000 Subject: 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 --- runtime/native_stack_dump.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/native_stack_dump.cc') diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc index be41a6807a..d35188d048 100644 --- a/runtime/native_stack_dump.cc +++ b/runtime/native_stack_dump.cc @@ -74,11 +74,11 @@ std::string FindAddr2line() { #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 -- cgit v1.2.3-59-g8ed1b