+ tracee->in_syscall = !tracee->in_syscall;
+ } else if ((ret >> 8) == (SIGTRAP | (PTRACE_EVENT_FORK << 8)) ||
+ (ret >> 8) == (SIGTRAP | (PTRACE_EVENT_VFORK << 8)) ||
+ (ret >> 8) == (SIGTRAP | (PTRACE_EVENT_CLONE << 8))) {
+ struct tracee *child = calloc(1, sizeof(struct tracee));
+
+ ptrace(PTRACE_GETEVENTMSG, c->pid, 0, &child->proc.pid);
+ child->proc.cb = tracer_cb;
+ ptrace(PTRACE_SYSCALL, child->proc.pid, 0, 0);
+ uloop_process_add(&child->proc);
+ if (debug)
+ fprintf(stderr, "Tracing new child %d\n", child->proc.pid);
+ } else {
+ inject_signal = WSTOPSIG(ret);
+ if (debug)
+ fprintf(stderr, "Injecting signal %d into pid %d\n",
+ inject_signal, tracee->proc.pid);
+ }
+ } else if (WIFEXITED(ret) || (WIFSIGNALED(ret) && WTERMSIG(ret))) {
+ if (tracee == &tracer) {
+ uloop_end(); /* Main process exit */
+ } else {
+ if (debug)
+ fprintf(stderr, "Child %d exited\n", tracee->proc.pid);
+ free(tracee);