Debugging sub-processes with gdb

Corinna Vinschen corinna-cygwin@cygwin.com
Wed May 14 15:34:00 GMT 2014


On May 14 16:10, Henry S. Thompson wrote:
> I'm trying to debug a problem with xemacs that involves the child
> process forked when you execute M-x shell.
> 
> None of the mechanisms in the gdb documentation for choosing to step
> into the child process (instead of the parent) after a fork() seem to
> work for me.  That is, in particular, setting follow-for-mode to child
> still leaves me in the parent after stepping over a fork().
> 
> Setting detach-on-fork to 'off' also seems to have no effect.
> 
> Have I misunderstood something, or does this aspect of gdb just not
> work under cygwin (x86_64, 1.7.29-2)?

No, it doesn't, it has never been implemented.  This would require
some extensions to GDB as well as the Cygwin DLL, given that Windows
is not quite up to speed in terms of fork.

As a workaround, you could tweka emacs to sleep at certain points in the
code, and then attach to the child process with a second GDB.  Granted,
it's a bit of a hassle, but it works.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140514/8dcd8a58/attachment.sig>


More information about the Cygwin mailing list