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.

Why is There an Expression System?<br />

Figure 239: Displaying the<br />

Value of the Last<br />

Statement<br />

code within <strong>TotalView</strong>. <strong>TotalView</strong> is not using the compiler you used to create<br />

your program or any other compiler or interpreter on your system.<br />

Notice the last statement in Figure 239. <strong>TotalView</strong> displays the value<br />

returned by the last statement. This value is displayed. (See “Displaying the<br />

Value of the Last Statement” on page 384.)<br />

<strong>TotalView</strong> assumes that there is always a return value, even if it’s evaluating<br />

a loop or the results of a subroutine returning a void. The results are, of<br />

course, not well-defined. If the value returned is not well-defined, <strong>TotalView</strong><br />

displays a zero in the Result area.<br />

The code within eval points and the Evaluate Window does not run in the<br />

same address space as that in which your program runs. Because <strong>TotalView</strong><br />

is a debugger, it knows how to reach into your program’s address space.<br />

The reverse isn’t true: your program can’t reach into the <strong>TotalView</strong> address<br />

space. This forces some limitations upon what you can do. In particular,<br />

you can not enter anything that directly or indirectly needs to pass an<br />

address of variable defined within the <strong>TotalView</strong> expression into your program.<br />

Similarly, invoking a function that expects a pointer to a value and<br />

whose value is created within <strong>TotalView</strong> can’t work. However, you can<br />

invoke a function whose parameter is an address and you name something<br />

within that program’s address space. For example, you could say something<br />

like adder(an_array) if an_array is contained within your program.<br />

Using C++<br />

The <strong>TotalView</strong> expression system is able to interpret the way you define<br />

your classes and their inheritance hierarchy. For example, if you declare a<br />

method in a base class and you invoke upon an object instantiated from a<br />

derived class, <strong>TotalView</strong> knows how to access the function. It also under-<br />

384 Chapter 17: Evaluating Expressions

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

Saved successfully!

Ooh no, something went wrong!