BUG: GDB >=6 vfork from pthread fails with 2.6 vanilla kernels

Jonathan A. George JAGeorge@greshamstorage.com
Mon May 17 17:41:00 GMT 2004

Daniel Jacobowitz wrote:

> On Fri, May 14, 2004 at 10:12:42AM -0500, Jonathan A. George wrote:
>> BUG: GDB >=6 vfork from pthread fails with 2.6 vanilla kernels
>> Very simple to duplicate:
>> Run popen() from within a pthread_create() thread while sleeping in 
>> the base process.
>> (NOTE: works perfectly outside of GDB and under GDB with 2.4 kernel 
>> pthreads)
>> Environment:
>> Any 2.6 series kernel (tested 2.6.0 - 2.6.6 vanilla kernel.org)
>> Any GDB (tested 6.0 - current CVS)
>> Any GCC linked with -lpthread (tested 3.0.4 - 3.3.3)
>> GDB output from test program:
>> Detaching after fork from child process 7020.
>> warning: Unexpected waitpid result 00117f when waiting for vfork-done
>> linux-nat.c:450: internal-error: unknown ptrace event 5
>> A problem internal to GDB has been detected,
>> further debugging may prove unreliable.
>> Quit this debugging session? (y or n)
>> Observations:
>> It seems as if GDB in linux-nat.c is trying to associate the vfork()d 
>> popen()d process with the root process instead of the parenting 
>> thread started by the root process.
> Did you really try current CVS?  I checked in a fix for this a couple
> of weeks ago.
Technically I tried the current CVS snapshot, but to be sure I just 
checked out the entire tree using the following commands:

cvs -z2 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co gdb+dejagnu
cvs -z2 up
make install

I even moved aside the distribution gdb:

cd /usr/bin
mkdir gdb.distro
mv *gdb* gdb.distro

One possible note of interest; when gdb starts for my test case I see 
these messages:

GNU gdb 2004-04-17-cvs
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
welcome to change it and/or distribute copies of it under certain 
Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db 

(gdb) run
Starting program: /home/jageorge/example/a.out
[Thread debugging using libthread_db enabled]
[New Thread 1076200096 (LWP 30264)]
hello world
[New Thread 1084591024 (LWP 30267)]

> If it still doesn't work, please post a test case.
My test case is attached.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: popen_pthread.cpp
Type: text/x-c++
Size: 962 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb/attachments/20040517/1dd71476/attachment.bin>

More information about the Gdb mailing list