diff options
author | Christopher Ferris <cferris@google.com> | 2019-07-18 13:36:50 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2019-07-18 21:11:22 +0000 |
commit | 9782b8707484addc0c90b641422e583e95ab7b35 (patch) | |
tree | 6c76c9f4832eae6764ee9425fc8f50bd19fa7c79 /libc/malloc_debug/PointerData.cpp | |
parent | 9cf76012aa5edc11050920ab1b65817c1be1a112 (diff) |
Move to the libc++ demangler.
Bug: 136138882
Test: Ran malloc debug tests.
Test: Ran an app with backtrace_full and verified demangling working in
Test: log file.
Test: Enabled leak checking and verified that the logs include properly
Test: demangled.
Change-Id: Ic4fd9f1522451e867048ac1bea59d8c5ed0d3577
Diffstat (limited to 'libc/malloc_debug/PointerData.cpp')
-rw-r--r-- | libc/malloc_debug/PointerData.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libc/malloc_debug/PointerData.cpp b/libc/malloc_debug/PointerData.cpp index 617d128c7..ec7e42dda 100644 --- a/libc/malloc_debug/PointerData.cpp +++ b/libc/malloc_debug/PointerData.cpp @@ -43,7 +43,6 @@ #include <android-base/stringprintf.h> #include <android-base/thread_annotations.h> -#include <demangle.h> #include <private/bionic_macros.h> #include "Config.h" @@ -54,6 +53,8 @@ #include "malloc_debug.h" #include "UnwindBacktrace.h" +extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*); + std::atomic_uint8_t PointerData::backtrace_enabled_; std::atomic_bool PointerData::backtrace_dump_; @@ -596,7 +597,16 @@ void PointerData::DumpLiveToFile(FILE* fp) { if (frame.function_name.empty()) { fprintf(fp, " \"\" 0}"); } else { - fprintf(fp, " \"%s\" %" PRIx64 "}", demangle(frame.function_name.c_str()).c_str(), frame.function_offset); + char* demangled_name = __cxa_demangle(frame.function_name.c_str(), nullptr, nullptr, + nullptr); + const char* name; + if (demangled_name != nullptr) { + name = demangled_name; + } else { + name = frame.function_name.c_str(); + } + fprintf(fp, " \"%s\" %" PRIx64 "}", name, frame.function_offset); + free(demangled_name); } } fprintf(fp, "\n"); |