Evaluating expressions
To access global data that is not visible in the Locals view or to compute values of arithmetic expressions or function calls, use expression evaluators in the Expressions view.
For example, if you define static int staticVar = 42;
in a source file and then add staticVar
as an evaluated expression, you should see 42 in the view when the debugger stops in the source file.
You can also use Expression Evaluators as shortcuts to items that are nested deeply in the locals tree.
Adding expression evaluators
To add expression evaluators, drag an expression from the code editor to the Expressions view.
You can also:
- Double-click in the Expressions or Locals view.
- Select Add New Expression Evaluator from the context menu.
Enter the expression in the New Evaluated Expression dialog:
The set of evaluated expressions is saved in your session.
Expression evaluators are re-evaluated whenever the current frame changes. The functions used in the expressions are called each time, even if they have side-effects.
Note: Evaluating expressions is slow, so remove expression evaluators after use.
JavaScript expressions
The QML debugger can evaluate JavaScript expressions.
Available under certain Qt licenses.
Find out more.