Writing Code Fragments

You can use code fragments in evaluation points and in the Tools > Evaluate dialog box. This section describes the intrinsic variables, built-in statements, and language constructs supported by TotalView.

Intrinsic Variables

The TotalView expression system supports built-in variables that allow you to access special thread and process values. All variables are 32-bit integers, which is an int or a long on most platforms. The following table lists the intrinsic variable names and their meanings.

Name
Returns
$clid
The cluster ID. (Interpreted expressions only.)
$duid
The TotalView-assigned Debugger Unique ID (DUID). (Interpreted expressions only.)
$newval
The value just assigned to a watched memory location. (Watchpoints only.)
$nid
The node ID. (Interpreted expressions only.)
$oldval
The value that existed in a watched memory location before a new value modified it. (Watchpoints only.)
$pid
The process ID.
$processduid
The DUID of the process. (Interpreted expressions only.)
$systid
The system-assigned thread ID. When this is referenced from a process, TotalView throws an error.
$tid
The TotalView-assigned thread ID. When this is referenced from a process, TotalView throws an error.

Intrinsic variables allow you to create thread-specific breakpoints from the expression system. For example, the $tid intrinsic variable and the $stop built-in operation let you create thread-specific breakpoint as follows:

if ($tid == 3)
    $stop;

This tells TotalView to stop the process only when thread 3 evaluates the expression.

You can also create complex expressions by using intrinsic variables. For example:

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

Note:   Using any of the following intrinsics means that the evaluation point is interpreted instead of compiled: $clid, $duid, $nid, $processduid, $systid, $tid, and $visualize. In addition, $pid forces interpretation on AIX.

You cannot assign a value to an intrinsic variable or obtain their address.

 
 
 
 
support@etnus.com
Copyright © 2001, Etnus, LLC. All rights reserved.
Version 5.0