Skip to content

Native Expression Evaluators

Patrick Nelson edited this page Sep 10, 2015 · 2 revisions

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.

Native EE Diagram

Sequence of a watch expression for the expression evaluator of a native language:

  1. User types a new expression in the watch window and hits enter
  2. A new DkmLanguageExpression object is created
  3. The debugger selects an expression evaluator to use. This is generally based on the language of the stack frame being examined.
  4. The expression evaluator is asked to evaluate the expression using IDkmLanguageExpressionEvalutor.EvaluateExpression
  5. Note: This is called through a work list, so the expression evaluator must call the completion routine when it is complete
  6. 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
  7. The DkmIL is passed to the Native Debug Monitor by the expression evaluator to obtain the raw result
  8. If the DkmIL executes without issue, values from the stack are returned to the expression evaluator.
  9. 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
  10. The formatted expression result is extracted displayed to the user.
Clone this wiki locally