Expression Evaluator

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Expression Evaluator.

Expression evaluators (EE) examine the syntax of a language to parse and evaluate variables and expressions at run time, allowing them to be viewed by the user when the IDE is in break mode.

Expressions are created using the ParseText method, as follows:

  1. The debug engine (DE) implements the IDebugExpressionContext2 interface.

  2. The debug package gets an IDebugExpressionContext2 object from an IDebugStackFrame2 interface and then calls the IDebugStackFrame2::ParseText method on it to get an IDebugExpression2 object.

  3. The debug package calls the EvaluateSync method or the EvaluateAsync method to get the value of the expression. IDebugExpression2::EvaluateAsync is called from the Command/Immediate window. All other UI components call IDebugExpression2::EvaluateSync.

  4. The result of expression evaluation is an IDebugProperty2 object, which contains the name, type, and value of the result of the expression evaluation.

During expression evaluation, the EE requires information from the symbol provider component. The symbol provider supplies the symbolic information used for identifying and understanding the parsed expression.

When asynchronous expression evaluation is complete, an asynchronous event is sent by the DE through the session debug manager (SDM) to notify the IDE that expression evaluation is complete. When synchronous expression evaluation is complete, the result of the evaluation is returned from the call to the IDebugExpression2::EvaluateSync method.

The Visual Studio debug engines expect to talk with the expression evaluator using Common Language Runtime (CLR) interfaces. As a result, an expression evaluator that works with the Visual Studio debug engines must support the CLR (a complete list of all CLR debugging interfaces can be found in debugref.doc, which is part of the Windows Software Development Kit (SDK)).

Debugger Components

Show: