## Viewing Expressions

The Expressions view allows manipulation of expressions. An expression is a snippet of code that is evaluated to produce a value. In Carbide they are defined using C/C++ expressions. Some expressions may need to be evaluated at a specific location in the program so that its variables can be referenced.

The Expressions view displays these panes:

- Expressions list pane—Lists expressions and expression hierarchies. Click the hierarchical controls to expand or collapse the expression. Right-click to open the Expressions view context menu.
- Value pane—Shows the current value of each corresponding expression. Double-click a value to change it. Right-click to set viewing options.

Figure 1 - Expressions view

#### To open the Expressions view

- Click the Window > Show View > Expressions menu option

A Expressions view appears.

### Expressions view toolbar icons

The following commands appear on the Expressions view toolbar:

Item | Icons | Explanation
--- | --- | ---
Show Type Names |  | Toggles the display of type names in the Expressions view.
Show Logical Structure |  | Not available in C/C++ yet.
Collapse All |  | Collapses all expanded expressions into the top level.
Create a New Watch Expression |  | Click to open the Add New Expression dialog. Enter the expression to add, then click OK.
Remove Selected Expression |  | Click to remove all currently selected expressions from the expressions list.
Remove All Expressions |  | Click to remove all expressions from the expressions list.
View Menu |  | Click the View Menu icon to set the layout of the Expressions view.

### Expressions view context menu options

Right-click in the Expression's pane in the Expressions view to access the context menu commands shown in Figure 2.

Figure 2. Expressions view context menu commands (Expression list pane)

The commands include:

Item | Explanation
--- | ---
Select All | Selects all the expressions shown in the Expressions view.
Copy Expressions | Copies the selected expressions to the clipboard. NOTE Only the selected expressions visible in the Expressions view are copied. Expressions listed outside the boundary of the view are not in memory and can't be copied at this time.
Remove | Remove the selected expressions from the Expressions view list.
Remove All | Remove all expressions from the Expressions view list.
Find... | Opens a Find dialog to search the Expressions view list. Enter the expression to search for and click OK.
Change Value... | Opens the Set Value dialog where you can modify the value assigned to the selected expressions. Change the value and click OK.
Add Watch Expression... | Opens the Add Watch Exression dialog for creation of a new expression.
Disable | Disables automatic evaluation of the selected expression and appends (disabled) to the expression name. Useful when you have lots of expressions but are concentrating on only a few. The more expressions that need evaluaton, the longer it takes to update the Expressions view.
Enable | Enables automatic evaluation of the selected expression. Enables a disabled expression so that it is evaluated during the debug session.
Edit Watch Expression... | Opens the Edit Watch Expression dialog where you can modify the expression and enable it for automatic evaluation.
Add Watchpoint (C/C++)... | Opens the Add Watchpoint dialog enabling you to define a watchpoint on the variable.
Cast To Type... | Opens the Cast to Type dialog where you can assign a new type to the expression. Enter the type and click OK. All cast expressions are then shown using the Restore Original Type menu option making them easy to identify and restore later.
Display As Array... | Opens the Display as Array dialog where you can set array parameters to show the variables. Enter the Start index and Length, then click OK to update how the variables are shown in the Variables 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)
Watch | Creates a watchpoint on the selected variable and displays it in the Watchpoint view.

##### Other references

- Variables and Expressions Overview