summaryrefslogtreecommitdiffstats
path: root/libbacktrace/UnwindStack.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-12-07 17:41:18 -0800
committerChristopher Ferris <cferris@google.com>2017-12-07 19:00:00 -0800
commite328673a305a5c9f4acf73a7a2826eb61390632c (patch)
treea4de300723718b8bfac81cff5a0ab7caa4b76b4a /libbacktrace/UnwindStack.cpp
parent255c43cd050f5202e96483430684c19b7ce916ff (diff)
downloadsystem_core-e328673a305a5c9f4acf73a7a2826eb61390632c.tar.gz
system_core-e328673a305a5c9f4acf73a7a2826eb61390632c.tar.bz2
system_core-e328673a305a5c9f4acf73a7a2826eb61390632c.zip
Add method to detect remote read function to use.
The process_vm_read function is much faster than ptrace, but sometimes that will not work on a remote process. Modify the libunwindstack MemoryRemote object to figure out which one it can use. Wrote new unit test to verify this checking behavior. Modify libbacktrace so that the read from libunwind is used instead of using the default ptrace calls. Add some benchmarks to libbacktrace to compare the two different methods. Test: Ran unit tests libbacktrace/libunwindstack/debuggerd. Test: Ran debuggerd -b <SYSTEM_SERVER_PID> Test: Ran debuggerd -b <MEDIACODEC PID> Test: Ran debuggerd -b <RANDOM_PID> Test: Used crasher to create tombstones and verified stack data is Test: dumped properly. Change-Id: If75ca238289532dd8e1de430d569cabb2523380a
Diffstat (limited to 'libbacktrace/UnwindStack.cpp')
-rw-r--r--libbacktrace/UnwindStack.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp
index d61384ef1..56a6c6889 100644
--- a/libbacktrace/UnwindStack.cpp
+++ b/libbacktrace/UnwindStack.cpp
@@ -108,7 +108,7 @@ bool UnwindStackCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t*
}
UnwindStackPtrace::UnwindStackPtrace(pid_t pid, pid_t tid, BacktraceMap* map)
- : BacktracePtrace(pid, tid, map) {}
+ : BacktracePtrace(pid, tid, map), memory_(pid) {}
std::string UnwindStackPtrace::GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset) {
return GetMap()->GetFunctionName(pc, offset);
@@ -125,3 +125,7 @@ bool UnwindStackPtrace::Unwind(size_t num_ignore_frames, ucontext_t* context) {
error_ = BACKTRACE_UNWIND_NO_ERROR;
return Backtrace::Unwind(regs.get(), GetMap(), &frames_, num_ignore_frames, nullptr);
}
+
+size_t UnwindStackPtrace::Read(uintptr_t addr, uint8_t* buffer, size_t bytes) {
+ return memory_.Read(addr, buffer, bytes);
+}