Setting Breakpoints When Using the fork()/execve() Functions
NOTE >> If you are using ReplayEngine, note that it does not follow fork() or vfork() system calls. For more information on ReplayEngine, see Reverse Debugging with ReplayEngine.
Debugging Processes That Call the fork() Function
NOTE >> You can control how TotalView handles system calls to fork(). See "Fork Handling".
By default, TotalView places breakpoints in all processes in a share group. (For information on share groups, see "Organizing Chaos".) When any process in the share group reaches a breakpoint, TotalView stops all processes in the control group. This means that TotalView stops the control group that contains the share group. This control can contain more than one share group.
TotalView opens a Process Window for the process. (If you answer No, you won’t have an opportunity to set breakpoints.)
4. Set breakpoints for the process.
After you set breakpoints for the first child using this executable, TotalView won’t prompt when other children call the execve() function. This means that if you do not want to share breakpoints in children that use the same executable, dive into the breakpoints and set the breakpoint options.
5. Select the Group> Go command.
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