summaryrefslogtreecommitdiff
path: root/libc/malloc_debug/UnwindBacktrace.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2019-08-25 12:20:54 -0700
committerScott Lobdell <slobdell@google.com>2019-08-25 12:20:54 -0700
commit4f9bfdcaca2414c8959986f0a4d73f16cb15e1c4 (patch)
tree540bab5498d276cbbfad24c48a7ff989ee8b920a /libc/malloc_debug/UnwindBacktrace.cpp
parentbfda022dd6fbbcea60e9f52496d90ece514b32da (diff)
parentf77cc9b224c35fa7d1d71e7c374ef19e47b5f6a5 (diff)
Merge RP1A.190822.001
Change-Id: Iaf90835a99d87f6246798efd2cea6fe9f750ea18
Diffstat (limited to 'libc/malloc_debug/UnwindBacktrace.cpp')
-rw-r--r--libc/malloc_debug/UnwindBacktrace.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index ddafc731f..92fb3fa96 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -36,7 +36,6 @@
#include <vector>
#include <android-base/stringprintf.h>
-#include <demangle.h>
#include <unwindstack/LocalUnwinder.h>
#include <unwindstack/MapInfo.h>
@@ -49,6 +48,8 @@
#define PAD_PTR "08" PRIx64
#endif
+extern "C" char* __cxa_demangle(const char*, char*, size_t*, int*);
+
static pthread_once_t g_setup_once = PTHREAD_ONCE_INIT;
static unwindstack::LocalUnwinder* g_unwinder;
@@ -100,7 +101,14 @@ void UnwindLog(const std::vector<unwindstack::LocalFrameData>& frame_info) {
}
if (!info->function_name.empty()) {
- line += " (" + demangle(info->function_name.c_str());
+ line += " (";
+ char* demangled_name = __cxa_demangle(info->function_name.c_str(), nullptr, nullptr, nullptr);
+ if (demangled_name != nullptr) {
+ line += demangled_name;
+ free(demangled_name);
+ } else {
+ line += info->function_name;
+ }
if (info->function_offset != 0) {
line += "+" + std::to_string(info->function_offset);
}