For primitive, built-in types, you can quickly view data values from within the Process Window and can also add them to another window, the Expression List Window.
Viewing Variables in the Process Window
First, we’ll add a breakpoint so the program will stop execution and we can view data.
1. Set a breakpoint
— Add a breakpoint at line 88, the beginning of the for loop in the load_matrix() function.
At this point, you should have two action points: the breakpoint just added, and the eval point added in the section "Evaluation Points".
— Click Go. The program should stop on the breakpoint you just added.
Now let’s view some data.
2. View variables in the Stack Frame pane
The Stack Frame pane lists function parameters, local variables, and registers. Scalar values are displayed directly, while aggregate types are identified with just type information.
In the Stack Frame pane, note the value of the local variables i and count: i is 1, and count is 5.
3. View variables in a tool tip
— In the Source Pane, hover over the variable i to view a tool tip that displays its value:
Viewing Variables in an Expression List Window
The Expression List window is a powerful tool that can list any variable in your program, along with its current or previous value and other information. This helps you to monitor variables as your program executes. For scalar variables, this is a particularly easy, compact way to view changing values.
1. Create an Expression List
— In the Stack Frame pane, right-click on the variable i, and select Add to Expression List. Then do the same for the variable count. The Expression List Window launches, displaying these two variables and their values.
2. View the updated values
— Click Go. When the breakpoint is hit, the value of i increments to 2, and this changed value is highlighted in yellow in the Expression List window:
— If you continue to hit Go, you can view the value of i increment to 5 before the program completes.
3. Add additional columns to see more data
— Right-click on the column header and select Type and Last Value. These two columns are added to the table: