diff options
author | Brigid Smith <brigidsmith@google.com> | 2014-06-17 14:55:47 -0700 |
---|---|---|
committer | Brigid Smith <brigidsmith@google.com> | 2014-06-17 15:32:22 -0700 |
commit | 7b2078eeb4f68f3a81695de64ec8df003d3f8e3c (patch) | |
tree | dc8bce931343e29ca33b21ea47737099bffd61b4 /debuggerd/tombstone.cpp | |
parent | 5bc6b5b804546c683953393441e697e0eb84ac48 (diff) | |
download | system_core-7b2078eeb4f68f3a81695de64ec8df003d3f8e3c.zip system_core-7b2078eeb4f68f3a81695de64ec8df003d3f8e3c.tar.gz system_core-7b2078eeb4f68f3a81695de64ec8df003d3f8e3c.tar.bz2 |
Changed maps output in debuggerd.
Now the map output is only sent to the tombstone, and the entire
contents of /prod/$PID/maps is logged, not just 3 lines. Additionally,
crasher now supports "crasher SIGSEGV-non-null", which attempts to write to a
dereferenced function address, causing a SIGSEGV at a non-zero address.
This new crasher mode can be used to test the new maps output.
Bug: 15343662
Change-Id: I796d92e8352a6b9714bbbfe96f3143c56565ef2f
Diffstat (limited to 'debuggerd/tombstone.cpp')
-rwxr-xr-x | debuggerd/tombstone.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp index a06effc..37839aa 100755 --- a/debuggerd/tombstone.cpp +++ b/debuggerd/tombstone.cpp @@ -343,14 +343,10 @@ static void dump_backtrace_and_stack(Backtrace* backtrace, log_t* log) { } } -static void dump_map(log_t* log, const backtrace_map_t* map, const char* what) { - if (map != NULL) { - _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) { + _LOG(log, logtype::MAPS, " %" PRIPTR "-%" PRIPTR " %c%c%c %s\n", map->start, map->end, (map->flags & PROT_READ) ? 'r' : '-', (map->flags & PROT_WRITE) ? 'w' : '-', (map->flags & PROT_EXEC) ? 'x' : '-', map->name.c_str()); - } else { - _LOG(log, logtype::MAPS, " (no %s)\n", what); - } } static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) { @@ -370,31 +366,11 @@ static void dump_nearby_maps(BacktraceMap* map, log_t* log, pid_t tid) { return; } - _LOG(log, logtype::MAPS, "\nmemory map around fault addr %" PRIPTR ":\n", - reinterpret_cast<uintptr_t>(si.si_addr)); + _LOG(log, logtype::MAPS, "\nmemory map:\n"); - // Search for a match, or for a hole where the match would be. The list - // is backward from the file content, so it starts at high addresses. - const backtrace_map_t* cur_map = NULL; - const backtrace_map_t* next_map = NULL; - const backtrace_map_t* prev_map = NULL; for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) { - if (addr >= it->start && addr < it->end) { - cur_map = &*it; - if (it != map->begin()) { - prev_map = &*(it-1); - } - if (++it != map->end()) { - next_map = &*it; - } - break; - } + dump_map(log, &*it); } - - // Show the map address in ascending order (like /proc/pid/maps). - dump_map(log, prev_map, "map below"); - dump_map(log, cur_map, "map for address"); - dump_map(log, next_map, "map above"); } static void dump_thread( |