getpid after vfork broken in recent glibc
Ulrich Weigand
Ulrich.Weigand@de.ibm.com
Mon Mar 8 19:17:00 GMT 2004
Hello,
in fork_inferior (fork-child.c), gdb uses vfork () to spawn a child
process, and then calls getpid () (within gdb_setpgid) from within
that child process, before doing the execve ().
With current glibc CVS builds, this doesn't work any more, since
glibc caches the PID in thread-local memory, and memory is shared
between vfork parent and child. (In fact, what happens is that
all subsequent getpid calls in gdb return the pid of the initial
child that was spawned ...) This causes various breakage.
Now, according to this libc-hacker thread:
http://sources.redhat.com/ml/libc-hacker/2004-03/msg00014.html
gdb's behaviour is actually not standards-compliant, as it is not
permitted to call getpid () between the vfork and the exec.
Can this be fixed in gdb?
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand
Linux for S/390 Design & Development
IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
Phone: +49-7031/16-3727 --- Email: Ulrich.Weigand@de.ibm.com
More information about the Gdb
mailing list