summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-08-04 17:08:46 -0700
committerChristopher Ferris <cferris@google.com>2014-08-04 19:21:23 -0700
commitdda47b786835ef3689f06e24650eb65176e2dc5e (patch)
tree03949c0f356c2f706d65f8b17c904f05b19d1a45
parent39a8ade7eebc945a112c10ba3331bd9a0934dbec (diff)
downloadsystem_core-dda47b786835ef3689f06e24650eb65176e2dc5e.zip
system_core-dda47b786835ef3689f06e24650eb65176e2dc5e.tar.gz
system_core-dda47b786835ef3689f06e24650eb65176e2dc5e.tar.bz2
Allow getting an uncached process map.
(cherry picked from commit f02593b0e61f8108449770094caa7bb39a646ec1) Change-Id: I2012bf2dc553ebc663345b9eac6d794e80df9c00
-rw-r--r--include/backtrace/BacktraceMap.h5
-rw-r--r--libbacktrace/UnwindMap.cpp8
2 files changed, 10 insertions, 3 deletions
diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h
index c717f09..4ed23a8 100644
--- a/include/backtrace/BacktraceMap.h
+++ b/include/backtrace/BacktraceMap.h
@@ -41,7 +41,10 @@ struct backtrace_map_t {
class BacktraceMap {
public:
- static BacktraceMap* Create(pid_t pid);
+ // If uncached is true, then parse the current process map as of the call.
+ // Passing a map created with uncached set to true to Backtrace::Create()
+ // is unsupported.
+ static BacktraceMap* Create(pid_t pid, bool uncached = false);
virtual ~BacktraceMap();
diff --git a/libbacktrace/UnwindMap.cpp b/libbacktrace/UnwindMap.cpp
index 4f9831b..387d768 100644
--- a/libbacktrace/UnwindMap.cpp
+++ b/libbacktrace/UnwindMap.cpp
@@ -130,9 +130,13 @@ const backtrace_map_t* UnwindMapLocal::Find(uintptr_t addr) {
//-------------------------------------------------------------------------
// BacktraceMap create function.
//-------------------------------------------------------------------------
-BacktraceMap* BacktraceMap::Create(pid_t pid) {
+BacktraceMap* BacktraceMap::Create(pid_t pid, bool uncached) {
BacktraceMap* map;
- if (pid == getpid()) {
+
+ if (uncached) {
+ // Force use of the base class to parse the maps when this call is made.
+ map = new BacktraceMap(pid);
+ } else if (pid == getpid()) {
map = new UnwindMapLocal();
} else {
map = new UnwindMap(pid);