diff options
author | Josh Gao <jmgao@google.com> | 2016-03-22 16:37:45 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2016-03-23 14:07:58 -0700 |
commit | 24464185eb260b4af577895e1c2d35b734a7f99b (patch) | |
tree | 69db6e3b90665a54dddedbf29bd0f23c4603a241 /debuggerd | |
parent | 6a7ddbd37dbcf764d50041670fb6065f74c00391 (diff) | |
download | system_core-24464185eb260b4af577895e1c2d35b734a7f99b.tar.gz system_core-24464185eb260b4af577895e1c2d35b734a7f99b.tar.bz2 system_core-24464185eb260b4af577895e1c2d35b734a7f99b.zip |
debuggerd: always send SIGCONT after detaching.
Bug: http://b/27330889
Change-Id: I104248af1cde03dbdbacc03c87fe7e2dffd6c037
Diffstat (limited to 'debuggerd')
-rw-r--r-- | debuggerd/debuggerd.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp index 97f40963c..18c608b1c 100644 --- a/debuggerd/debuggerd.cpp +++ b/debuggerd/debuggerd.cpp @@ -586,9 +586,7 @@ static void monitor_worker_process(int child_pid, const debugger_request_t& requ kill_worker = true; kill_target = true; kill_self = true; - } - - if (WIFSIGNALED(status)) { + } else if (WIFSIGNALED(status)) { ALOGE("debuggerd: worker process %d terminated due to signal %d", child_pid, WTERMSIG(status)); kill_worker = false; kill_target = true; @@ -612,15 +610,16 @@ static void monitor_worker_process(int child_pid, const debugger_request_t& requ } } - if (kill_target) { - // Resume or kill the target, depending on what the initial request was. - if (request.action == DEBUGGER_ACTION_CRASH) { - ALOGE("debuggerd: killing target %d", request.pid); - kill(request.pid, SIGKILL); - } else { - ALOGE("debuggerd: resuming target %d", request.pid); - kill(request.pid, SIGCONT); - } + int exit_signal = SIGCONT; + if (kill_target && request.action == DEBUGGER_ACTION_CRASH) { + ALOGE("debuggerd: killing target %d", request.pid); + exit_signal = SIGKILL; + } else { + ALOGW("debuggerd: resuming target %d", request.pid); + } + + if (kill(request.pid, exit_signal) != 0) { + ALOGE("debuggerd: failed to send signal %d to target: %s", exit_signal, strerror(errno)); } if (kill_self) { |