Hi, GDB hangs while attaching to an already SIGSTOPped process. GDB also crashes if some signal delivery was pending right at the time GDB was attaching: linux-nat.c:981: internal-error: linux_nat_attach: Assertion `pid == GET_PID (inferior_ptid) && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP' failed. The attached patch was tested on kernel.org linux-2.6.20.4 on x86_64. The patch changes the functionality of TO_ATTACH. The former functionality was too UNIX centric. I was reading all the TO_ATTACH OS-flavor implementations and I believe the non-"inf-ptrace.c" ones do not need update. The code was tested only on Linux kernel, though. GDB will leave the detached processes still stopped in the default case. If you ever run the `continue' command the process will be left running. This behavior was coded this way before by Jeff Johnston. FYI waitpid(2) may return a non-SIGSTOP signal before getting SIGSTOP if the non-SIGSTOP signal was already in the queue. It is a very rare race. Regards, Jan Already posted a broken patch before: http://sources.redhat.com/ml/gdb-patches/2006-09/msg00092.html