Viewing Variables

The Variables view allows manipulation of project variables and the variable hierarchy used in the source code. For example, you can change the variable format, change a variable value, add watch expressions, or add global variables.

Figure 1 shows the Variables view with Show Type Names option enabled. The default view shows the variables list and include the Name and Value for all the variables within scope. In addition, when you select a variable its value is also shown in a different pane within the view.

Figure 1 - Variables view

Variables view toolbar icons

The following commands appear on the Variables view toolbar:

Item Icons Explanation
Show Type Names
Toggles the display of type names in the Variables view.
Show Logical Structure
Not available in C/C++ yet.
Collapse All
Collapses all expanded variables into the top level.
Add Global Variables
Click to open the Global Variables dialog where you can select one or more global variables to display in the Variables view. Global variables appear at the top of the variables list.
Remove Selected Global Variables
Click to remove all currently selected global variables from the variables list.
Remove All Global Variables
Click to remove all global variables from the variables list.
Menu

Enables you to modifiy the Layout to change the view orientation between: horizontal, vertical, or variables pane only.

In addition, use Show All Variables to toggle between showing only those variables that are in scope and live or show all local variables, even if redundant. With this option on you will see all of the variables including the multiple defined variables like “i” for your loops and ones that may no longer have accurate values.

Variables view context menu options

Right-click in the Variables view to access the commands on the Variables view context menu.

Figure 2. Variables view context menu commands

The commands include:

Item Explanation
Select All Selects all the variables shown in the Variables view.
Copy Variables Copies the selected variables to the clipboard.
Enable Enables the selected variable.
Disable Disables the selected variable.
Display as Array...  
Cast To Type... Opens the Cast to Type dialog where you can assign a new type to the variable.

Restore Original Type

Resets the selected variable to the original type assigned by the program.
View Memory Opens a Memory view on the selected variable so you can examine it.
Find... Opens a Find dialog to search for variables.
Change Value...

Opens the Set Value dialog where you can modify the value assigned to the selected variable. Change the value and click OK.

Add Watchpoint (C/C++)... Opens the Add Watchpoint dialog enabling you to define a watchpoint on the variable.
Add Global Variables... Select to open the Global Variables dialog where you can select one or more global variables to display in the Variables view. Global variables appear at the top of the variables list.
Remove Global Variables Remove the selected global variables from the Variables view.
Remove All Global Variables Remove all global variables from the Variables view.
Create Watch Expression Creates a watchpoint on the selected variable and displays it in the Watchpoint view.
Format

Change the selected variable's display format. The default setting is Natural, or the format assigned when the variable is defined. For example, the decimal value of 256 would appear as:

  • Binary (0b100000)
  • Natural (256)
  • Decimal (256)
  • Hexadecimal (0x100)
Other references