From 136dcc5ce628a1ba600a6818e5cb24d5f15eb016 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 22 Sep 2011 16:37:06 -0700 Subject: Show maps near native fault address This adds some additional output to native crashes. For example, if something tried to access a bit of mmap(/dev/zero) memory that had been mprotect()ed, you might see output like this: I DEBUG : memory map around addr 4015a00c: I DEBUG : 40159000-4015a000 /system/lib/libstdc++.so I DEBUG : 4015a000-40162000 /dev/zero I DEBUG : b0001000-b0009000 /system/bin/linker The idea is to see what's in and around the fault address to make it easier to identify bus errors due to file truncation and segmentation faults caused by buffer over/underruns. No output is generated for accesses below 0x1000 (which are likely NULL pointer dereferences) or for signals that don't set si_addr. Also, suppress the fault address for signals that don't set si_addr: I DEBUG : signal 6 (SIGABRT), code 0 (?), fault addr -------- We still print "fault addr" followed by 8 characters for anything that is parsing the contents. The "address" shown for signals like SIGABRT was meaningless and possibly confusing. Bug 5358516 Change-Id: Icae8ef309ea2d89b129f68d30f96b2ca8a69cc6c --- debuggerd/utility.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'debuggerd/utility.h') diff --git a/debuggerd/utility.h b/debuggerd/utility.h index 45e2067a..4a935d2a 100644 --- a/debuggerd/utility.h +++ b/debuggerd/utility.h @@ -36,6 +36,7 @@ typedef struct mapinfo { unsigned exidx_start; unsigned exidx_end; struct symbol_table *symbols; + bool isExecutable; char name[]; } mapinfo; @@ -56,6 +57,9 @@ const char *map_to_name(mapinfo *mi, unsigned pc, const char* def); /* Log information onto the tombstone */ extern void _LOG(int tfd, bool in_tombstone_only, const char *fmt, ...); +/* Determine whether si_addr is valid for this signal */ +bool signal_has_address(int sig); + #define LOG(fmt...) _LOG(-1, 0, fmt) /* Set to 1 for normal debug traces */ -- cgit v1.2.3