Attach to Process
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.
To open the Attach window, select Attach to Process on the Start Page.
A list of processes running on the local host displays in the Attach to running program(s) dialog.
Figure 21, Attach to a running program
In the displayed list, processes to which TotalView can attach are displayed in black text, while those to which TotalView has already attached or are not attachable for any reason are grayed out.
1. Enter a name for this session in the Session Name field.
Any previously entered sessions of the same type are available from the Session Name dropdown box. Once selected, you can change any session properties and start your debug session. See Editing a Previous Session.
2. Select the process under the Program column. For a single selected process, the PID and File Name fields are auto-populated. Alternatively, use these fields to specifically identify a process to attach to.
To select multiple processes, hold down the Ctrl key and select them. (In this case, the PID and File Name fields are not used.)
3. Press Attach.
 
CLI: dattach executable pid
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.
RELATED TOPICS 
The CLI dattach command
The CLI ddetach command
Field Definitions
The Processes section displays these fields:
*Program: The name of the executing program. Notice that TotalView indents some names. This indentation indicates the parent/child relationship within the UNIX process hierarchy.
*State: A letter indicating the program’s state, as follows:
Character and Meaning
Definition
I (Idle)
Process has been idle or sleeping for more than 20 seconds.
R (Running)
Process is running or can run.
S (Sleeping)
Process has been idle or sleeping for less than 20 seconds.
T (Stopped)
Process is stopped.
Z (Zombie)
Process is a “zombie”; that is, it is a child process that has terminated and is waiting for its parent process to gather its status.
*Host: The name of the machine upon which the program is executing
*PID: The operating system program ID
*PPID: The parent program’s ID
*Path: The program’s path on the local machine, that is, the machine where TotalView is running
If you attach to multiple processes, TotalView places all of them into the same control group, enabling you to stop and start them as a group.
Searching for Processes
Search for any process using the search box ().
If found, the process displays in the Processes pane.
In some cases, the name provided to TotalView by your operating system may not be the actual name of the program. In this case, you will not be able to simply select the name. Instead, you should
*Determine what its actual name is by using a command such as ls in a shell window.
*Select the name as this will fill in much of the program’s name.
*Move to the File Name control, and type its actual name, then press Enter.
If you wish to attach to a multiprocess program, you can either select multiple processes here, or you can restart the program under TotalView control so that the processes are automatically picked up as they are forked. In most cases, this requires you to link your program with the dbfork library, as discussed in the section Linking with the dbfork Library.
If the process you are attaching to is one member of a collection of related processes created with fork() calls, TotalView asks if you want to also attach to all of its relatives. If you answer yes, TotalView attaches to all the process’s ancestors, descendants, and cousins.
NOTE: If some of the processes in the collection have called exec(), TotalView tries to determine the new executable file for the process. If TotalView appears to read the wrong file, you should start over, compile the program using the dbfork library, and start the program under TotalView control.
 
Debug Options
NOTE: Debug options are platform-specific, so your system may or may not include the options discussed in this section.
In the Debug Options section, you can enable ReplayEngine. (See Options: Reverse Debugging.)