-
Notifications
You must be signed in to change notification settings - Fork 51
Expression Evaluators Overview
Expression Evaluators (EEs) are components which are typically implemented by compiler vendors. They allow users to debug in the same language as the code was written. They do this by flavoring various debugger windows, such as the Watch, Call stack, and Function breakpoints to the language of the code. Generally, expression evaluators and selected based on the language of the call stack frame being inspected.
An EE is responsible for performing the following tasks, which are broken down by the user scenarios in which these tasks get invoked. Interface method names are provided in parenthesis, and discussed in other sections of the wiki.
Given a stack frame and a set of flags that indicate the user’s options (whether to display the parameter types, values, etc.), compute a display string for the frame (IDkmLanguageInstructionDecoder.GetFrameName
).
Given the instruction address for a piece of code, obtain the formatted name for the function located at that address, in other words, the function column of the breakpoints window (IDkmLanguageInstructionDecoder.GetMethodName
).
Given a stack frame, obtain the list of local variables and their values for display in the Locals window (IDkmLanguageExpressionEvaluator.GetFrameLocals
for languages that compile to native code or IDkmClrExpressionCompiler.GetClrLocalVariableQuery
for .NET languages).
- Given a string of text that contains an expression to evaluate, evaluate the expression and obtain display strings for the value and type of the expression (
IDkmLanguageExpressionEvaluator.EvaluateExpression
for languages that compile to native code orIDkmClrExpressionCompiler.CompileExpression
for .NET languages). - For .NET languages, format the raw result into a value string (
IDkmClrFormatter.GetValueString
) and a type name string (IDkmClrFormatter.GetTypeName
). - Given a value, obtain a list of optional flags and attributes, such as whether the value is editable, represents a class, etc. Such attributes are used in the UI to display various special icons associated with the attributes.
- Given a value, obtain an “editable value” string. When you double-click on the value column to edit, this is the default text that appears.
- Assign a value to the result of another expression when the user types something in the value column and hits enter
- Given a value, obtain the list of child values to show when the value gets expanded (for native lanugages,
IDkmLanguageExpressionEvaluator.GetChildren
).
When binding a function breakpoint, parse the location text and obtain the code location that the user is referring to (IDkmRuntimeFunctionResolver.EnableResolution
)
Stack frame return types (IDkmLanguageInstructionDecoder.GetReturnType
) and arguments (for native languages, IDkmLanguageExpressionEvaluator.GetFrameArguments
).
If you have written a compiler and you want it to work seamlessly with the Visual Studio Debugger, you'll want to write an EE. If your compiler compiles down to native/machine code, look at the section Native Expression Evaluators. If your compiler targets .NET look at the section .NET Expression Evaluators.
Concord Documentation:
- Overview
- Visual Studio 2022 support
- Concord Architecture
- Getting troubleshooting logs
- Tips for debugging extensions
- Component Discovery and Configuration
- Component Levels
- Navigating the Concord API
- Obtaining the Concord API headers, libraries, etc
- Concord Threading Model
- Data Container API
- Creating and Closing Objects
- Expression Evaluators (EEs)
- .NET language EEs
- Native language EEs
- Installing Extensions
- Cross Platform and VS Code scenarios:
- Implementing components in native code:
- Worker Process Remoting
Samples: