Merge "Move to the libc++ demangler."

This commit is contained in:
Christopher Ferris 2019-07-18 00:19:37 +00:00 committed by Gerrit Code Review
commit 19b24bada5
3 changed files with 19 additions and 11 deletions

View file

@ -125,10 +125,6 @@ cc_library {
},
},
whole_static_libs: [
"libdemangle"
],
static_libs: [
"libprocinfo",
],

View file

@ -27,8 +27,6 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <demangle.h>
#include <unwindstack/Elf.h>
#include <unwindstack/JitDebug.h>
#include <unwindstack/MapInfo.h>
@ -40,6 +38,9 @@
#include <unwindstack/DexFiles.h>
#endif
// Use the demangler from libc++.
extern "C" char* __cxa_demangle(const char*, char*, size_t*, int* status);
namespace unwindstack {
// Inject extra 'virtual' frame that represents the dex pc data.
@ -330,7 +331,14 @@ std::string Unwinder::FormatFrame(const FrameData& frame) {
}
if (!frame.function_name.empty()) {
data += " (" + demangle(frame.function_name.c_str());
char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, nullptr);
if (demangled_name == nullptr) {
data += " (" + frame.function_name;
} else {
data += " (";
data += demangled_name;
free(demangled_name);
}
if (frame.function_offset != 0) {
data += android::base::StringPrintf("+%" PRId64, frame.function_offset);
}

View file

@ -1482,11 +1482,15 @@ TEST_F(UnwindOfflineTest, load_bias_ro_rx_x86_64) {
" #09 pc 0000000000ed5e25 perfetto_unittests "
"(testing::internal::UnitTestImpl::RunAllTests()+581)\n"
" #10 pc 0000000000ef63f3 perfetto_unittests "
"(_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_"
"MS4_FS3_vEPKc+131)\n"
"(bool "
"testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, "
"bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char "
"const*)+131)\n"
" #11 pc 0000000000ee2a21 perfetto_unittests "
"(_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_"
"FS3_vEPKc+113)\n"
"(bool "
"testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, "
"bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char "
"const*)+113)\n"
" #12 pc 0000000000ed5bb9 perfetto_unittests (testing::UnitTest::Run()+185)\n"
" #13 pc 0000000000e900f0 perfetto_unittests (RUN_ALL_TESTS()+16)\n"
" #14 pc 0000000000e900d8 perfetto_unittests (main+56)\n"