TotalView User Guide : Part II: Debugging Tools and Tasks : Examining and Editing Data and Program Elements : Changing a Variable’s Data Type : Viewing Arrays
Viewing Arrays
When you specify an array, you can include a lower and upper bound separated by a colon (:).
*See Chapter 9, “Examining Arrays,” for more information on arrays.
By default, the lower bound for a C or C++ array is 0, and the lower bound for a Fortran array is 1. In the following example, an array of ten integers is declared in C and then in Fortran:
int a[10];
integer a(10)
The elements of the array range from a[0] to a[9] in C, while the elements of the equivalent Fortran array range from a(1) to a(10).
TotalView also lets you cast a variable to an array. In the GUI, just add an array specifier to the Type declaration. For example, adding (3) to a variable declared as an integer changes it to an array of three integers.
When the lower bound for an array dimension is the default for the language, TotalView displays only the extent (that is, the number of elements in the dimension). Consider the following Fortran array declaration:
integer a(1:7,1:8)
Since both dimensions of this Fortran array use the default lower bound, which is 1, TotalView displays the data type of the array by using only the extent of each dimension, as follows:
integer(7,8)
If an array declaration doesn’t use the default lower bound, TotalView displays both the lower bound and upper bound for each dimension of the array. For example, in Fortran, you declare an array of integers with the first dimension ranging from -1 to 5 and the second dimension ranging from 2 to 10, as follows:
integer a(-1:5,2:10)
TotalView displays this the same way.
When editing an array’s dimension, you can enter just the extent (if using the default lower bound), or you can enter the lower and upper bounds separated by a colon.
TotalView also lets you display a subsection of an array, or filter a scalar array for values that match a filter expression. See Displaying Array Slices” and Filtering Array Data Overview” for more information.