diff options
author | Josh Gao <jmgao@google.com> | 2017-08-25 13:55:06 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2017-08-25 14:48:09 -0700 |
commit | 0953ecd03a90350117d6881c55959c6644972b79 (patch) | |
tree | 5bfbfde939a83d68e8769f58eefda0c4f3d61380 /libbacktrace/UnwindStack.cpp | |
parent | 46244a6497ac6b0b1a589e40a67d0f99f462ba1e (diff) |
libunwindstack: make machine type a property of Regs.
There are no actual users of the machine type output parameter to
Regs::RemoteGet. The concrete implementations of Regs know what machine
type they represent anyway, so provide an accessor to query.
Test: treehugger
Test: libunwindstack tests on 32/64-bit host, hikey960
Change-Id: Ia25910531d36c41b2b6919f154cfa914aae63117
Diffstat (limited to 'libbacktrace/UnwindStack.cpp')
-rw-r--r-- | libbacktrace/UnwindStack.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp index e79bca314..3b2f38e08 100644 --- a/libbacktrace/UnwindStack.cpp +++ b/libbacktrace/UnwindStack.cpp @@ -160,7 +160,8 @@ bool UnwindStackCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t* // one extra function call appearing in the unwind. unwindstack::RegsGetLocal(regs.get()); } else { - regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::GetMachineType(), ucontext)); + regs.reset( + unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentMachineType(), ucontext)); } error_ = BACKTRACE_UNWIND_NO_ERROR; @@ -177,10 +178,10 @@ std::string UnwindStackPtrace::GetFunctionNameRaw(uintptr_t pc, uintptr_t* offse bool UnwindStackPtrace::Unwind(size_t num_ignore_frames, ucontext_t* context) { std::unique_ptr<unwindstack::Regs> regs; if (context == nullptr) { - uint32_t machine_type; - regs.reset(unwindstack::Regs::RemoteGet(Tid(), &machine_type)); + regs.reset(unwindstack::Regs::RemoteGet(Tid())); } else { - regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::GetMachineType(), context)); + regs.reset( + unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentMachineType(), context)); } error_ = BACKTRACE_UNWIND_NO_ERROR; |