Attaching to a Running Program
If a program you’re testing is hung or looping (or misbehaving in some other way), you can attach to it while it is running. You can attach to single and multi-process programs, and these programs can be running remotely.
To open the Attach window, select either
• A running program (attach) on the Start a Debugging Session dialog, or
A list of processes running on the selected host displays in the Attach to running program(s) dialog.
In the displayed list, processes to which TotalView is already attached are shown in gray text, while the processes displayed in black text are not currently running under TotalView control.
1. Enter a name for this session in the Session Name field.
2. Click on the program’s name under the Program column, and press Start Session.
While you must link programs that use fork() and execve() with the TotalView dbfork library so that TotalView can automatically attach to them when your program creates them, programs that you attach to need not be linked with this library.
NOTE >> You cannot attach to processes running on another host if you are using TotalView Individual.
Adding a New User
You can enter a user name to see the processes owned by that user. If you wish to attach to a process owned by someone else, you need the proper permissions.
1. Click the
icon to launch the
Add username dialog.
2. Enter a known username, then click OK.
If the username is not recognized, the system returns an error; otherwise, the user is added to the User drop-down and selected as the current user.
The selected user’s processes are displayed. Attach to another user’s processes just by clicking the process and selecting Start Session.
If you do not have permissions to attach to the process, an error is returned.
Searching for Processes
You can search for any process using the search box (
). If found, the process will display in the Processes pane.
Attach Options
On the Debug Options tab, two options exist:
• Placing the processes to which you are attaching into a control group under the Attach Options area.
If you have selected a group in previous TotalView sessions and the group exists in the dropdown, it is selected for you. Otherwise, the default is to create a new group to contain all processes attached to in this session.
Attaching Errors
If TotalView returns an error while attempting to attach to a process, it is usually because you do not have permission to attach to that process. For example, the process could not be allocated:
Or you don’t own the process:
Detaching from Processes
You can either detach from a group of processes or detach from one process.
Use the Group > Detach command to remove attached processes within a control group. As TotalView executes this command, it eliminates all of the state information related to these processes. If TotalView didn’t start a process, it continues executing in its normal run-time environment.
To detach from processes that TotalView did not create:
1. (Optional) After opening a Process Window on the process, select the
Thread > Continuation Signal command to display the following dialog box.
The examples at the end of TV::thread discussion show setting a signal.
Choose the signal that TotalView sends to the process when it detaches from the process. For example, to detach from a process and leave it stopped, set the continuation signal to SIGSTOP.
2. Select OK.
When you detach from a process, TotalView removes all breakpoints that you have set in it.