30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Changing a Variable’s Data Type<br />

If you want, you can change a $void to another type. Similarly, you can<br />

change any type to a $void to see the variable in decimal and hexadecimal<br />

formats.<br />

Viewing Instructions ($code Data Type)<br />

<strong>TotalView</strong> uses the $code data type to display the contents of a location as<br />

machine instructions. To look at disassembled code stored at a location,<br />

dive on the location and change the type to $code. To specify a block of<br />

locations, use $code[n], where n is the number of locations being displayed.<br />

Viewing Opaque Data<br />

An opaque type is a data type that could be hidden, not fully specified, or<br />

be defined in another part of your program. For example, the following C<br />

declaration defines the data type for p to be a pointer to struct foo, and<br />

foo is not yet defined:<br />

struct foo;<br />

struct foo *p;<br />

When <strong>TotalView</strong> encounters a variable with an opaque type, it searches for<br />

a struct, class, union, or enum definition with the same name as the opaque<br />

type. If <strong>TotalView</strong> doesn’t find a definition, it displays the value of the variable<br />

using an opaque type name; for example:<br />

(Opaque foo)<br />

Some compilers do not store sufficient information for <strong>TotalView</strong> to locate<br />

the type. This could be the reason why <strong>TotalView</strong> uses the opaque type.<br />

You can tell <strong>TotalView</strong> to use the correct data type by having it read the<br />

source file. For example, if <strong>TotalView</strong> is showing you (Opaque foo) and you<br />

know that struct foo is defined in source file foo.c, use the File > Open<br />

Source Command. While this command’s primary purpose is to tell <strong>TotalView</strong><br />

to display the file within the Process Window, it also causes <strong>TotalView</strong> to read<br />

the file’s debugging information. As a side-effect, struct foo should now be<br />

defined. Because <strong>TotalView</strong> now knows its definition, it can resolve the<br />

opaque type.<br />

Type-Casting Examples<br />

This section contains three type-casting examples:<br />

� Displaying Declared Arrays<br />

� Displaying Allocated Arrays<br />

� Displaying the argv Array<br />

320 Chapter 14: Examining and Changing Data

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

Saved successfully!

Ooh no, something went wrong!