summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-01-22 19:21:07 -0800
committerChristopher Ferris <cferris@google.com>2014-01-28 12:03:36 -0800
commitdf2906186b6952c57b1f662bfef0b65c9f8c2e0d (patch)
treee5ed8339b7fd42ff20047244f87106c8f1fa0d45 /include
parent6ddabb7a1cc3080ae773acb045f69b5e6afee87a (diff)
downloadsystem_core-df2906186b6952c57b1f662bfef0b65c9f8c2e0d.zip
system_core-df2906186b6952c57b1f662bfef0b65c9f8c2e0d.tar.gz
system_core-df2906186b6952c57b1f662bfef0b65c9f8c2e0d.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/backtrace/Backtrace.h4
-rw-r--r--include/backtrace/BacktraceMap.h13
2 files changed, 8 insertions, 9 deletions
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 <sys/mman.h>
#endif
+#include <deque>
#include <string>
-#include <vector>
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<backtrace_map_t>::iterator iterator;
+ typedef std::deque<backtrace_map_t>::iterator iterator;
iterator begin() { return maps_.begin(); }
iterator end() { return maps_.end(); }
- typedef std::vector<backtrace_map_t>::const_iterator const_iterator;
+ typedef std::deque<backtrace_map_t>::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<backtrace_map_t> maps_;
+ std::deque<backtrace_map_t> maps_;
pid_t pid_;
};