summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-03-23 21:10:38 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-03-23 21:10:38 +0000
commit8aeabe15dd38093029714dabb1713724400cf5f1 (patch)
tree8d899e827ec4e3d3a28612f261e4439a78bfe53b /debuggerd
parent6e183586e373eec72f62d29b6c3c21ce744caef5 (diff)
parent280800552165b4685fbe86fd8e9dc3b9d9b062cb (diff)
downloadcore-8aeabe15dd38093029714dabb1713724400cf5f1.tar.gz
core-8aeabe15dd38093029714dabb1713724400cf5f1.tar.bz2
core-8aeabe15dd38093029714dabb1713724400cf5f1.zip
Merge "debuggerd: waitpid for all children, and log the result."
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/debuggerd.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp
index 94be9bf09..606456806 100644
--- a/debuggerd/debuggerd.cpp
+++ b/debuggerd/debuggerd.cpp
@@ -580,9 +580,20 @@ static void monitor_worker_process(int child_pid, const debugger_request_t& requ
siginfo_t siginfo;
int signal = TEMP_FAILURE_RETRY(sigtimedwait(&signal_set, &siginfo, &timeout));
if (signal == SIGCHLD) {
- pid_t rc = waitpid(0, &status, WNOHANG | WUNTRACED);
+ pid_t rc = waitpid(-1, &status, WNOHANG | WUNTRACED);
if (rc != child_pid) {
ALOGE("debuggerd: waitpid returned unexpected pid (%d), committing murder-suicide", rc);
+
+ if (WIFEXITED(status)) {
+ ALOGW("debuggerd: pid %d exited with status %d", rc, WEXITSTATUS(status));
+ } else if (WIFSIGNALED(status)) {
+ ALOGW("debuggerd: pid %d received signal %d", rc, WTERMSIG(status));
+ } else if (WIFSTOPPED(status)) {
+ ALOGW("debuggerd: pid %d stopped by signal %d", rc, WSTOPSIG(status));
+ } else if (WIFCONTINUED(status)) {
+ ALOGW("debuggerd: pid %d continued", rc);
+ }
+
kill_worker = true;
kill_target = true;
kill_self = true;