Skip to content

Commit

Permalink
Print more info if we get an unexpected status on kill
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Apr 18, 2021
1 parent 7cf2f0f commit 878f756
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,17 @@ WaitStatus Task::kill() {
*/
LOG(debug) << "Sending SIGKILL to " << tid;
int ret = syscall(SYS_tgkill, real_tgid(), tid, SIGKILL);
DEBUG_ASSERT(ret == 0);
ASSERT(this, ret == 0);
int raw_status = -1;
int wait_ret = ::waitpid(tid, &raw_status, __WALL | WUNTRACED);
WaitStatus status = WaitStatus(raw_status);
LOG(debug) << " -> " << status;
bool is_exit_event = status.ptrace_event() == PTRACE_EVENT_EXIT;
DEBUG_ASSERT(wait_ret == tid &&
(is_exit_event || status.type() == WaitStatus::FATAL_SIGNAL ||
status.type() == WaitStatus::EXIT));
ASSERT(this, wait_ret == tid) << "Expected " << tid << " got " << wait_ret;
ASSERT(this,
is_exit_event || status.type() == WaitStatus::FATAL_SIGNAL ||
status.type() == WaitStatus::EXIT)
<< "Expected exit or fatal signal for " << tid << " got " << status;
did_kill();
if (is_exit_event) {
/* If this is the exit event, we can detach here and the task will
Expand Down

0 comments on commit 878f756

Please sign in to comment.