diff options
author | Christopher Tate | 2013-04-18 16:44:37 -0500 |
---|---|---|
committer | Android (Google) Code Review | 2013-04-18 16:44:38 -0500 |
commit | b3478f4a50fc44bf573dc4caf4f7e1ddcc4f0eea (patch) | |
tree | ed09a5808b4e806b01482bff1325b89bcef6467f | |
parent | ca0cb785cb6a2316e9102059993e0a173220c92d (diff) | |
parent | 300fd6fdbc19bbb64a13b0a9d0ea7d284a831e33 (diff) | |
download | platform-system-core-b3478f4a50fc44bf573dc4caf4f7e1ddcc4f0eea.tar.gz platform-system-core-b3478f4a50fc44bf573dc4caf4f7e1ddcc4f0eea.tar.xz platform-system-core-b3478f4a50fc44bf573dc4caf4f7e1ddcc4f0eea.zip |
Merge "Fix regression: log mem maps around native fault address" into jb-mr2-dev
-rw-r--r-- | debuggerd/tombstone.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/debuggerd/tombstone.c b/debuggerd/tombstone.c index 714612053..77f6ef1c0 100644 --- a/debuggerd/tombstone.c +++ b/debuggerd/tombstone.c | |||
@@ -357,23 +357,24 @@ static void dump_backtrace_and_stack(const ptrace_context_t* context, log_t* log | |||
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | static void dump_map(log_t* log, map_info_t* m, const char* what) { | 360 | static void dump_map(log_t* log, map_info_t* m, const char* what, int scopeFlags) { |
361 | if (m != NULL) { | 361 | if (m != NULL) { |
362 | _LOG(log, SCOPE_SENSITIVE, " %08x-%08x %c%c%c %s\n", m->start, m->end, | 362 | _LOG(log, scopeFlags, " %08x-%08x %c%c%c %s\n", m->start, m->end, |
363 | m->is_readable ? 'r' : '-', | 363 | m->is_readable ? 'r' : '-', |
364 | m->is_writable ? 'w' : '-', | 364 | m->is_writable ? 'w' : '-', |
365 | m->is_executable ? 'x' : '-', | 365 | m->is_executable ? 'x' : '-', |
366 | m->name); | 366 | m->name); |
367 | } else { | 367 | } else { |
368 | _LOG(log, SCOPE_SENSITIVE, " (no %s)\n", what); | 368 | _LOG(log, scopeFlags, " (no %s)\n", what); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | static void dump_nearby_maps(const ptrace_context_t* context, log_t* log, pid_t tid) { | 372 | static void dump_nearby_maps(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault) { |
373 | int scopeFlags = SCOPE_SENSITIVE | (at_fault ? SCOPE_AT_FAULT : 0); | ||
373 | siginfo_t si; | 374 | siginfo_t si; |
374 | memset(&si, 0, sizeof(si)); | 375 | memset(&si, 0, sizeof(si)); |
375 | if (ptrace(PTRACE_GETSIGINFO, tid, 0, &si)) { | 376 | if (ptrace(PTRACE_GETSIGINFO, tid, 0, &si)) { |
376 | _LOG(log, SCOPE_SENSITIVE, "cannot get siginfo for %d: %s\n", | 377 | _LOG(log, scopeFlags, "cannot get siginfo for %d: %s\n", |
377 | tid, strerror(errno)); | 378 | tid, strerror(errno)); |
378 | return; | 379 | return; |
379 | } | 380 | } |
@@ -387,7 +388,7 @@ static void dump_nearby_maps(const ptrace_context_t* context, log_t* log, pid_t | |||
387 | return; | 388 | return; |
388 | } | 389 | } |
389 | 390 | ||
390 | _LOG(log, SCOPE_SENSITIVE, "\nmemory map around fault addr %08x:\n", (int)si.si_addr); | 391 | _LOG(log, scopeFlags, "\nmemory map around fault addr %08x:\n", (int)si.si_addr); |
391 | 392 | ||
392 | /* | 393 | /* |
393 | * Search for a match, or for a hole where the match would be. The list | 394 | * Search for a match, or for a hole where the match would be. The list |
@@ -415,9 +416,9 @@ static void dump_nearby_maps(const ptrace_context_t* context, log_t* log, pid_t | |||
415 | * Show "next" then "match" then "prev" so that the addresses appear in | 416 | * Show "next" then "match" then "prev" so that the addresses appear in |
416 | * ascending order (like /proc/pid/maps). | 417 | * ascending order (like /proc/pid/maps). |
417 | */ | 418 | */ |
418 | dump_map(log, next, "map below"); | 419 | dump_map(log, next, "map below", scopeFlags); |
419 | dump_map(log, map, "map for address"); | 420 | dump_map(log, map, "map for address", scopeFlags); |
420 | dump_map(log, prev, "map above"); | 421 | dump_map(log, prev, "map above", scopeFlags); |
421 | } | 422 | } |
422 | 423 | ||
423 | static void dump_thread(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault, | 424 | static void dump_thread(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault, |
@@ -428,7 +429,7 @@ static void dump_thread(const ptrace_context_t* context, log_t* log, pid_t tid, | |||
428 | dump_backtrace_and_stack(context, log, tid, at_fault); | 429 | dump_backtrace_and_stack(context, log, tid, at_fault); |
429 | if (at_fault) { | 430 | if (at_fault) { |
430 | dump_memory_and_code(context, log, tid, at_fault); | 431 | dump_memory_and_code(context, log, tid, at_fault); |
431 | dump_nearby_maps(context, log, tid); | 432 | dump_nearby_maps(context, log, tid, at_fault); |
432 | } | 433 | } |
433 | } | 434 | } |
434 | 435 | ||