From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4380 invoked by alias); 8 Mar 2004 19:17:44 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4364 invoked from network); 8 Mar 2004 19:17:42 -0000 Received: from unknown (HELO mtagate7.de.ibm.com) (195.212.29.156) by sources.redhat.com with SMTP; 8 Mar 2004 19:17:42 -0000 Received: from d12relay01.megacenter.de.ibm.com (d12relay01.megacenter.de.ibm.com [9.149.165.180]) by mtagate7.de.ibm.com (8.12.10/8.12.10) with ESMTP id i28JHfRm127274 for ; Mon, 8 Mar 2004 19:17:41 GMT Received: from d12ml068.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12relay01.megacenter.de.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id i28JHivq276214 for ; Mon, 8 Mar 2004 20:17:45 +0100 Sensitivity: Subject: getpid after vfork broken in recent glibc To: gdb@sources.redhat.com Message-ID: From: Ulrich Weigand Date: Mon, 08 Mar 2004 19:17:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-SW-Source: 2004-03/txt/msg00054.txt.bz2 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