summaryrefslogtreecommitdiffstats
path: root/debuggerd/libdebuggerd/tombstone.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-05-30 12:55:04 -0700
committerElliott Hughes <enh@google.com>2018-05-30 12:58:43 -0700
commit2baf443a21f3d7c763ffcd36b0eb0445bf05d8e0 (patch)
tree2d6233956ad2c7f9dd83f887c9077744e8b2ab76 /debuggerd/libdebuggerd/tombstone.cpp
parentd580c441ab45a6b7278da003e19af64e9ea2cc71 (diff)
downloadsystem_core-2baf443a21f3d7c763ffcd36b0eb0445bf05d8e0.tar.gz
system_core-2baf443a21f3d7c763ffcd36b0eb0445bf05d8e0.tar.bz2
system_core-2baf443a21f3d7c763ffcd36b0eb0445bf05d8e0.zip
Improve SIGILL support.
Include the illegal instruction in the header if we get a SIGILL. Otherwise (since these tend to be one-off bit flips), we don't usually have any information to try to confirm our suspicion that any given instance is actually a one-off bit flip. Also add `SIGILL` as a crasher option to easily generate such crashes. Before: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xab1456da After: signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 0xab1456da (*pc=0xe7f0def0) Bug: http://b/77274448 Test: ran crasher Change-Id: I5f8dedca5eea2b117b1b1e48430214b38e1366ed
Diffstat (limited to 'debuggerd/libdebuggerd/tombstone.cpp')
-rw-r--r--debuggerd/libdebuggerd/tombstone.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index e11be1ea7..433bb4657 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -102,10 +102,17 @@ static void dump_probable_cause(log_t* log, const siginfo_t* si) {
if (!cause.empty()) _LOG(log, logtype::HEADER, "Cause: %s\n", cause.c_str());
}
-static void dump_signal_info(log_t* log, const ThreadInfo& thread_info) {
- char addr_desc[32]; // ", fault addr 0x1234"
+static void dump_signal_info(log_t* log, const ThreadInfo& thread_info, Memory* process_memory) {
+ char addr_desc[64]; // ", fault addr 0x1234"
if (signal_has_si_addr(thread_info.siginfo)) {
- snprintf(addr_desc, sizeof(addr_desc), "%p", thread_info.siginfo->si_addr);
+ void* addr = thread_info.siginfo->si_addr;
+ if (thread_info.siginfo->si_signo == SIGILL) {
+ uint32_t instruction = {};
+ process_memory->Read(reinterpret_cast<uint64_t>(addr), &instruction, sizeof(instruction));
+ snprintf(addr_desc, sizeof(addr_desc), "%p (*pc=%#08x)", addr, instruction);
+ } else {
+ snprintf(addr_desc, sizeof(addr_desc), "%p", addr);
+ }
} else {
snprintf(addr_desc, sizeof(addr_desc), "--------");
}
@@ -418,7 +425,7 @@ static bool dump_thread(log_t* log, BacktraceMap* map, Memory* process_memory,
dump_thread_info(log, thread_info);
if (thread_info.siginfo) {
- dump_signal_info(log, thread_info);
+ dump_signal_info(log, thread_info, process_memory);
}
if (primary_thread) {