bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debugging fork-ed processes woes


From: Frank Schaefer
Subject: Debugging fork-ed processes woes
Date: 18 Apr 2002 12:13:27 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]