From e5cc5396e83d12b7ca02ff6096a9950807aa010d Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 18 Oct 2011 20:03:07 -0700 Subject: Add log summary to tombstones When the tombstones are uploaded to APR, they're truncated at 64KB. This causes the log data, which is at the end, to be lost if the process has more than about 12 threads (which many do). This change adds the last few lines of the log right below the report for the crashing thread, where we should be guaranteed to keep it. Also, clean up trailing newlines on log messages (which end up in the tombstone), and don't print a "------- log" banner if there aren't any messages in that log file (e.g. slog). Also also, don't try to show_nearby_maps unless this is the crashing thread. Bug 5471955 Change-Id: Iaa4fd2fafbaeda2f20bb95f202177d7744a91f9d --- debuggerd/arm/machine.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'debuggerd/arm') diff --git a/debuggerd/arm/machine.c b/debuggerd/arm/machine.c index fb0d6baa..d5efb79f 100644 --- a/debuggerd/arm/machine.c +++ b/debuggerd/arm/machine.c @@ -56,6 +56,8 @@ extern int unwind_backtrace_with_ptrace(int tfd, pid_t pid, mapinfo *map, /* * If this isn't clearly a null pointer dereference, dump the * /proc/maps entries near the fault address. + * + * This only makes sense to do on the thread that crashed. */ static void show_nearby_maps(int tfd, int pid, mapinfo *map) { @@ -63,7 +65,8 @@ static void show_nearby_maps(int tfd, int pid, mapinfo *map) memset(&si, 0, sizeof(si)); if (ptrace(PTRACE_GETSIGINFO, pid, 0, &si)) { - _LOG(tfd, false, "cannot get siginfo: %s\n", strerror(errno)); + _LOG(tfd, false, "cannot get siginfo for %d: %s\n", + pid, strerror(errno)); return; } if (!signal_has_address(si.si_signo)) @@ -237,7 +240,9 @@ void dump_stack_and_code(int tfd, int pid, mapinfo *map, } } - show_nearby_maps(tfd, pid, map); + if (at_fault) { + show_nearby_maps(tfd, pid, map); + } unsigned int p, end; unsigned int sp = r.ARM_sp; -- cgit v1.2.3