diff options
author | Christopher Ferris <cferris@google.com> | 2014-01-06 19:16:33 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-01-08 15:32:28 -0800 |
commit | 9846497f7926fc3240c2893d89e60880c22d1fd6 (patch) | |
tree | d137d0957607cbdf211f6323516a8b8968004c7a /debuggerd | |
parent | 0afaf7f4dde98ff554b69d05ed87ceab4ec611aa (diff) | |
download | system_core-9846497f7926fc3240c2893d89e60880c22d1fd6.zip system_core-9846497f7926fc3240c2893d89e60880c22d1fd6.tar.gz system_core-9846497f7926fc3240c2893d89e60880c22d1fd6.tar.bz2 |
Refactor to share map_info amongst threads.
Allow the use of the same map info to be shared when getting information on
multiple threads from the same pid.
Change-Id: I2e460e20154a10f4894ae563331fb32179e4551f
Diffstat (limited to 'debuggerd')
-rw-r--r-- | debuggerd/tombstone.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/debuggerd/tombstone.c b/debuggerd/tombstone.c index aa63547..1b08e8e 100644 --- a/debuggerd/tombstone.c +++ b/debuggerd/tombstone.c @@ -415,7 +415,7 @@ static void dump_thread(const backtrace_context_t* context, log_t* log, /* Return true if some thread is not detached cleanly */ static bool dump_sibling_thread_report( - log_t* log, pid_t pid, pid_t tid, int* total_sleep_time_usec) { + log_t* log, pid_t pid, pid_t tid, int* total_sleep_time_usec, backtrace_map_info_t* map_info) { char task_path[64]; snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid); @@ -449,7 +449,7 @@ static bool dump_sibling_thread_report( _LOG(log, 0, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n"); dump_thread_info(log, pid, new_tid, 0); backtrace_context_t new_context; - if (backtrace_create_context(&new_context, pid, new_tid, 0)) { + if (backtrace_create_context_with_map(&new_context, pid, new_tid, 0, map_info)) { dump_thread(&new_context, log, 0, total_sleep_time_usec); backtrace_destroy_context(&new_context); } @@ -676,7 +676,9 @@ static bool dump_crash(log_t* log, pid_t pid, pid_t tid, int signal, uintptr_t a } backtrace_context_t context; - if (backtrace_create_context(&context, pid, tid, 0)) { + /* Gather the map info once for all this process' threads. */ + backtrace_map_info_t* map_info = backtrace_create_map_info_list(pid); + if (backtrace_create_context_with_map(&context, pid, tid, 0, map_info)) { dump_abort_message(&context, log, abort_msg_address); dump_thread(&context, log, SCOPE_AT_FAULT, total_sleep_time_usec); backtrace_destroy_context(&context); @@ -688,9 +690,12 @@ static bool dump_crash(log_t* log, pid_t pid, pid_t tid, int signal, uintptr_t a bool detach_failed = false; if (dump_sibling_threads) { - detach_failed = dump_sibling_thread_report(log, pid, tid, total_sleep_time_usec); + detach_failed = dump_sibling_thread_report(log, pid, tid, total_sleep_time_usec, map_info); } + /* Destroy the previously created map info. */ + backtrace_destroy_map_info_list(map_info); + if (want_logs) { dump_logs(log, pid, false); } |