Expressions
- 6.4.1. Listing local variables
- 6.4.2. Listing watched expressions
- 6.4.3. Adding an expression to watch
- 6.4.4. Removing a watched expression
- 6.4.5. Evaluating expressions
- 6.4.6. Inspecting expressions in editor window
6.4.1. Listing local variables
When a program is running under the control of the debugger, the Locals list window can be opened by choosing .
Local variables of the current frame (the current function in which the program control is present) are displayed in the Locals window. During execution of the program (e.g. during single stepping), local variables will be updated. If any variable value was changed in the last debugging step, its value will be highlighted in red. Variables are presented in a tree form for easy view.

The value of a local variable can be modified by selecting it and clicking in the Value column.
gdb is more and more often used as a back end for a graphical front end. It has been improved recently in this area. It is recommended that you use the latest version (6.6) of gdb. With older versions, gdb can crash when the front end asks for an pointer with an invalid (but unused) value.
6.4.2. Listing watched expressions
Inspecting or evaluating an expression provides the result only once. To continuously monitor some variables or expressions, use expression watches.
Choose the menu item to display the Watches window.
6.4.3. Adding an expression to watch
Right-click on the Watches window to open the context menu. Choose the menu item . Alternatively, you can use A dialog prompting for the expression will appear. Enter the expression and click .
By default watch expressions are updated automatically each time the program is stopped. This can be changed in the add watch dialog or later using the menu item in the Watches window context menu. A watched expression can be updated manually by choosing or in the context menu.
It is not necessary to have the debugger running to add a new watch expression. If the debugger is not running or the corresponding expression cannot be found, the front end will try to create the watch expression each time the program is stopped.
6.4.4. Removing a watched expression
Right-click the watch expression that you want to remove in the Watches window, then choose the context menu item to remove it.
All watches can be removed by choosing in the context menu of the Watches window.
6.4.5. Evaluating expressions
When control is returned from a program — possibly at a breakpoint — it is possible to evaluate expressions or inspect the values of variables in the program. Choose the menu item , in the context menu of the editor or click the button on the Debug Toolbar.
A window will appear showing the evaluation of the expression highlighted in the editor. You can evaluate a new expression by clicking on the name column and entering the new one.
You can add the expression to the list of watched expressions directly by clicking on the button.
6.4.6. Inspecting expressions in editor window
When the debugger is active with the program stopped, you can get the value of an expression just by putting the mouse pointer over it and staying there for a short time. If the expression is already present in the Locals or Watches window, its value is displayed in a tooltip.
This capability is currently working only for simple variables, not for structures or arrays.
