diff options
author | Christopher Ferris <cferris@google.com> | 2017-10-18 09:08:51 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-10-18 19:20:12 -0700 |
commit | 9a6b3e39e58e761bdc5b23af19378efb023e1dac (patch) | |
tree | d384940db728f89db3f76596af6c4081e7a2d53c /libbacktrace/UnwindStack.cpp | |
parent | d72d92aee2d125f6a8d26932e6482bea5398b92c (diff) | |
download | system_core-9a6b3e39e58e761bdc5b23af19378efb023e1dac.tar.gz system_core-9a6b3e39e58e761bdc5b23af19378efb023e1dac.tar.bz2 system_core-9a6b3e39e58e761bdc5b23af19378efb023e1dac.zip |
Fix demangle of function names.
Also move the Backtrace::CreateNew function into the same place as ::Create
in preparation for the switch to the new unwinder as the base.
Test: Verify that names are demangled properly.
Change-Id: I6274cd43ea52210523e1e1ce23af5b22f62f4573
Diffstat (limited to 'libbacktrace/UnwindStack.cpp')
-rw-r--r-- | libbacktrace/UnwindStack.cpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp index 41153ce19..73bfdec1e 100644 --- a/libbacktrace/UnwindStack.cpp +++ b/libbacktrace/UnwindStack.cpp @@ -15,7 +15,6 @@ */ #define _GNU_SOURCE 1 -#include <assert.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -93,7 +92,7 @@ static bool Unwind(unwindstack::Regs* regs, BacktraceMap* back_map, back_frame->pc = frame->pc; back_frame->sp = frame->sp; - back_frame->func_name = frame->function_name; + back_frame->func_name = demangle(frame->function_name.c_str()); back_frame->func_offset = frame->function_offset; back_frame->map.name = frame->map_name; @@ -149,31 +148,3 @@ bool UnwindStackPtrace::Unwind(size_t num_ignore_frames, ucontext_t* context) { error_ = BACKTRACE_UNWIND_NO_ERROR; return ::Unwind(regs.get(), GetMap(), &frames_, num_ignore_frames); } - -Backtrace* Backtrace::CreateNew(pid_t pid, pid_t tid, BacktraceMap* map) { - if (pid == BACKTRACE_CURRENT_PROCESS) { - pid = getpid(); - if (tid == BACKTRACE_CURRENT_THREAD) { - tid = gettid(); - } - } else if (tid == BACKTRACE_CURRENT_THREAD) { - tid = pid; - } - - if (map == nullptr) { -// This would cause the wrong type of map object to be created, so disallow. -#if defined(__ANDROID__) - __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, - "Backtrace::CreateNew() must be called with a real map pointer."); -#else - BACK_LOGE("Backtrace::CreateNew() must be called with a real map pointer."); - abort(); -#endif - } - - if (pid == getpid()) { - return new UnwindStackCurrent(pid, tid, map); - } else { - return new UnwindStackPtrace(pid, tid, map); - } -} |