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.

Figure 210: Variable Window:<br />

Showing Variable<br />

Properties<br />

Scoping and Symbol Names<br />

routine. The variable’s scope does not extend outside of this subroutine. A<br />

program consists of multiple scopes. Of course, a block contained in the<br />

subroutine could have its own definition of the same variable. This would<br />

hide the definition in the enclosing scope.<br />

All scopes are defined by your program’s structure. Except for the simplest<br />

of programs, scopes are embedded in other scopes. The only exception is<br />

the outermost scope, which is the one that contains main(), which is not<br />

embedded. Every element in a program is associated with a scope.<br />

To see the scope in which a variable is valid, click the More button in the<br />

Variable Window until the scope fields are visible. The Variable Window now<br />

includes additional information about your variable, as is shown in<br />

Figure 210 on page 331.<br />

The Valid in Scope list indicates the scope in which the variable resides.<br />

That is, when this scope is active, the variable is defined. The Compiled in<br />

Scope list can differ if you modify the variable with an expression. It indicates<br />

where variables in this expression have meaning.<br />

When you tell the CLI or the GUI to execute a command, <strong>TotalView</strong> consults<br />

the program’s symbol table to discover which object you are referring to—<br />

this process is known as symbol lookup. Symbol lookup is performed with<br />

respect to a particular context, and each context uniquely identifies the<br />

scope to which a symbol name refers.<br />

For additional information, see “Scoping Issues” on page 289.<br />

Qualifying Symbol Names<br />

The way you describe a scope is similar to the way you specify a file. The<br />

scopes in a program form a tree, with the outermost scope (which is your<br />

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

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

Saved successfully!

Ooh no, something went wrong!