🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Frank Schaefer Thu, 18 Apr 2002 10:13
Debugging fork-ed processes woes
#2149
Author: 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
Re: Debugging fork-ed processes woes
#2235
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads