From: Andrew Cagney <cagney@gnu.org>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Cc: gdb@sources.redhat.com
Subject: Re: getpid after vfork broken in recent glibc
Date: Tue, 09 Mar 2004 02:41:00 -0000 [thread overview]
Message-ID: <404D2EB9.10607@gnu.org> (raw)
In-Reply-To: <OF1553E6EB.11E0F0CB-ONC1256E51.0068BC37@de.ibm.com>
> 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?
We might as well simply always use fork -- the "performance" benefit is
hardly valid any more (Hmm, perhaps something related to this is why
vfork never worked, and hence was disabled, on HP/UX).
Andrew
next prev parent reply other threads:[~2004-03-09 2:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-08 19:17 Ulrich Weigand
2004-03-09 2:41 ` Andrew Cagney [this message]
2004-03-09 2:53 ` Daniel Jacobowitz
2004-03-09 6:36 ` Eli Zaretskii
2004-03-09 13:14 ` Andreas Schwab
2004-03-09 18:53 Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=404D2EB9.10607@gnu.org \
--to=cagney@gnu.org \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox