Re: sigsuspend() and ptrace()

From: Daniel Jacobowitz
Date: Fri Nov 18 2005 - 23:22:43 EST

On Fri, Nov 04, 2005 at 09:57:49AM +0100, Greg wrote:
> Hi,
> My program uses gdb to attach to a process and make it execute a specific
> function thanks to the gdb 'call' command. This works quite well unless the
> attached process is sleeping in sigsuspend(). I peeked into the kernel sources
> and saw that the typical sigsuspend() implementation is like this :
> while (1) {
> schedule();
> if (do_signal())
> return -EINTR;
> }
> When using ptrace attach, the target process receives a SIGSTOP but there
> isn't *of course* any handler to SIGSTOP. And no way for the process to return
> to userland... is it implemented that way on purpose ? How can I make suspending
> processes do some *alternative* work with gdb ?

Sorry, I'm a bit behind on lkml.

What's _supposed_ to happen is that sigsuspend should be interrupted by
the SIGSTOP even though there is no handler. SIGSTOP can't be blocked.

You didn't say what kernel version or architecture you were having
trouble with; which is it? It looks right in current 2.6 for i386 and
ppc, which were the only ones I checked.

Daniel Jacobowitz
CodeSourcery, LLC
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at