30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Changing a Variable’s Data Type<br />

� “Viewing Structures” on page 315<br />

� “Viewing Unions” on page 315<br />

� “Casting Using the Built-In Types” on page 315<br />

You can change the way <strong>TotalView</strong> displays data in the Variable Window and<br />

the Expression List Window by editing the data type. This is known as casting.<br />

<strong>TotalView</strong> assigns types to all data types, and in most cases, they are<br />

identical to their programming language counterparts.<br />

When a C or C++ variable is displayed in <strong>TotalView</strong>, the data types are identical<br />

to their C or C++ type representations, except for pointers to arrays.<br />

<strong>TotalView</strong> uses a simpler syntax for pointers to arrays. (See “Viewing Pointers to<br />

Arrays” on page 314.) Similarly, when Fortran is displayed in <strong>TotalView</strong>, the<br />

types are identical to their Fortran type representations for most data types<br />

including INTEGER, REAL, DOUBLE PRE<strong>CI</strong>SION, COMPLEX, LOGICAL, and<br />

CHARACTER.<br />

If the window contains a structure with a list of fields, you can edit the data<br />

types of the listed fields.<br />

When you edit a data type, <strong>TotalView</strong> changes how it displays the variable in the current<br />

window. Other windows listing the variable do not change.<br />

Displaying C and C++ Data Types<br />

The syntax for displaying data is identical to C and C++ language cast syntax<br />

for all data types except pointers to arrays. That is, you use C and C++<br />

cast syntax for data types. For example, you can cast using types such as<br />

int, char, unsigned, float, double, union, all named struct types, and so on.<br />

In addition, <strong>TotalView</strong> has a built-in type called $string. Unless you tell it<br />

otherwise, <strong>TotalView</strong> maps char arrays to this type. (For information on<br />

wide characters, see “Viewing Wide Character Arrays ($wchar Data Types)” on<br />

page 318.)<br />

Read <strong>TotalView</strong> types from right to left. For example, $string*[20]* is a<br />

pointer to an array of 20 pointers to $string.<br />

The following table shows some common <strong>TotalView</strong> data types:<br />

Data Type String Description<br />

int Integer<br />

int* Pointer to an integer<br />

int[10] Array of 10 integers<br />

$string Null-terminated character string<br />

$string** Pointer to a pointer to a null-terminated character string<br />

$string*[20]* Pointer to an array of 20 pointers to null-terminated strings<br />

You can enter C and C++ Language cast syntax in the Type field.<br />

Figure 200 on page 313 shows three different casts:<br />

The two Variable Window cast the same data in the same way. In the top-left<br />

window, a cast was used in the Expression field. In the other Variable Window,<br />

312 Chapter 14: Examining and Changing Data

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!