diff --git a/kernel/exit.c b/kernel/exit.c index 2913b35..09b81da 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1678,6 +1678,29 @@ void __wake_up_parent(struct task_struct *p, struct task_struct *parent) TASK_INTERRUPTIBLE, 1, p); } +static void debug_dump(void) +{ + struct task_struct *tsk = current; + struct task_struct *p; + + if (strcmp(current->comm, "gdb")) + return; + + printk("gdb is going to sleep ...\n"); + + printk("gdb children list:\n"); + read_lock(&tasklist_lock); + list_for_each_entry(p, &tsk->children, sibling) + printk(" pid=%d, exit_state=%d, exit_signal=%d\n", + p->pid, p->exit_state, p->exit_signal); + + printk("gdb ptrace list:\n"); + list_for_each_entry(p, &tsk->ptraced, ptrace_entry) + printk(" pid=%d, exit_state=%d, exit_signal=%d\n", + p->pid, p->exit_state, p->exit_signal); + read_unlock(&tasklist_lock); +} + static long do_wait(struct wait_opts *wo) { struct task_struct *tsk; @@ -1722,6 +1745,7 @@ notask: if (!retval && !(wo->wo_flags & WNOHANG)) { retval = -ERESTARTSYS; if (!signal_pending(current)) { + debug_dump(); schedule(); goto repeat; } @@ -1815,6 +1839,9 @@ SYSCALL_DEFINE4(wait4, pid_t, upid, int __user *, stat_addr, __WNOTHREAD|__WCLONE|__WALL)) return -EINVAL; + if (!strcmp(current->comm, "gdb")) + printk("gdb wait for pid=%d\n", upid); + if (upid == -1) type = PIDTYPE_MAX; else if (upid < 0) {