diff options
Diffstat (limited to 'debuggerd/handler/debuggerd_fallback.cpp')
-rw-r--r-- | debuggerd/handler/debuggerd_fallback.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/debuggerd/handler/debuggerd_fallback.cpp b/debuggerd/handler/debuggerd_fallback.cpp index 15c02651c..bbec612a8 100644 --- a/debuggerd/handler/debuggerd_fallback.cpp +++ b/debuggerd/handler/debuggerd_fallback.cpp @@ -42,9 +42,12 @@ #include <android-base/file.h> #include <android-base/unique_fd.h> #include <async_safe/log.h> -#include <backtrace/BacktraceMap.h> +#include <unwindstack/DexFiles.h> +#include <unwindstack/JitDebug.h> +#include <unwindstack/Maps.h> #include <unwindstack/Memory.h> #include <unwindstack/Regs.h> +#include <unwindstack/Unwinder.h> #include "debuggerd/handler.h" #include "handler/fallback.h" @@ -55,7 +58,6 @@ #include "libdebuggerd/tombstone.h" using android::base::unique_fd; -using unwindstack::Regs; extern "C" bool __linker_enable_fallback_allocator(); extern "C" void __linker_disable_fallback_allocator(); @@ -73,17 +75,22 @@ static void debuggerd_fallback_trace(int output_fd, ucontext_t* ucontext) { } { - std::unique_ptr<Regs> regs; + std::unique_ptr<unwindstack::Regs> regs; ThreadInfo thread; thread.pid = getpid(); thread.tid = gettid(); thread.thread_name = get_thread_name(gettid()); - thread.registers.reset(Regs::CreateFromUcontext(Regs::CurrentArch(), ucontext)); + unwindstack::ArchEnum arch = unwindstack::Regs::CurrentArch(); + thread.registers.reset(unwindstack::Regs::CreateFromUcontext(arch, ucontext)); // TODO: Create this once and store it in a global? - std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(getpid())); - dump_backtrace_thread(output_fd, map.get(), thread); + unwindstack::UnwinderFromPid unwinder(kMaxFrames, getpid()); + if (unwinder.Init(arch)) { + dump_backtrace_thread(output_fd, &unwinder, thread); + } else { + async_safe_format_log(ANDROID_LOG_ERROR, "libc", "Unable to init unwinder."); + } } __linker_disable_fallback_allocator(); } |