summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrigid Smith <brigidsmith@google.com>2014-06-19 16:47:59 -0700
committerBrigid Smith <brigidsmith@google.com>2014-06-20 09:30:16 -0700
commit2e8290463eff6e66e17b8afa0bcdfe4ff2e920cf (patch)
tree3f2bb0e006f88ffbe6e33f9de3d1c6f981f0d078
parenta4fb975e3d85b7668aa6f564c6a0d4d85f550f2e (diff)
downloadsystem_core-2e8290463eff6e66e17b8afa0bcdfe4ff2e920cf.zip
system_core-2e8290463eff6e66e17b8afa0bcdfe4ff2e920cf.tar.gz
system_core-2e8290463eff6e66e17b8afa0bcdfe4ff2e920cf.tar.bz2
Maps output now marks the fault address location.
If the fault address is not within a mapped region, it logs an error message after the output. Otherwise, it prefixes the location of the fault address with "--->" to make it easier to locate. Change-Id: I330adaade4402ffeb09f1a6d34a944c2f054d06d
-rwxr-xr-xdebuggerd/tombstone.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index 725fd54..952b58e 100755
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -343,8 +343,9 @@ static void dump_backtrace_and_stack(Backtrace* backtrace, log_t* log) {
}
}
-static void dump_map(log_t* log, const backtrace_map_t* map) {
- _LOG(log, logtype::MAPS, " %" PRIPTR "-%" PRIPTR " %c%c%c %s\n", map->start, map->end,
+static void dump_map(log_t* log, const backtrace_map_t* map, bool fault_addr) {
+ _LOG(log, logtype::MAPS, "%s%" PRIPTR "-%" PRIPTR " %c%c%c %s\n",
+ (fault_addr? "--->" : " "), map->start, map->end,
(map->flags & PROT_READ) ? 'r' : '-', (map->flags & PROT_WRITE) ? 'w' : '-',
(map->flags & PROT_EXEC) ? 'x' : '-', map->name.c_str());
}
@@ -366,10 +367,18 @@ static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) {
return;
}
- _LOG(log, logtype::MAPS, "\nmemory map:\n");
+ _LOG(log, logtype::MAPS, "\nmemory map: (fault address prefixed with --->)\n");
+ bool found_map = false;
for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) {
- dump_map(log, &*it);
+ bool in_map = addr >= (*it).start && addr < (*it).end;
+ dump_map(log, &*it, in_map);
+ if(in_map) {
+ found_map = true;
+ }
+ }
+ if(!found_map) {
+ _LOG(log, logtype::ERROR, "\nFault address was not in any map!");
}
}