summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-06-21 08:39:41 -0700
committerElliott Hughes <enh@google.com>2017-06-21 08:45:33 -0700
commit336a52e00cd270f4c0cab0e2b9b260f4f9132d6f (patch)
tree501fb8a35e101e948e56716a106c7ccd81860a1d /debuggerd
parent199c27734f0e27aab5ed26ca20b2c93945c29732 (diff)
downloadcore-336a52e00cd270f4c0cab0e2b9b260f4f9132d6f.tar.gz
core-336a52e00cd270f4c0cab0e2b9b260f4f9132d6f.tar.bz2
core-336a52e00cd270f4c0cab0e2b9b260f4f9132d6f.zip
Decode ptrace-induced SIGTRAP si_code values.
Example: signal 5 (SIGTRAP), code -32763 (PTRACE_EVENT_STOP), fault addr 0x274e00005fb3 I'm tempted to say that %d isn't the best choice for si_code, but as long as we're fully decoding all the values, I don't think it matters. Bug: http://b/62856172 Test: manual debuggerd run Change-Id: Ieeca690828e1e12f4162bbadece53f4aa7b9537a
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/libdebuggerd/tombstone.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index edc7be5e2..996d7146c 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -168,6 +168,26 @@ static const char* get_sigcode(int signo, int code) {
case TRAP_BRANCH: return "TRAP_BRANCH";
case TRAP_HWBKPT: return "TRAP_HWBKPT";
}
+ if ((code & 0xff) == SIGTRAP) {
+ switch ((code >> 8) & 0xff) {
+ case PTRACE_EVENT_FORK:
+ return "PTRACE_EVENT_FORK";
+ case PTRACE_EVENT_VFORK:
+ return "PTRACE_EVENT_VFORK";
+ case PTRACE_EVENT_CLONE:
+ return "PTRACE_EVENT_CLONE";
+ case PTRACE_EVENT_EXEC:
+ return "PTRACE_EVENT_EXEC";
+ case PTRACE_EVENT_VFORK_DONE:
+ return "PTRACE_EVENT_VFORK_DONE";
+ case PTRACE_EVENT_EXIT:
+ return "PTRACE_EVENT_EXIT";
+ case PTRACE_EVENT_SECCOMP:
+ return "PTRACE_EVENT_SECCOMP";
+ case PTRACE_EVENT_STOP:
+ return "PTRACE_EVENT_STOP";
+ }
+ }
static_assert(NSIGTRAP == TRAP_HWBKPT, "missing TRAP_* si_code");
break;
}