diff options
author | Narayan Kamath <narayan@google.com> | 2017-05-24 15:07:25 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2017-05-31 10:35:32 +0100 |
commit | a73df601b7fe192001f4b9b5ddeb17b8efe3981b (patch) | |
tree | 268e9df211bc6e81391f8e121e9ccde25c70b26c /debuggerd/handler/debuggerd_handler.cpp | |
parent | 844940d751be6cf6078c9e816fc09356034c1b26 (diff) |
tombstoned: allow intercepts for java traces.
All intercept requests and crash dump requests must now specify a
dump_type, which can be one of kDebuggerdNativeBacktrace,
kDebuggerdTombstone or kDebuggerdJavaBacktrace. Each process can have
only one outstanding intercept registered at a time.
There's only one non-trivial change in this changeset; and that is
to crash_dump. We now pass the type of dump via a command line
argument instead of inferring it from the (resent) signal, this allows
us to connect to tombstoned before we wait for the signal as the
protocol requires.
Test: debuggerd_test
Change-Id: I189b215acfecd08ac52ab29117e3465da00e3a37
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r-- | debuggerd/handler/debuggerd_handler.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp index 8fd6e1141..55cd03e38 100644 --- a/debuggerd/handler/debuggerd_handler.cpp +++ b/debuggerd/handler/debuggerd_handler.cpp @@ -50,6 +50,8 @@ #include <async_safe/log.h> +#include "dump_type.h" + // see man(2) prctl, specifically the section about PR_GET_NAME #define MAX_TASK_NAME_LEN (16) @@ -253,6 +255,14 @@ struct debugger_thread_info { // process. static void* pseudothread_stack; +static DebuggerdDumpType get_dump_type(const debugger_thread_info* thread_info) { + if (thread_info->signal_number == DEBUGGER_SIGNAL && thread_info->info->si_value.sival_int) { + return kDebuggerdNativeBacktrace; + } + + return kDebuggerdTombstone; +} + static int debuggerd_dispatch_pseudothread(void* arg) { debugger_thread_info* thread_info = static_cast<debugger_thread_info*>(arg); @@ -285,11 +295,15 @@ static int debuggerd_dispatch_pseudothread(void* arg) { char main_tid[10]; char pseudothread_tid[10]; + char debuggerd_dump_type[10]; async_safe_format_buffer(main_tid, sizeof(main_tid), "%d", thread_info->crashing_tid); async_safe_format_buffer(pseudothread_tid, sizeof(pseudothread_tid), "%d", thread_info->pseudothread_tid); + async_safe_format_buffer(debuggerd_dump_type, sizeof(debuggerd_dump_type), "%d", + get_dump_type(thread_info)); - execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, nullptr); + execl(CRASH_DUMP_PATH, CRASH_DUMP_NAME, main_tid, pseudothread_tid, debuggerd_dump_type, + nullptr); fatal_errno("exec failed"); } else { |