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.

Displaying Variables<br />

Scoping Issues<br />

When you dive into a variable from the Source Pane, the scope that<br />

<strong>TotalView</strong> uses is that associated with the current frame’s PC; for example:<br />

1: void f()<br />

2: {<br />

3: int x;<br />

4: }<br />

5:<br />

6: int main()<br />

7: {<br />

8: int x;<br />

9:}<br />

If the PC is at line 3, which is in f(), and you dive on the x contained in<br />

main(), <strong>TotalView</strong> displays the value for the x in f(), not the x in main(). In<br />

this example, the difference is clear: <strong>TotalView</strong> chooses the PC’s scope<br />

instead of the scope at the place where you dove. If you are working with<br />

templated and overloaded code, determining the scope can be impossible,<br />

since the compiler does not retain sufficient information. In all cases, you<br />

can click the More button within the Variable window to see more information<br />

about your variable. The Valid in Scope field can help you determine<br />

which instance of a variable you located.<br />

You can, of course, use the View > Lookup Variable command to locate the<br />

correct instance.<br />

Freezing Variable Window Data<br />

Whenever execution stops, <strong>TotalView</strong> updates the contents of Variable Windows.<br />

More precisely, <strong>TotalView</strong> reevaluates the data found with the<br />

Expression area. If you do not want this reevaluation to occur, use the Variable<br />

Window’s View > Freeze command. This tells <strong>TotalView</strong> that it should<br />

not change the information that is displaying.<br />

After you select this command, <strong>TotalView</strong> writes information into the window,<br />

letting you know that the data is frozen. (See Figure 175 on page 290.)<br />

Selecting the View > Freeze command a second time tells <strong>TotalView</strong> that it<br />

should evaluate this window’s expression whenever execution stops.<br />

In most cases, you’ll want to compare this information with an unfrozen<br />

copy. Do this by selecting the Window > Duplicate command before you<br />

freeze the display. As these two windows are identical, it doesn’t matter<br />

which one you freeze. If you use the Duplicate command after you freeze<br />

the display, just select View > Freeze in one of the windows to get that window<br />

to update normally.<br />

Locking the Address<br />

The previous section discussed freezing the display so that <strong>TotalView</strong> does<br />

not update the Variable Window’s contents. Sometimes you only want to<br />

freeze the address, not the data at that address. Do this by selecting the<br />

<strong>TotalView</strong> <strong>Users</strong> <strong>Guide</strong>: version 8.7 289

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

Saved successfully!

Ooh no, something went wrong!