diff options
author | Christopher Ferris <cferris@google.com> | 2017-12-07 17:41:18 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2017-12-07 19:00:00 -0800 |
commit | c8741f9cb9e646cbacdae9f2078079025edad021 (patch) | |
tree | 5c7fb539869e7efc9d8081a5e12d7faa61dc4648 /libunwindstack/include/unwindstack | |
parent | 169c65851e458a8bf73c0fedfdc84ee9ffaefe88 (diff) | |
download | unwinding-c8741f9cb9e646cbacdae9f2078079025edad021.tar.gz |
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 'libunwindstack/include/unwindstack')
-rw-r--r-- | libunwindstack/include/unwindstack/Memory.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libunwindstack/include/unwindstack/Memory.h b/libunwindstack/include/unwindstack/Memory.h index 8163152..94ceaab 100644 --- a/libunwindstack/include/unwindstack/Memory.h +++ b/libunwindstack/include/unwindstack/Memory.h @@ -21,6 +21,7 @@ #include <sys/types.h> #include <unistd.h> +#include <atomic> #include <memory> #include <string> #include <vector> @@ -99,7 +100,7 @@ class MemoryFileAtOffset : public Memory { class MemoryRemote : public Memory { public: - MemoryRemote(pid_t pid) : pid_(pid) {} + MemoryRemote(pid_t pid) : pid_(pid), read_redirect_func_(0) {} virtual ~MemoryRemote() = default; size_t Read(uint64_t addr, void* dst, size_t size) override; @@ -108,6 +109,7 @@ class MemoryRemote : public Memory { private: pid_t pid_; + std::atomic_uintptr_t read_redirect_func_; }; class MemoryLocal : public Memory { |