Partilhar via


Expression Evaluation (Visual Studio Debugging SDK)

During break mode, the IDE must be able to evaluate simple expressions involving several variables of your program. To accomplish this, the debug engine (DE) must be able to parse and evaluate an expression that is entered into one of the windows of the IDE.

Expressions are created using the IDebugExpressionContext2::ParseText method and are represented by the resulting IDebugExpression2 interface.

The IDebugExpression2 interface is implemented by the DE and calls its EvalAsync method to return an IDebugProperty2 interface to the IDE, in order to display the results of the expression evaluation in the IDE. IDebugProperty2::GetPropertyInfo returns a structure that can be used to put the value of an expression into a Watch window or into the Locals window.

The debug package or session debug manager (SDM) calls IDebugExpression2::EvaluateAsync or EvaluateSync to get an IDebugProperty2 interface that represents the result of the evaluation. IDebugProperty2 has methods that return the name, type, and value of the expression. This information is displayed in various debugger windows.

Using Expression Evaluation

To use expression evaluation, you must implement the IDebugExpressionContext2::ParseText method and all of the methods of the IDebugExpression2 interface, as shown in the following table.

Method

Description

EvaluateAsync

Evaluates an expression asynchronously.

Abort

Ends asynchronous expression evaluation.

EvaluateSync

Evaluates an expression synchronously.

Synchronous and asynchronous evaluation require the implementation of the IDebugProperty2::GetPropertyInfo method. Asynchronous expression evaluation requires the implementation of IDebugExpressionEvaluationCompleteEvent2.

See Also

Concepts

Execution Control and State Evaluation