Setting Process and Thread Focus
When the CLI executes a command, TotalView must decide which processes and threads it should act upon. Most commands have a default set of threads and processes and, in most cases, you won't want to change the default. There are times, however, when you'll need to change this default. This section begins a rather intensive look at how you tell TotalView what processes and threads it should use as the target of a command.
Process/Thread Sets
All CLI commands operate upon a set a processes and threads. This set is called a P/T (Process/Thread) set. A P/T set is a Tcl list containing one or more P/T identifiers. (The next section explains what a P/T identifier is.) Tcl lets you create lists in two ways:
- You can enter these identifiers within braces ({ }).
- You can use Tcl commands that create and manipulate lists.
These lists are then used as arguments to a CLI command. If you are entering one element, you usually do not have to use Tcl's list syntax.
For example, the following list contains specifiers for process 2, thread 1 and process 3, thread 2:
{ p2.1 p3.2 }
Unlike a serial debugger where each command clearly applies to the only executing thread, the CLI can control and monitor many threads and many different locations. The P/T set indicates the groups, processes, and threads that are the target of the CLI command. No limitation exists on the number of groups, processes, and threads within a set.
If you do not explicitly specify a P/T set, the CLI defines a target set for you. This set is displayed as the (default) CLI prompt. (For information on this prompt, see Command and Prompt Formats.)
You can change the focus upon which a command acts by using the dfocus command. If the CLI executes dfocus as a separate command, it changes the default P/T set. For example, if the default focus is process 1, the following command changes the default focus to process 2:
dfocus p2
After the CLI executes this command, the commands that it will now execute will focus on process 2.
If you type the dfocus command as part of another command, the CLI changes the target for just the command that follows. After the command executes, the old default is restored.
The following example shows both of these ways to use the dfocus command. Assume that the current focus is process 1, thread 1. The following commands change the default focus to group 2 and then step the threads in this group twice:
dfocus g2
dstep
dstep
Before the dstep command executes, it looks for the thread of interest--the thread that was the focus of activity--in group 2. TotalView will then step all threads in the same lockstep group as the thread of interest.
In contrast, the following commands step group 2 and then step process 1, thread 1:
dfocus g2 dstep
dstep
This is because the dfocus command is used as a modifier instead of as a stand-alone command.
Some commands can only operate at the process level--that is, you cannot apply them to a single thread (or group of threads) in the process but must apply them to all or to none.