You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spawning child shell process while debugging via gdb causes hang #2333
I could have sworn therealkenc mentioned this in another issue (where you have to send a SIGKILL to any child process of gdb from a separate terminal in order to kill it
That was #648 (message). I didn't chime in because I couldn't see the problem over there being popen() related, at least strictly speaking. Either way the repro on offer in the OP stands on its own merits. Good catch.
bump -- I finally found both time and tools to track down why I've been having trouble using GDB within WSL, for applications that I care about. Buried under a few layers of proprietary code, it turns out that it's this issue.
Here's a reproducer that uses system() rather than popen(): (Requires gcc; I always just install the build-essential package. Tested against WSL build 16273.)
parent.c:
#include <stdlib.h>
int main()
{
system("./child");
return 0;
}
$ gdb ./parent -ex run
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./parent...(no debugging symbols found)...done.
Starting program: /home/aseering/test/parent
## GDB hangs at this point. Can't interrupt with ctrl-C; can't kill; can only kill -9
As it turns out, this issue no longer affects me as directly. I'm working on different software these days and not hitting this issue most of the time. (I care more about I/O performance, but y'all are well aware of that issue :-) A more-elegant Docker story would also be nice.) I'm also not sure that this is the only issue with gdb; it's just the first one, I can't get past it to see what's underneath.
Ben Hillis (@benhillis) FYI -- I'm pretty sure I promised to report this several months ago; apologies for being so lame in getting it out the door...
Reacted by therealkenc, Sunil Muthuswamy, fpqc and Daniel Bahr
Activity
fpqc commentedon Jul 16, 2017
I could have sworn therealkenc mentioned this in another issue (where you have to send a SIGKILL to any child process of gdb from a separate terminal in order to kill it
therealkenc commentedon Jul 16, 2017
That was #648 (message). I didn't chime in because I couldn't see the problem over there being
popen()related, at least strictly speaking. Either way the repro on offer in the OP stands on its own merits. Good catch.aseering commentedon Aug 27, 2017
bump -- I finally found both time and tools to track down why I've been having trouble using GDB within WSL, for applications that I care about. Buried under a few layers of proprietary code, it turns out that it's this issue.
Here's a reproducer that uses
system()rather thanpopen(): (Requiresgcc; I always just install thebuild-essentialpackage. Tested against WSL build 16273.)parent.c:
child.c:
Build commands:
straceofparent:gdbofparent:As it turns out, this issue no longer affects me as directly. I'm working on different software these days and not hitting this issue most of the time. (I care more about I/O performance, but y'all are well aware of that issue :-) A more-elegant Docker story would also be nice.) I'm also not sure that this is the only issue with gdb; it's just the first one, I can't get past it to see what's underneath.
Ben Hillis (@benhillis) FYI -- I'm pretty sure I promised to report this several months ago; apologies for being so lame in getting it out the door...
therealkenc commentedon Aug 28, 2017
That's a dead ringer for #648 May7 (message) mentioned just above. Thanks for doing a tight repro.
sunilmut commentedon Aug 28, 2017
Thanks Adam Seering (@aseering) for the simple repro steps. I am marking this as a bug. We will try to prioritize this.
sunilmut commentedon Oct 30, 2017
This should be fixed in the Insider build 17017.