Skip to content

Commit

Permalink
ptrace.c: Improve the wait / advance_to_state logic somewhat.
Browse files Browse the repository at this point in the history
  • Loading branch information
nelhage committed Jan 25, 2011
1 parent b5218d5 commit 0046dc7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ int ptrace_wait(struct ptrace_child *child) {
ptrace_command(child, PTRACE_GETEVENTMSG, 0, &child->forked_pid);
if (child->state != ptrace_at_syscall)
child->state = ptrace_stopped;
if (sig != SIGSTOP && sig != SIGTRAP && sig != SIGCHLD && sig != SIGHUP && sig != SIGCONT) {
child->error = EAGAIN;
return -1;
}
}
} else {
child->error = EINVAL;
Expand All @@ -114,8 +110,12 @@ int ptrace_advance_to_state(struct ptrace_child *child,
int err;
while(child->state != desired) {
switch(desired) {
case ptrace_at_syscall:
case ptrace_after_syscall:
case ptrace_at_syscall:
if (WIFSTOPPED(child->status) && WSTOPSIG(child->status) == SIGSEGV) {
child->error = EAGAIN;
return -1;
}
err = ptrace_command(child, PTRACE_SYSCALL, 0, 0);
break;
case ptrace_running:
Expand Down

0 comments on commit 0046dc7

Please sign in to comment.