Debugging Tools for Windows

Evaluate

The Evaluate and EvaluateWide methods evaluate an expression, returning the result.

HRESULT
  IDebugControl::Evaluate(
    IN PCSTR  Expression
    IN ULONG  DesiredType
    OUT PDEBUG_VALUE  Value
    OUT OPTIONAL PULONG  RemainderIndex
    );

HRESULT
  IDebugControl4::EvaluateWide(
    IN PCWSTR  Expression,
    IN ULONG  DesiredType,
    OUT PDEBUG_VALUE  Value,
    OUT OPTIONAL PULONG  RemainderIndex
    );

#ifdef UNICODE
#define EvaluateT EvaluateWide
#else
#define EvaluateT Evaluate
#endif

Parameters

Expression
Specifies the expression to be evaluated.
DesiredType
Specifies the desired return type. Possible values are described in DEBUG_VALUE; with the addition of DEBUG_VALUE_INVALID, which indicates that the return type should be the expression's natural type.
Value
Receives the value of the expression.
RemainderIndex
Receives the index of the first character of the expression not used in the evaluation. If RemainderIndex is NULL, this information isn't returned.

Return Value

S_OK
The method was successful.
E_FAIL
An error occurred while evaluating the expression. For example, there was a syntax error, an undefined variable, or a division by zero exception.

This method may also return other error values. See Return Values for more details.

Interface Version

Evaluate is available in all versions of IDebugControl. EvaluateWide is available in IDebugControl4 and later versions.

Comments

Expressions are evaluated by the current expression evaluator. The engine contains multiple expression evaluators; each supports a different syntax. The current expression evaluator can be chosen by using SetExpressionSyntax.

For details of the available expression evaluators and their syntaxes, see Numerical Expression Syntax.

If an error occurs while evaluating the expression, returning E_FAIL, the RemainderIndex variable can be used to determine approximately where in the expression the error occurred.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h.

See Also

GetExpressionSyntax, SetExpressionSyntax, SetExpressionSyntaxByName

Build machine: CAPEBUILD