From df2906186b6952c57b1f662bfef0b65c9f8c2e0d Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 22 Jan 2014 19:21:07 -0800 Subject: Re-enable libunwind for arm. Update to handle the new optimized way that libunwind works. In addition, a small refactor of the BacktraceMap code. A few new tests of for good measure. Change-Id: I2f9b4f5ad5a0dfe907b31febee76e4b9b94fb76f --- include/backtrace/Backtrace.h | 4 ---- include/backtrace/BacktraceMap.h | 13 ++++++++----- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/backtrace/Backtrace.h b/include/backtrace/Backtrace.h index f0fb0cd..bd4134c 100644 --- a/include/backtrace/Backtrace.h +++ b/include/backtrace/Backtrace.h @@ -64,10 +64,6 @@ public: // Find the map associated with the given pc. virtual const backtrace_map_t* FindMap(uintptr_t pc); - // Take ownership of the BacktraceMap object associated with the backtrace. - // If this is called, the caller must handle deleting the object themselves. - virtual BacktraceMap* TakeMapOwnership(); - // Read the data at a specific address. virtual bool ReadWord(uintptr_t ptr, uint32_t* out_value) = 0; diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h index a53293a..06da2f4 100644 --- a/include/backtrace/BacktraceMap.h +++ b/include/backtrace/BacktraceMap.h @@ -28,8 +28,8 @@ #include #endif +#include #include -#include struct backtrace_map_t { uintptr_t start; @@ -40,7 +40,8 @@ struct backtrace_map_t { class BacktraceMap { public: - BacktraceMap(pid_t pid); + static BacktraceMap* Create(pid_t pid); + virtual ~BacktraceMap(); // Get the map data structure for the given address. @@ -60,20 +61,22 @@ public: bool IsWritable(uintptr_t pc) { return GetFlags(pc) & PROT_WRITE; } bool IsExecutable(uintptr_t pc) { return GetFlags(pc) & PROT_EXEC; } - typedef std::vector::iterator iterator; + typedef std::deque::iterator iterator; iterator begin() { return maps_.begin(); } iterator end() { return maps_.end(); } - typedef std::vector::const_iterator const_iterator; + typedef std::deque::const_iterator const_iterator; const_iterator begin() const { return maps_.begin(); } const_iterator end() const { return maps_.end(); } virtual bool Build(); protected: + BacktraceMap(pid_t pid); + virtual bool ParseLine(const char* line, backtrace_map_t* map); - std::vector maps_; + std::deque maps_; pid_t pid_; }; -- cgit v1.1