🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #2149

Debugging fork-ed processes woes

#2149
From: Frank Schaefer
Date: Thu, 18 Apr 2002 10:13
54 lines
2588 bytes
Hi there,

Seems 'set follow-fork-mode' doesn't work for gdb-5.0. See the
following.

# 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: <1019124808.3211.0.camel@ADMIN>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sunqbc.risq.qc.ca!wesley.videotron.net!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,b58874c514f58a62,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-04-18 03:13:36 PST
x-uunet-gateway: dfw7sosrv11.alter.net from bug-gdb to gnu.gdb.bug; Thu, 18 Apr 2002 10:13:35 GMT
Subject: Debugging fork-ed processes woes
From: frank.schafer@setuza.cz (Frank Schaefer)
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Mailer: Evolution/1.0 (Preview Release)
Date: 18 Apr 2002 12:13:27 +0200
Message-ID: <1019124808.3211.0.camel@ADMIN>
Mime-Version: 1.0
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sunqbc.risq.qc.ca!wesley.videotron.net!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
Sender: bug-gdb-request@mail.gnu.org
Lines: 55