TotalView Online Help : Chapter 10 Expression List Window
Chapter 10 Expression List Window
Expression List Window Overview
Selecting the Process Window’s Tools > Expression List command displays a window containing a list of variables and expressions. TotalView also displays this window after you select the Add to Expression List command from a context menu.
This window can contain the values of as many variables and expressions so that you can monitor changes that occur as your program executes. That is, whenever your program halts in the thread listed in the Threads box, TotalView will reevaluate the value of everything in the Expression column.
Entering Variables and Expression into the Expression List Window
There are a number of ways to get information into the first column of this window:
You can type information text into the bottom-most cell in the Expression column or edit text already entered in this column.
Figure 130 – Tools > Expression List Window
The variable or expression that you enter is evaluated in the context of the current PC in the thread listed in the Threads box. For example, if you typed my_var into the window shown here, the value for it that TotalView displays is the value of my_var in process 1, thread 1 and its scope is defined by the current PC. This means, for example, if you have two variables named my_var, TotalView will not change the context when the other my_var is in scope.
If you would like TotalView to change the scope in which it evaluates an expression, right-click on a row and select the Compilation Scope > Floating command. For more information, see View > Compilation Scope > Floating”.
Right click on something in the Process Window’s Source or Stack Frame Panes. From the displayed context menu, select Add to Expression List. Here’s is the context window that displays within the Process Window:
Figure 131 – Context Menu
Right click on something in the Variable Window. Select Add to Expression List from the displayed context menu. You can also use the View > Add to Expression List command.
When sending something to the Expression List Window, the cursor and your selection matter. If you click on a variable or select a row in the Variable Window, TotalView sends the variable to the Expression List Window. If you instead select some text with the Source or Stack Frame Panes, TotalView sends only that text. What’s the difference? In the figure at the beginning of this topic, notice that there are three different d1_array expressions.
The first was added by just selecting part of what was displayed in the Source Pane.
The second was added by selecting a row within the Variable Window.
The third was added by duplicating the previous entry and then modifying the index.
In addition, you can select any part of your program that is an expression and place the selection in this window.
The scope that TotalView uses when looking up a variable when execution stops is the scope that existed when the variable was entered. If you want the scope to float so that a variable can be evaluated in different scopes, right-click within the variable’s row and select the Compilation Scope > Floating command. Selecting Compilation Scope > Fixed tells TotalView that it should only evaluate the variable in its original scope. For more information, see:
View > Compilation Scope > Fixed.
View > Compilation Scope > Floating.
Opening and Closing the Expression List Window
If you close the Expression List Window and then reopen it, TotalView remembers what you had previously entered. In other words, it doesn’t delete what you enter. Instead, you must explicitly delete expressions using the Edit > Delete Expression or Edit > Delete All Expressions commands.
What Can You Enter in the Expression Column
You can type a variable or an expression within a cell in the Expression column or, if you select the Add to Expression List command, TotalView can add an entry. The expressions that enter are limited. They cannot contain function calls and they cannot create side-effects. A previous figure showed four different expressions.
i
A variable with one value. The Value column shows its value.
d1_array
An aggregate variable; that is, an array, a structure, a class, and so on. It’s value cannot be displayed in one line. Consequently, TotalView just gives you some information about the variable. To see more information, dive on it. After diving, TotalView displays the variable in a Variable Window.
Whenever you place an aggregate variable in the Expression column, you will need to dive on it to get more information.
d1_array[1].d1_v
This entity is an element within an array of structures. If TotalView can resolve what you enter in the Expression column into a single value, it will display a value in the Value column. If it can’t, TotalView displays information in the same way that it displays information in the d1_array example.
d1_array[i-1].d1_v
This differs from the previous example in that the array index is an expression. Whenever execution stops in the current Thread, TotalView reevaluates i, so that the element within the array that is evaluated may change.
The expressions you enter cannot include function calls.
TotalView can tell you when a variable’s value changes in several ways.
When your program stops at a breakpoint, TotalView adds a yellow highlight to the variable’s value if it has changed.
Figure 132 – Expression List Window With “Change” Highlighting
If the thread is stopped for another reason—for example, you’ve stepped the thread—and the value has changed, TotalView does not add yellow highlighting to the line.
You can tell TotalView to display the Last Value column. Do this by selecting Last Value in the column menu, which is displayed after you click on the column menu () icon.
Figure 133 – Expression List Window Showing Last Value Column
Manipulating the Expression List Window
When you first bring up the Expression List Window, it contains two columns. However, TotalView can display additional columns. If you right click on a column headings, TotalView displays a context menu that shows your choices.
Figure 134 – Tools > Expression List Window
Here are operations you can perform by directly manipulating elements within the window:
The up and down arrows () on the right side of the toolbar allow you to change the order in which rows are displayed. For example, clicking on the down arrow moves the currently selected row one row lower in the display.
You can change an expression by clicking within its text, then typing new characters and deleting others.
You can sort the contents of a column by clicking on the column header. For example, you could sort the Value column into an ascending order. After you click on the header, TotalView adds an indicator indicating that the column was sorted and the way in which it was sorted. Reclicking resorts the column into a descending order. Clicking a third time removes the results of sorting; that is, TotalView restores the window to what it was before you clicked on the column heading.
Similarly, you can change a value in the Value column if that value is stored in memory. After entering a new value, TotalView replaces the old memory value with the one you just entered. This change cannot be undone.
You can freeze the Expression List Window by selecting View > Freeze. This is a toggle, so selecting View > Freeze again unfreezes the window.
When frozen, the values for the variables and expressions do not update as you continue moving through the program. If you unfreeze the window, the values update to reflect your current position in the program.
You can add variables and expressions when the window is frozen, but no value will appear because TotalView has ceased displaying current values. When you unfreeze the window, any new variables and expressions are updated with a value.
One use is to freeze the values in one window while opening another, unfrozen window for the same variables to see how they change as execution continues.
Multiprocess/Multithreaded Behavior
You can change the thread in which TotalView evaluates elements within the Expressions column by changing the value in the Threads box contained within the window’s toolbar.
When you send a variable to the Expression List Window and a window is open, TotalView checks that window’s thread. If it is the same as the thread associated with the Process or Variable Window from which you are sending the expression, TotalView adds it to the bottom of the list. If it is different, TotalView still adds it to the bottom of the list. It then duplicates the window and changes the thread of the newly created window. That is, adding a variable to the list can create a new window. In this example, each has the same list of expressions. The value of these expressions may differ as they show the values of the expressions within different threads.
In all cases, the list of expressions will always be the same. What differs is the context in which TotalView evaluates the window’s expressions.
Similarly, if TotalView is displaying two or more Expression List Windows and you send from yet another process and thread combination, TotalView adds the variable to all of them, duplicates one of them, and then changes the duplicated window to this new combination.