TotalView Built-in Variables and Statements

Note The following information has been extracted from the TotalView User Guide, which may be downloaded from the vendor's website.

Built-in Variables

  • The TotalView expression system supports built-in variables that allow you to access special thread and process values. All of the variables are of type 32-bit integer, which is type int or long on most platforms. The variables are not lvalues, so you cannot assign to them or take their addresses.
  • These variables allow you to create thread specific breakpoints from the expression system. For example, using the $tid intrinsic variable and the $stop built-in operation, you can create a thread specific breakpoint as follows:


if ($tid == 3)
$stop;

  • This would cause TotalView to stop the process only if thread 3 evaluated the expression. You can also create complex expressions using intrinsic variables:

if ($pid != 34 && $tid > 7)
printf ("Hello from %d.%d\n", $pid, $tid);

  • The table below lists the built-in variables and their descriptions.
Built-in VariableDescription
$clidReturns the cluster ID.
$duidReturns the TotalView-assigned Debugger Unique ID (DUID).
$newvalReturns the value just assigned to a watched memory location (watchpoints only).
$nidReturns the node ID.
$oldvalReturns the value that existed in a watched memory location before a new value modified it (watchpoints only).
$pidReturns the process ID.
$processduidReturns the DUID of the process.
$systidReturns the system-assigned thread ID. When referenced from a process, generates an error.
$tidReturns the TotalView-assigned thread ID. When referenced from a process, generates an error.

Note: Most of these variables require that the expression be interpreted.

Built-In Statements

  • TotalView provides a set of built-in statements that you can use when writing code fragments. The statements are available in all languages, and are shown in the table below.
Built-In StatementDescription
$count expressionSets a process-level countdown breakpoint.
$countprocess expressionWhen any thread in a process executes this statement for the number of times specified by expression, the process stops. The other processes in the program group continue to execute.
$countall expressionSets a program-group-level countdown breakpoint. All processes in the program group stop when any process in the group executes this statement for the number of times specified by expression.
$countthread expressionSets a thread-level countdown breakpoint. When any thread in a process executes this statement for the number of times specified by expression 1 , it stops. The other threads in the process continue to execute. If the target system does not support asynchronous stop, this executes as a $countprocess.
$hold
$holdprocess
Holds the current process. If all other processes in the group are already held in breakpoint state at this eval point, then all will be released. If other processes in the group are running, they continue to run.
$holdstopall
$holdprocessstopall
Exactly like $hold, except any processes in the group which are running are stopped. Note that the other processes in the group are not automatically held by this call -- they are just stopped.
$holdthreadFreezes the current thread leaving other threads running.
$holdthreadstop
$holdthreadstopprocessExactly like $holdthread except it stops the process. The other processes in the group are left running.
$holdthreadstopallExactly like $holdthreadstop except it stops the entire group.
$stop
$stopprocess
Sets a process-level breakpoint. The process that executes this statement stops, but other processes in the program group continue to execute.
$stopallSets a program-group-level breakpoint. All processes in the program group stop when any thread or process in the group executes this statement.
$stopthreadSets a thread-level breakpoint. The thread that executes this statement stops, but all other threads in the process continue to execute. If the target system does not support asynchronous stop, this executes as a $stopprocess.
$visualize(expression[,slice])Visualizes the data specified by expression and modified by the optional slice. Expression and slice must be written in the syntax of the code fragment's language. The expression can be any valid expression that yields a data-set (after modification by slice) that can be visualized. The slice is a quoted string containing a slice expression. For more information on how to use $visualize in an expression, see "Visualizing Data in Expressions" in the TotalView User Guide.