diff options
| author | Christopher Ferris <cferris@google.com> | 2017-12-20 18:49:01 -0800 |
|---|---|---|
| committer | Christopher Ferris <cferris@google.com> | 2018-01-12 11:18:42 -0800 |
| commit | 150db124f3f3c0f8e1c341fd33c6c64310e0ac39 (patch) | |
| tree | 87fb701a6895bf8f273997edb1d98bf9aea2a3cd /libbacktrace | |
| parent | 55feb241b159a946ad3a24286baec3b8bf43a9e6 (diff) | |
| download | system_core-150db124f3f3c0f8e1c341fd33c6c64310e0ac39.tar.gz system_core-150db124f3f3c0f8e1c341fd33c6c64310e0ac39.tar.bz2 system_core-150db124f3f3c0f8e1c341fd33c6c64310e0ac39.zip | |
Add ability to read jit gdb data.
Changes:
- New JitDebug class to handle all of the jit gdb interface.
- Add unit tests for all, along with new offline test using debug data.
- Add new Memory type called MemoryOfflineParts that has multiple
MemoryOffline objects to support the offline test.
- Update the tools to use the JitDebug object.
- Modify libbacktrace to use the JitDebug, but only looking in libart.so
and libartd.so.
- Change the Format32Bits to Is32Bit since it's more accurate and I use
it in a different context where original name didn't make sense.
- Add a new function to find global variables in an elf file
(GetGlobalVariable).
- Add a new function to determine if a pc is valid for this elf (IsValidPc).
Bug: 68396769
Test: Ran new unit tests. Added new offline test that uses jit debug data.
Test: Ran art test that generates jit data and verified a crash unwinds
Test: through the jit data.
Change-Id: I6e7ee2f5bab2242028a06feece156dff21c0a974
Diffstat (limited to 'libbacktrace')
| -rw-r--r-- | libbacktrace/UnwindStack.cpp | 1 | ||||
| -rw-r--r-- | libbacktrace/UnwindStackMap.cpp | 7 | ||||
| -rw-r--r-- | libbacktrace/UnwindStackMap.h | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/libbacktrace/UnwindStack.cpp b/libbacktrace/UnwindStack.cpp index 2a555afc4..b0345a140 100644 --- a/libbacktrace/UnwindStack.cpp +++ b/libbacktrace/UnwindStack.cpp @@ -50,6 +50,7 @@ bool Backtrace::Unwind(unwindstack::Regs* regs, BacktraceMap* back_map, auto process_memory = stack_map->process_memory(); unwindstack::Unwinder unwinder(MAX_BACKTRACE_FRAMES + num_ignore_frames, stack_map->stack_maps(), regs, stack_map->process_memory()); + unwinder.SetJitDebug(stack_map->GetJitDebug(), regs->Arch()); unwinder.Unwind(skip_names, &stack_map->GetSuffixesToIgnore()); if (num_ignore_frames >= unwinder.NumFrames()) { diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp index 836a774b9..93406dc62 100644 --- a/libbacktrace/UnwindStackMap.cpp +++ b/libbacktrace/UnwindStackMap.cpp @@ -18,6 +18,9 @@ #include <stdlib.h> #include <sys/types.h> +#include <string> +#include <vector> + #include <backtrace/BacktraceMap.h> #include <unwindstack/Elf.h> #include <unwindstack/MapInfo.h> @@ -39,6 +42,10 @@ bool UnwindStackMap::Build() { // Create the process memory object. process_memory_ = unwindstack::Memory::CreateProcessMemory(pid_); + // Create a JitDebug object for getting jit unwind information. + std::vector<std::string> search_libs_{"libart.so", "libartd.so"}; + jit_debug_.reset(new unwindstack::JitDebug(process_memory_, search_libs_)); + if (!stack_maps_->Parse()) { return false; } diff --git a/libbacktrace/UnwindStackMap.h b/libbacktrace/UnwindStackMap.h index 2f63655fd..12c590982 100644 --- a/libbacktrace/UnwindStackMap.h +++ b/libbacktrace/UnwindStackMap.h @@ -23,6 +23,7 @@ #include <memory> #include <backtrace/BacktraceMap.h> +#include <unwindstack/JitDebug.h> #include <unwindstack/Maps.h> class UnwindStackMap : public BacktraceMap { @@ -41,11 +42,14 @@ class UnwindStackMap : public BacktraceMap { const std::shared_ptr<unwindstack::Memory>& process_memory() { return process_memory_; } + unwindstack::JitDebug* GetJitDebug() { return jit_debug_.get(); } + protected: uint64_t GetLoadBias(size_t index) override; std::unique_ptr<unwindstack::Maps> stack_maps_; std::shared_ptr<unwindstack::Memory> process_memory_; + std::unique_ptr<unwindstack::JitDebug> jit_debug_; }; #endif // _LIBBACKTRACE_UNWINDSTACK_MAP_H |
