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 Variable Description
$clid Returns the cluster ID.
$duid Returns the TotalView-assigned Debugger Unique ID (DUID).
$newval Returns the value just assigned to a watched memory location (watchpoints only).
$nid Returns the node ID.
$oldval Returns the value that existed in a watched memory location before a new value modified it (watchpoints only).
$pid Returns the process ID.
$processduid Returns the DUID of the process.
$systid Returns the system-assigned thread ID. When referenced from a process, generates an error.
$tid Returns 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 Statement Description
$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 program group continue to execute.
$countall expression Sets 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 expression Sets 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.
$holdthread Freezes the current thread leaving other threads running.
$holdthreadstop
$holdthreadstopprocess Exactly like $holdthread except it stops the process. The other processes in the group are left running.
$holdthreadstopall Exactly 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.
$stopall Sets a program-group-level breakpoint. All processes in the program group stop when any thread or process in the group executes this statement.
$stopthread Sets 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.