NextGen TotalView for HPC User Guide : PART II Debugging Tools and Tasks : Chapter 6 Examining and Editing Data : The Data View : Editing an Expression : Casting to Another Type
Casting to Another Type
You may need to cast your data to a type that is more meaningful. Enter the cast code in the Type field. Here are some examples.
Casting to an Array
Cast a variable into an array by adding an array specifier to the Type declaration. For example, adding [3] to a variable declared as an int changes it into an array of three ints.
Press Enter to cast the variable:
Depending on the array declaration, NextGen TotalView for HPC displays arrays differently. See "Displaying Arrays".
Displaying an Allocated Array
Display an allocated array. Using malloc() (in C and C++) creates a pointer to allocated memory. For example:
dynStrings = (char**) malloc (10 * sizeof(char*));
Because the debugger doesn’t know that this is a pointer to an array of ints, to display the array, change its type to $string *[10].
Then click the down arrow to display your array of 10 strings.
Built-InTypes
TotalView provides a number of predefined types. These types are preceded by a $. You can use these built-in types anywhere you can use those defined in your programming language. These types are also useful in debugging executables with no debugging symbol table information. The following table describes the built-in types:
Table 4: TotalView Built-in Types
Type String
Language 
Size
Description
$address
C
void*
Void pointer (address).
$char
C
char
Character.
$character
Fortran
character
Character.
$code
C
architecture-dependent
Machine instructions.The size used is the number of bytes required to hold the shortest instruction for your computer.
$complex
Fortran
complex
Single-precision floating-point complex number.Thecomplex types contain a real part and an imaginary part, which are both of type real.
$complex_8
Fortran
complex*8
Areal*4-precision floating-point complex number.Thecomplex*8 types contain a real part and an imaginary part, which are both of type real*4.
$complex_16
Fortran
complex*16
Areal*8-precision floating-point complex number.Thecomplex*16 types contain a real part and an imaginary part, which are both of type real*8.
$double
C
double
Double-precision floating-point number.
$double_precision
Fortran
double precision
Double-precision floating-point number.
$extended
C
architecture-dependent;oftenlong double
Extended-precision floating-point number. Extended-precision numbers must be supported by the target architecture. In addition, the format of extended floating point numbers varies depending on where it's stored. For example, the x86 register has a special 10-byte format, which is different than the in-memory format. Consult your vendor’s architecture documentation for more information.
$float
C
float
Single-precision floating-point number.
$int
C
int
Integer.
$integer
Fortran
integer
Integer.
$integer_1
Fortran
integer*1
One-byte integer.
$integer_2
Fortran
integer*2
Two-byte integer.
$integer_4
Fortran
integer*4
Four-byte integer.
$integer_8
Fortran
integer*8
Eight-byte integer.
$logical
Fortran
logical
Logical.
$logical_1
Fortran
logical*1
One-byte logical.
$logical_2
Fortran
logical*2
Two-byte logical.
$logical_4
Fortran
logical*4
Four-byte logical.
$logical_8
Fortran
logical*8
Eight-byte logical.
$long
C
long
Long integer.
$long_long
C
long long
Long long integer.
$real
Fortran
real
Single-precision floating-point number.When using a value such as real, be careful that the actual data type used by your computer is not real*4 or real*8, since different results can occur.
$real_4
Fortran
real*4
Four-byte floating-point number.
$real_8
Fortran
real*8
Eight-byte floating-point number.
$real_16
Fortran
real*16
Sixteen-byte floating-point number.
$short
C
short
Short integer.
$string
C
char
Array of characters.
$void
C
long
Area of memory.
$wchar
C
platform-specific
Platform-specific wide character used by wchar_tdata types
$wchar_s16
C
16 bits
Wide character whose storage is signed 16 bits (not currently used by any platform)
$wchar_u16
C
16 bits
Wide character whose storage is unsigned 16 bits
$wchar_s32
C
32 bits
Wide character whose storage is signed 32 bits
$wchar_u32
C
32 bits
Wide character whose storage is unsigned 32 bits
$wstring
C
platform-specific
Platform-specific string composed of $wchar characters
$wstring_s16
C
16 bits
String composed of $wchar_s16 characters (not currently used by any platform)
$wstring_u16
C
16 bits
String composed of $wchar_u16 characters
$wstring_s32
C
32 bits
String composed of $wchar_s32 characters
$wstring_u32
C
32 bits
String composed of $wchar_u32 characters