Inspecting variables

The Variables view shows information about the variables in the currently selected stack frame:

Variables view

At the bottom of the view, the Detail pane shows the value of the selected variable.

Note: If you happen to have multiple variables of the same name, the one most in scope is evaluated.

When the execution stops, the changed values are highlighted in yellow (by default). Like the other debug-related views, the Variables view doesn't try to keep up with the execution of a running program; it updates the display only when execution stops.

You can decide whether or not to show the variable type (e.g. int) by clicking the Show Type Names toggle button.

Icon: Show Type Names

The Show Type Names button is unavailable when columns are visible.

You can also control whether or not the IDE tracks all your program's variables. See the Debugger tab section in the Launch Configurations Reference chapter.

Note:

Tracking all the variables can reduce your program's performance.

By default, global variables aren't shown in the Variables view. To add global variables to the view:

To inspect global variables:
  1. In the Variables view, click the Add Global Variables button.

    Add Global Variables

  2. Select one or more symbols in the Global Variables dialog.

    Global Variables

  3. Click OK to add the selected global variables to the Variables view.
Related concepts
Using breakpoints and watchpoints
Inspecting your registers
Inspecting a process's memory
Inspecting shared-library usage
Monitoring signal handling
Viewing your output
Interacting with GDB
Related tasks
Changing variable values
Controlling the display of variables
Changing variable to a different type
Viewing variables in memory
Evaluating your expressions