Variable Window
The Variable Window displays information about one of your program's objects. If the data type needs to be cast to a different type, you can cast it to the way you want it to appear.
Note: The CLI's type mapping procedure lets you control how TotalView displays information. For more information, see Chapter 5 of the TotalView Command Line Interface Guide.
You can also use this window to change the values contained within a variable.
If TotalView is displaying an array, you can display a limited section of the array, called a slice, instead of the whole array. You can also enter a filter that tells TotalView to make decisions about which elements it should display.
Topics in this topic are:
When you open a Variable Window, TotalView tries to find a window that is already displaying the object. If it finds a window, TotalView moves this window to the front of the display.
You can use the Window > Duplicate or the Window > Duplicate Base commands to create a copy of a Variable Window.
Changing the Value of a Variable
To change the value of a simple variable or change the value of a field in a more complex variable (a structure or array), click the cursor within the variable's value, then enter the changed value.
If you are changing a variable within an HPF program, TotalView uses the variable's distribution status to determine where it should make changes. TotalView updates replicated variables in all processes if they all had the same initial value; it updates a distributed variable only in the process in which it resides. (See Changing a Variable's Address for more information.)
Changing Subscripts
To change an array's subscripts, edit the data that appears after the Slice: field at the top of the window. You can enter each array dimension by using one of the following formats:
- (
slice descriptor,slice descriptor,...
)
-
[slice descriptor][slice descriptor]...
The slice descriptor tells TotalView that it should display every strideth subscript from the lower bound to the upper bound, inclusive. If the stride is negative, every -strideth subscript from the upper bound to the lower bound, inclusive, is shown in reverse order.
Each slice descriptor has a lower bound, an upper bound, and a stride. These elements are separated by a colon (:).
If you omit the stride value and its colon separator, the default stride value is 1. If you omit the upper bounds, the lower bounds value will also be the upper bounds value. The lower bound must be less than or equal to the upper bound, and the stride cannot be 0.
Filtering Array Values
You can tell TotalView that it should selectively display information from the array by entering a value in the Filter field.
While there are a number of ways to specify a filter, the general format is:
operator value
where operator is one or more of the following:
<, <=, >, >=, ==, !=
.lt. .le. .gt. .ge. .eq. .ne.
value can be a constant integer or real value. For example:
> 0
Instead of typing a value, you can enter a TotalView intrinsics, which are built in representations of IEEE floating-point NaN (Not a Number), INF (infinity), and denormalized values. These intrinsics are:
$nan |
any NaN (Not a Number) |
$nanq |
quiet NaN (Not a Number) |
$nans |
signaling NaN (Not a Number) |
$inf |
any INF, either positive or negative |
$ninf |
negative INF |
$pinf |
positive INF |
$denorm |
denormalized number, either positive or negative |
$pdenorm |
positive denormalized number |
$ndenorm |
negative denormalized number |
Note: You can only use the == and != operators with these intrinsics. For example, != $denorm.
You can add a second component to the filter to indicate that you only want to see information contained within a range by using the following format:
[>]low_value:[<]high_value
Here are some points to consider:
- low_value and high_value are constant integers or real values.
- You can apply the < and > operators to the low and high values to allow for exclusive ranges. By default, the range is inclusive of the lower and upper values.
- low_value and high_value cannot be of different types. For example, the following range is invalid:
1:2000u
1.0:2000
- You can use the
$value
token to represent the current array element. For example:
$value > 0 && $value < 100
This filter expression tells TotalView to displays all array elements that are greater than 0 and less than 100.
- Your filter can also contain program variables. For example:
$value != x && $value < y
- You cannot use function calls in a filter expression.
For more information, see Chapter 9 of the TotalView User's Guide.
Changing a Variable's Data Type
To change the data type that TotalView uses to format the variable, just edit the type name that appears at the top of the window.
Changing the Data Type of a Field in a Structure
To change the data type of any field in a structure, edit the Type entry on the line containing the field.
While you cannot edit the type entry for a field in a substructure, you can dive into the substructure and then edit it.
Changing a Variable's Address
To view a different part of memory, edit the address field in the upper left corner of the window. There are two exceptions:
- You cannot change the address of register variables.
- You cannot change the address of HPF distributed objects. In an HPF program, the address field also displays whether the variable is distributed [Dist] or replicated [Repl]. (If neither flag is shown, you are seeing a nonHPF datatype. TotalView treats these variables as local to the process in which they reside.) You cannot edit this part of the address field. If you change the address of a replicated variable, the replication property is removed since it would be very confusing to update a fixed address in all processes.
Diving Into a Pointer, Array Entry, or Structure Entry
To view the target of a pointer or to view one element in an array or structure, double-click on the entry. TotalView replaces the contents of the window with a view of the item you dived into (or the object it points to, in the case of pointers). This allows you to easily chase chains of linked structures.
After you dive into a field, you can edit its contents. (Diving into a substructure is the only way to edit the substructure's value.) You can also cast individual entries in arrays to different data types for display.