Visualizing Data in Expressions
The $visualize intrinsic (built-in) function lets you use TotalView's evaluation system to visualize data. This function lets you:
- Visualize several different variables from a single expression.
- Visualize variables from the Process Window's Tools > Evaluate dialog box.
- Visualize one or more variables from an evaluation point.
The syntax for the $visualize intrinsic is:
$visualize ( array [, slice_string ])
The array parameter is an expression naming the dataset being visualized. The optional slice_string parameter is a quoted string defining a constant slice expression that modifies the array parameter's dataset.
The following examples show how you can use this intrinsic. Notice that the array's dimension ordering differs in C and in Fortran.
C
$visualize(my_array);
$visualize (my_array,"[::2][10:15]");
$visualize (my_array,"[12][:]");
Fortran
$visualize (my_array)
$visualize (my_array,'(11:16,::2)')
$visualize (my_array,'(:,13)')
The first example in each programming language group visualizes the entire array. The second example selects every second element in the array's major dimension; it also clips the minor dimension to all elements in the given (inclusive) range. The third example reduces the dataset to a single dimension by selecting one subarray.
You may need a cast expression to let TotalView know what the dimensions of the variable being visualized are. For example, here is a procedure that passes a two-dimensional array parameter that does not specify the extent of the major dimension:
void my_procedure (double my_array[][32])
{ /* procedure body */ }
You will need to use the following cast expression because the first dimension is not specified:
$visualize (*(double[32][32]*)my_array);
You can use $visualize in the Tools > Evaluate dialog box or by adding an expression to an evaluation point. But note that TotalView cannot compile an evaluation point or expression that contains $visualize. Instead, TotalView interprets these statements. See Defining Evaluation Points for information about compiled and interpreted expressions.
Using $visualize in a Tools > Evaluate dialog box is a handy technique you can use to refine an array and slice arguments or to update a display of several arrays simultaneously.