[root@localhost src]# gdb test_fork
GNU gdb Fedora (6.8-27.el5)
(gdb) b 31
Breakpoint 1 at 0x8048541: file test_fork.c, line 31.
(gdb) b 41
Breakpoint 2 at 0x804858e: file test_fork.c, line 41.
(gdb) r
Starting program: /home/hxy/src/test_fork
process id 3959
Detaching after fork from child process 3962.
val=100
parent process id 3959
Breakpoint 2, main () at test_fork.c:41
41 printf("parent [%d]\n",i);
(gdb) val=100
child process id 3962,parent id 3959
val=200
child [0]
child [1]
child [2]
child [3]
child [4]
child [5]
child [6]
child [7]
nchild [8]
child [9]
parent [0]
39 for(i=0 ; i < 5 ; i++)
(gdb) child [10]
n