Share via


Expression evaluation in break mode

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The following section describes the process that occurs when the debugger is in break mode and must conduct expression evaluation.

Expression evaluation process

Following are the basic steps involved in evaluating an expression:

  1. The session debug manager (SDM) calls IDebugStackFrame2::GetExpressionContext to get an expression context interface, IDebugExpressionContext2.

  2. The SDM then calls IDebugExpressionContext2::ParseText with the string to be parsed.

  3. If ParseText doesn't return S_OK, the reason for the error is returned.

    -otherwise-

    If ParseText does return S_OK, the SDM can then call either IDebugExpression2::EvaluateSync or IDebugExpression2::EvaluateAsync to get a final value from the parsed expression.

    • When using IDebugExpression2::EvaluateSync, the given callback interface communicates the ongoing process of the evaluation. The final value is returned in an IDebugProperty2 interface.

    • When using IDebugExpression2::EvaluateAsync, the given callback interface communicates the ongoing process of the evaluation. Once the evaluation is complete, EvaluateAsync sends an IDebugExpressionEvaluationCompleteEvent2 interface through the callback. With this event interface, the final value results with GetResult.

See also