summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_handler.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-12-23 00:20:55 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-12-23 00:20:55 +0000
commitc881c49ab0be45070cef342ee0bec841fc008c6f (patch)
tree97a609b7e02231eea647dfbe37c73a48d504c304 /debuggerd/handler/debuggerd_handler.cpp
parentf2aa5ec25460e5c0bb4226c14d377ec23160a49d (diff)
parent6c9ea516da9bc1619e4bdc504cc1aeccdfbd97d2 (diff)
Merge "debuggerd: wait for dump completion on crashes." am: 1f3b605c41 am: 65e2c06a90
am: 6c9ea516da Change-Id: I0063c9f0e4f3e21ff0023069ff9a061d54b373d8
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 02bc4b84f..96f3c7c54 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -395,9 +395,6 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
// crash_dump is ptracing us, fork off a copy of our address space for it to use.
create_vm_process();
- input_read.reset();
- input_write.reset();
-
// Don't leave a zombie child.
int status;
if (TEMP_FAILURE_RETRY(waitpid(crash_dump_pid, &status, 0)) == -1) {
@@ -406,6 +403,14 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
} else if (WIFSTOPPED(status) || WIFSIGNALED(status)) {
async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped");
}
+
+ if (thread_info->siginfo->si_signo != DEBUGGER_SIGNAL) {
+ // For crashes, we don't need to minimize pause latency.
+ // Wait for the dump to complete before having the process exit, to avoid being murdered by
+ // ActivityManager or init.
+ TEMP_FAILURE_RETRY(read(input_read, &buf, sizeof(buf)));
+ }
+
return 0;
}