Partager via


Expression Evaluator Implementation Strategy

One approach to rapidly creating an expression evaluator (EE) is to first implement the minimum code necessary to display local variables in the Locals window. It is useful to realize that each line in the Locals window displays the name, type, and value of a local variable, and that all three are represented by an IDebugProperty2 object. The name, type, and value of a local variable can be obtained from an IDebugProperty2 object by calling its IDebugProperty2::GetPropertyInfo method. For more information about how to display local variables in the Locals window, see Displaying Locals.

Discussion

A possible implementation sequence starts with implementing IDebugExpressionEvaluator. The IDebugExpressionEvaluator::Parse and the IDebugExpressionEvaluator::GetMethodProperty methods need to be implemented to display locals. Calling IDebugExpressionEvaluator::GetMethodProperty returns an IDebugProperty2 object that represents a method: that is, an IDebugMethodField object. Methods themselves are not displayed in the Locals window.

The IDebugProperty2::EnumChildren method should be implemented next. The debug engine (DE) calls this method to get a list of local variables and arguments by passing IDebugProperty2::EnumChildren a guidFilter argument of guidFilterLocalsPlusArgs. IDebugProperty2::EnumChildren calls IDebugMethodField::EnumArguments and IDebugMethodField::EnumLocals, combining the results in a single enumeration. See Displaying Locals for more details.

See Also

Other Resources

Implementing an Expression Evaluator

Displaying Locals