Totalview® User Guide : PART II Debugging Tools and Tasks : Chapter 9 Examining and Editing Data and Program Elements : Displaying Variables : Viewing Variables in Different Scopes as Program Executes : Scoping Issues
Scoping Issues
When you dive into a variable from the Source Pane, the scope that TotalView uses is that associated with the current frame’s PC; for example:
1: void f()
2: {
3: int x;
4: }
5:
6: int main()
7: {
8: int x;
9:}
If the PC is at line 3, which is in f(), and you dive on the x contained in main(), TotalView displays the value for the x in f(), not the x in main(). In this example, the difference is clear: TotalView chooses the PC’s scope instead of the scope at the place where you dove. If you are working with templated and overloaded code, determining the scope can be impossible, since the compiler does not retain sufficient information. In all cases, you can click the More button within the Variable window to see more information about your variable. The Valid in Scope field can help you determine which instance of a variable you have located.
You can use the View > Lookup Variable command to locate the instance you are interested in.