5.19 Watch Local Variable Values Change

Watch the values of local variables change in the Variables window. Determining if these values are as expected during program execution will help you to debug your code.

To view the Variables window, either:

  • Select Window > Debugging > Variables to open the window.
  • Click the Variables tab in the Output window if the window is already open.
Figure 5-37. Variables Window – Program Pause

View Variable Changes

  1. Debug and then Pause your program.*
  2. Click the Variables tab to view the window and see the local variable value.

* Some tools allow runtime updates, meaning that you can see the value change as the program executes. Check your tool documentation to see if it supports this feature.

Change the Radix of a Variable:\

Right click in the line of the variable and select Display Value As.

Understanding the Optimized Descriptor

The Variables window may show (Optimized) for local variables. This is not related to compiler settings but rather implies the variable value is not available on the current stack frame at the scope where it is evaluated. It is most commonly applicable to function param variables which are not used by a function at the current scope.