diff options
Diffstat (limited to 'debugger.c')
-rw-r--r-- | debugger.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -15,6 +15,7 @@ static const int PTRACE_OPTIONS = PTRACE_O_TRACECLONE | + PTRACE_O_TRACEFORK | PTRACE_O_TRACEEXEC | PTRACE_O_TRACEEXIT | PTRACE_O_TRACESYSGOOD; @@ -311,6 +312,7 @@ static int wait_thread(struct thread *th) { strcpy(th->status, "TERMINATED"); return 1; } else if (WIFSTOPPED(status)) { + struct process *eventproc; struct thread *eventth; unsigned long eventmsg; ptrace(PTRACE_GETEVENTMSG, th->id, NULL, &eventmsg); @@ -331,6 +333,22 @@ static int wait_thread(struct thread *th) { th->state = NULL; return 1; + case SIGTRAP | (PTRACE_EVENT_FORK << 8): + eventproc = new_process(eventmsg, th->proc->child); + eventth = new_thread(eventproc, eventmsg); + list_insert(eventproc->threads.end, eventth); + list_insert(th->proc->next, eventproc); + //while (!wait_thread(eventth)) {} + dbg_sync(eventproc); + + th->stopped = 1; + th->signal = 0; + th->doing = 0; + th->donext = 0; + strcpy(th->status, "FORK"); + th->state = NULL; + return 1; + case SIGTRAP | (PTRACE_EVENT_EXEC << 8): eventth = thread_by_id(th->proc, eventmsg); if (eventth->id != th->id) { |