libbacktrace_offline: support .ARM.exidx.
1. Read .ARM.exidx and .ARM.extab, provides these data to libunwind
through AccessMem.
2. In FindProcInfo, search .ARM.exidx for the idx entry of function
containing ip.
3. Add structures to store .ARM.exidx info in DebugFrameInfo, and
clean up the structure.
4. Add tests to test each unwind information (.eh_frame, .debug_frame,
.gnu_debugdata, .ARM.exidx) separately.
Bug: http://b/30974693
Test: run backtrace_test.
Test: run simpleperf runtest.py.
Change-Id: I9377a54379158bd35860efcf0e011423be7350d4
diff --git a/libbacktrace/BacktraceOffline.h b/libbacktrace/BacktraceOffline.h
index 42f826d..c0b686e 100644
--- a/libbacktrace/BacktraceOffline.h
+++ b/libbacktrace/BacktraceOffline.h
@@ -40,22 +40,7 @@
size_t Read(uint64_t addr, uint8_t* buffer, size_t size);
};
-struct DebugFrameInfo {
- bool is_eh_frame;
- struct EhFrame {
- uint64_t eh_frame_hdr_vaddr;
- uint64_t eh_frame_vaddr;
- uint64_t fde_table_offset_in_eh_frame_hdr;
- std::vector<uint8_t> eh_frame_hdr_data;
- std::vector<uint8_t> eh_frame_data;
- struct ProgramHeader {
- uint64_t vaddr;
- uint64_t file_offset;
- uint64_t file_size;
- };
- std::vector<ProgramHeader> program_headers;
- } eh_frame;
-};
+struct DebugFrameInfo;
class BacktraceOffline : public Backtrace {
public:
@@ -63,18 +48,13 @@
bool cache_file)
: Backtrace(pid, tid, map),
cache_file_(cache_file),
- context_(nullptr),
- last_debug_frame_(nullptr) {
+ context_(nullptr) {
stack_space_.start = stack.start;
stack_space_.end = stack.end;
stack_space_.data = stack.data;
}
- virtual ~BacktraceOffline() {
- if (last_debug_frame_ != nullptr) {
- delete last_debug_frame_;
- }
- }
+ virtual ~BacktraceOffline() = default;
bool Unwind(size_t num_ignore_frames, ucontext_t* context) override;
@@ -91,15 +71,13 @@
std::string GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset) override;
DebugFrameInfo* GetDebugFrameInFile(const std::string& filename);
- static std::unordered_map<std::string, std::unique_ptr<DebugFrameInfo>> debug_frames_;
- static std::unordered_set<std::string> debug_frame_missing_files_;
-
bool cache_file_;
ucontext_t* context_;
Space eh_frame_hdr_space_;
Space eh_frame_space_;
+ Space arm_extab_space_;
+ Space arm_exidx_space_;
Space stack_space_;
- DebugFrameInfo* last_debug_frame_;
};
#endif // _LIBBACKTRACE_BACKTRACE_OFFLINE_H