Fix debuggerd issues.
- Fix a problem where a tid exits before the attach completes, and it
causes debuggerd to self terminate.
- Fix a problem where sibling tid dumps do not properly wait for the tid
to get signalled.
Bug: 17800180
Bug: 12567315
(cherry picked from commit 84ddb34a3af77dbe490aaa07b738bbfd7109d5ba)
Change-Id: I45e33865614d4c96f4a89cf117398666b556d500
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index 32f0eca..5b111ab 100755
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -374,11 +374,7 @@
}
}
-static void dump_thread(
- Backtrace* backtrace, log_t* log, int* total_sleep_time_usec) {
-
- wait_for_stop(backtrace->Tid(), total_sleep_time_usec);
-
+static void dump_thread(Backtrace* backtrace, log_t* log) {
dump_registers(log, backtrace->Tid());
dump_backtrace_and_stack(backtrace, log);
@@ -421,13 +417,17 @@
continue;
}
+ if (wait_for_sigstop(new_tid, total_sleep_time_usec, &detach_failed) == -1) {
+ continue;
+ }
+
log->current_tid = new_tid;
_LOG(log, logtype::THREAD, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
dump_thread_info(log, pid, new_tid);
UniquePtr<Backtrace> backtrace(Backtrace::Create(pid, new_tid, map));
if (backtrace->Unwind(0)) {
- dump_thread(backtrace.get(), log, total_sleep_time_usec);
+ dump_thread(backtrace.get(), log);
}
log->current_tid = log->crashed_tid;
@@ -628,7 +628,7 @@
UniquePtr<Backtrace> backtrace(Backtrace::Create(pid, tid, map.get()));
if (backtrace->Unwind(0)) {
dump_abort_message(backtrace.get(), log, abort_msg_address);
- dump_thread(backtrace.get(), log, total_sleep_time_usec);
+ dump_thread(backtrace.get(), log);
}
if (want_logs) {