View Variable Expressions with Floating Scope

When TotalView displays an expression in the Data View, it uses the scope in which the variable was originally defined. This scope is defined as a fixed compilation scope, meaning that it remains fixed as your program executes. For example, if you're viewing the expression for the variable my_var in one routine and then continue execution into a second subroutine that also defines a my_var, TotalView continues to display the original my_var from the first routine. It does not automatically switch to the new my_var that is currently in scope.

To have TotalView update a variable’s scope as your program executes, you can turn on Floating Scope for the variable. This tells TotalView to look for the variable in the current scope each time execution stops. If it finds the variable, it displays the version defined in that scope.

Floating Scope is especially useful when debugging recursive routines or routines that use common variable names. For example, i, j, and k are frequently used as counter variables.

When you manually select a different scope while Floating Scope is turned on, the expression is evaluated in the selected scope. If you then turn off Floating Scope, the expression remains tied to the last scope in which it was evaluated, rather than reverting to its original scope.

Turn on Floating Scope

You can turn on Floating Scope for a variable expression in the Data View by taking one of the following actions: 

  • Right-click the expression and then select Enable Floating Scope in the context menu.

  • Select the expression and then click Floating Scope icon in off mode. on the Data View toolbar.

After you turn on Floating Scope for a variable expression, you can identify it in the Data View as demonstrated in Figure 61.

Figure 61. Floating Scope turned on

Data View image showing Floating Scope on.

If both Floating Scope and Freeze Data are enabled for an expression, only the Freeze Data icon appears next to the expression in the Data View. When Freeze Data is disabled, the Floating Scope icon becomes visible.

Turn off Floating Scope

You can turn off Floating Scope for a variable expression in the Data View by taking one of the following actions: 

  • Right-click the expression and select Enable Floating Scope in the context menu to clear the checkmark.

  • Select the expression and click Floating Scope icon in on mode. on the Data View toolbar.

Related Topics

Adding Variables to the Data View