🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #2235

Re: Debugging fork-ed processes woes

#2235
From: Michael Snyder
Date: Tue, 23 Apr 2002 22:06
67 lines
3300 bytes
Frank Schaefer wrote:
> 
> Hi there,
> 
> Seems 'set follow-fork-mode' doesn't work for gdb-5.0. See the
> following.

Hi, 

I'm afraid "follow-fork" was only implemented on HPUX.
Sorry for the falsely raised expectations...
Perhaps we should do something about hiding those HP-only
features from non-HP users.

Michael


> 
> # gdb daemon
> GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
> are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> 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"...
> (gdb) b 18
> Breakpoint 1 at 0x8048899: file daemon.c, line 23.
> (gdb) run
> Starting program: /v_dsk/home/p10209/Tests/daemon
> 
> Breakpoint 1, main () at daemon.c:23
> (gdb) n
> ..
> (gdb) n
> 67      Childpid = fork();
> (gdb) show follow-fork-mode
> Debugger response to a program call of fork or vfork is "parent".
> (gdb) set follow-fork-mode child
> (gdb) show follow-fork-mode
> Debugger response to a program call of fork or vfork is "child".
> (gdb) n
> 69      sleep( 10 );
> (gdb) print ChildPid
> $1 = 3290       *********************************
>                 ???!!!!!!!!!!!!!!????????????????
> 
> Seems, we were following the parent - weren't we?
> 
> I've configured gdb with:
>         # ./configure           # ( no switches )
> 
> My compiler is GCC-2.93.3 with the glibc-2-patch applied.
> I use binutils-2.11, glibc-2.2.4 and I'm running kernel-2.4.16.
> 
> BTW: The sleep right after the fork() is there, to give me the time, to
> attach a second instance of gdb to the child process.
> If I do so, both processes crash at random locations due to different
> signals ( mostly segfault and sometime illegal instruction ).
> If I run the server and client outside of the debugger, all goes fine.
> 
> Am I missing something?
> Regards
> Frank
Technical Details
Message-ID: <3CC5DAFD.3F37DA3E@redhat.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sunqbc.risq.qc.ca!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!not-for-mail
References: <1019124808.3211.0.camel@ADMIN>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,b58874c514f58a62
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-04-23 15:19:01 PST
x-uunet-gateway: dfw7sosrv11.alter.net from bug-gdb to gnu.gdb.bug; Tue, 23 Apr 2002 22:18:58 GMT
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sunqbc.risq.qc.ca!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!not-for-mail
From: msnyder@redhat.com (Michael Snyder)
Subject: Re: Debugging fork-ed processes woes
Date: Tue, 23 Apr 2002 15:06:53 -0700
Organization: Red Hat, Inc.
Message-ID: <3CC5DAFD.3F37DA3E@redhat.com>
References: <1019124808.3211.0.camel@ADMIN>
NNTP-Posting-Host: reddwarf.sfbay.redhat.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: cronkite.cygnus.com 1019600332 4327 172.16.24.50 (23 Apr 2002 22:18:52 GMT)
X-Complaints-To: postmaster@cygnus.com
NNTP-Posting-Date: 23 Apr 2002 22:18:52 GMT
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686)
X-Accept-Language: en
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Sender: bug-gdb-request@mail.gnu.org
Lines: 67