GDB- following child process with gdb

DEEPAK E P deepak.embar@wipro.com
Tue Feb 27 04:22:00 GMT 2001


Hi ,
  I have a red hat linux system. uname 
-a Linux 2.2.14-12smp #1 SMP Tue Apr 25 12:58:06 EDT 2000 i686 
unknown
 
gdb --version GNU gdb 19991004 Copyright 1998 
Free Software Foundation, Inc
   I have not been able to follow the 
child process after a fork call.
 
  Tried the following:
 
(gdb) l 1       
main() 2       
{ 3               
int 
j; 4               
printf("Hello world\n"); 5
6               
if (fork() == 0 ) 
{ 7                       
printf("Chile 
process\n"); 8               
} else 
{ 9                       
printf("Parent 
process\n"); 10              
} (gdb) set follow-fork-mode child (gdb) show follow-fork-mode Debugger 
response to a program call of fork or vfork is "child". (gdb) break 
7 Breakpoint 1 at 0x804841e: file junk.c, line 7. (gdb) r Hello 
world Parent process
 
Program exited with code 017.
Note: I have compiled with -g option 
:       gcc -g -o jk 
junk.c 
Also tried : (gdb) break fork Breakpoint 1 at 
0x804830c (gdb) r Starting program: 
/home/deepakep/local/./jk Breakpoint 1 at 0x400abc90 Hello 
world
 
Breakpoint 1, 0x400abc90 in __libc_fork () from 
/lib/libc.so.6 (gdb) return 0
 
This also doesnt work.
Do i have to pick up a patch etc ??, or is it not 
supported in the current version
of gdb i am using.
Thanks in advance for the help
dk                                    




More information about the Gdb mailing list