Native Expression Evaluators - microsoft/ConcordExtensibilitySamples GitHub Wiki
Workflow
To demonstrate how expression evaluators work, this section walks through what happens when the user enters text in the watch window using an expression evaluator for a language which compiles to native code.
Sequence of a watch expression for the expression evaluator of a native language:
- User types a new expression in the watch window and hits enter
- A new DkmLanguageExpression object is created
- The debugger selects an expression evaluator to use. This is generally based on the language of the stack frame being examined.
- The expression evaluator is asked to evaluate the expression using
IDkmLanguageExpressionEvalutor.EvaluateExpression
- Note: This is called through a work list, so the expression evaluator must call the completion routine when it is complete
- The expression evaluator should generate a collection of Native Intermediate Instructions that describe how to calculate the result value. This is a stack based machine that can read memory values, read registers, and do arithmetic with a single round trip across the network
- The DkmIL is passed to the Native Debug Monitor by the expression evaluator to obtain the raw result
- If the DkmIL executes without issue, values from the stack are returned to the expression evaluator.
- The expression evaluator formats the result expression as a string and returns it as an instance of
DkmEvaluationResult
to the completion routine from the worklist - The formatted expression result is extracted displayed to the user.