Example: Multi-process Breakpoint
The following program excerpt illustrates the places where you can set breakpoints in a multi-process program:
1 pid = fork();
2 if (pid == -1)
3 error ("fork failed");
4 else if (pid == 0)
5 children_play();
6 else
7 parents_work();
The following table describes what happens when you set a breakpoint at different places:
Line Number
Result
1
Stops the parent process before it forks.
2
Stops both the parent and child processes.
3
Stops the parent process if the fork()function failed.
5
Stops the child process.
7
Stops the parent process.
 
RELATED TOPICS 
 
Linking with the dbfork library
Controlling system calls to execve().