Using Built-In Statements
TotalView statements help you control your interactions in certain circumstances. These statements are available in all languages, and are described in the following table. The most commonly used statements are $count, $stop, and $visualize.
Statement
Use
$count expression
Sets a process-level countdown breakpoint.
$countprocess expression
When any thread in a process executes this statement for the number of times specified by expression, the process stops. The other processes in the control group continue to execute.
$countall expression
Sets a program-group-level countdown breakpoint.All processes in the control group stop when any process in the group executes this statement for the number of times specified by expression.
$countthread expression
Sets a thread-level countdown breakpoint. When any thread in a process executes this statement for the number of times specified by expression, the thread stops. Other threads in the process continue to execute. If the target system cannot stop an individual thread, this statement performs the same as $countprocess.A thread evaluates expression when it executes $count for the first time. This expression must evaluate to a positive integer. When TotalView first encounters this variable, it determines a value for expression. TotalView does not reevaluate until the expression actually stops the thread. This means that TotalView ignores changes in the value of expression until it hits the breakpoint. After the breakpoint occurs, TotalView reevaluates the expression and sets a new value for this statement.The internal counter is stored in the process and shared by all threads in that process.
$hold
Holds the current process.
$holdprocess
If all other processes in the group are already held at this evalpoints, TotalView releases all of them. If other processes in the group are running, they continue to run.
$holdstopall $holdprocessstopall
Like $hold, except that any processes in the group which are running are stopped. The other processes in the group are not automatically held by this call—they are just stopped.
$holdthread
Freezes the current thread, leaving other threads running.
$holdthreadstop $holdthreadstopprocess
Like $holdthread, except that it stops the process. The other processes in the group are left running.
$holdthreadstopall
Like $holdthreadstop, except that it stops the entire group.
$stop $stopprocess
Sets a process-level breakpoint. The process that executes this statement stops; other processes in the control group continue to execute.
$stopall
Sets a program-group-level breakpoint. All processes in the control group stop when any thread or process in the group executes this statement.
$stopthread
Sets a thread-level breakpoint. Although the thread that executes this statement stops, all other threads in the process continue to execute. If the target system cannot stop an individual thread, this statement performs the same as to $stopprocess.
$visualize(expression[,slice])
Visualizes the data specified by expression and modified by the optional slice value. Expression and slice must be expressed using the code fragment’s language. The expression must return a dataset (after modification by slice) that can be visualized. slice is a quoted string that contains a slice expression. For more information on using $visualize in an expression, see “Using the Visualizer” on page 314.