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 
 
Share groups and TotalView’s default design for organizing multiple processes into groups
The dbfork library
Compiling Programs”, and "Linking with the dbfork Library" in the TotalView Platforms Guide