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.
To override these defaults:
1. Dive into the line number to display the Action Point > Properties Dialog Box.
2. Clear the Plant in share group check box and make sure that the Group radio button is selected.
Debugging Processes that Call the execve() Function
NOTE: You can control how TotalView handles system calls to execve(). See Exec Handling.
Shared breakpoints are not set in children that have different executables.
To set the breakpoints for children that call the execve() function:
1. Set the breakpoints and breakpoint options in the parent and the children that do not call the execve() function.
2. Start the multi-process program by displaying the Group > Go command.
When the first child calls the execve() function, TotalView displays the following message:
Process name has exec’d name.
Do you want to stop it now?
3. Answer Yes.
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
Stops the parent process before it forks.
Stops both the parent and child processes.
Stops the parent process if the fork() function failed.
Stops the child process.
Stops the parent process.
Share groups and TotalView’s default design for organizing multiple processes into groups
Controlling TotalView’s behavior for fork, vfork and execve handling
The dbfork library
Compiling Programs, and "Linking with the dbfork Library" in the TotalView for HPC Reference Guide