diff options
-rw-r--r-- | debugger.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -343,6 +343,7 @@ int dbg_wait(struct thread *th, int recursion) { int stopped; struct thread *newth; + struct list *threads; unsigned long eventmsg; ptrace(PTRACE_GETEVENTMSG, th->id, NULL, &eventmsg); @@ -369,6 +370,34 @@ int dbg_wait(struct thread *th, int recursion) { return 1; + case SIGTRAP | (PTRACE_EVENT_EXEC << 8): + /* eventmsg contains the tid that actually did the execve */ + threads = &th->proc->threads; + for (struct thread *t = threads->head; t != threads->end; t = t->next) { + if (t->id == (pid_t)eventmsg && (pid_t)eventmsg != th->id) { + t->id = -1; + t->stopped = 1; + t->signal = 0; + t->cont = 0; + t->status = "EXITED"; + break; + } + } + + th->stopped = 1; + th->signal = 0; + th->cont = 0; + th->status = "EXEC EVENT"; + th->state = NULL; + + if (!recursion) { + stopped = interrupt_all_threads(th->proc); + uninstall_breakpoints(th); + capture_state(th, stopped); + } + + return 1; + case SIGTRAP | (PTRACE_EVENT_EXIT << 8): th->stopped = 1; th->signal = 0; /* eventmsg has exit code, but would inject sig */ |