This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
threads/1609: gdb 6.0 detach after fork
- From: thomas dot lavergne at jrc dot it
- To: gdb-gnats at sources dot redhat dot com
- Date: 8 Apr 2004 16:11:49 -0000
- Subject: threads/1609: gdb 6.0 detach after fork
- Reply-to: thomas dot lavergne at jrc dot it
>Number: 1609
>Category: threads
>Synopsis: gdb 6.0 detach after fork
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Apr 08 16:18:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: thomas.lavergne@jrc.it
>Release: unknown-1.0
>Organization:
>Environment:
Linux RedHat9 kernel-2.4.20-18.9smp
gdb 6.0 (compiled with gcc3.3.3)
executable to be debugged is compiled with gcc 3.2.2-5
>Description:
My sysadmin just upgraded to gdb 6.0 and I run into the following problem.
IMPORTANT NOTE: it was allright with the gdb-5.3post-0.20021129.18
My C program uses the popen command to fork the gnu cpp while opening an input file. The command is:
yyin = popen(cmd, "r");
with cmd being "/usr/bin/cpp -D<macro_defs> filename"
1) the program works fine when I execute it stand-alone (without trying to debug it with gdb). The input file is perfectly parsed and the behaviours are ok.
2) under gdb (gdb --args myprogram), when I try to 'run', the program executes ok but gdb reports an error related to fork:
*) it outputs at the beggining of execution:
"Detaching after fork from child process 24945."
*) after my program finishes it writes:
warning: Unexpected waitpid result 000000 when waiting for vfork-done
ptrace: No such process.
Cannot remove breakpoints because program is no longer writable.
It might be running in another process.
Further execution is probably impossible.
0x420acda8 in vfork () from /lib/tls/libc.so.6
I tried to locate the process 24945, but it is dead after the execution.
It is important to note that the forked cpp *does* its job and that the program works fine.
3) it means that I can use breakpoints till the call to popen. I can break just before instruction popen(cmd,"r") and then, by asking 'n', gdb reports it detach and the same "warning: Unexpected waitpid result..." stuff appears at the end of the execution.
>How-To-Repeat:
It is too big a code for me to create a simple test-case. Moreover, I did not wrote this part of the code and know very little about threads.
It is perhaps related to
http://www.redhat.com/archives/fedora-test-list/2004-January/msg00179.html
If you need me to test a test_case on my configuration, please ask.
Thomas
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: