Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Important
In Visual Studio 2015, this way of implementing expression evaluators is deprecated. For information about implementing CLR expression evaluators, please see CLR Expression Evaluators and Managed Expression Evaluator Sample.
Here is an overview of how Visual Studio obtains the locals for a method from the expression evaluator (EE):
Visual Studio calls the debug engine's (DE) GetDebugProperty to get an IDebugProperty2 object that represents all the properties of the stack frame, including the locals.
IDebugStackFrame2::GetDebugPropertycalls GetMethodProperty to obtain an object that describes the method within which the breakpoint occurred. The DE supplies a symbol provider (IDebugSymbolProvider), an address (IDebugAddress), and a binder (IDebugBinder).IDebugExpressionEvaluator::GetMethodPropertycalls GetContainerField with the suppliedIDebugAddressobject to get an IDebugContainerField representing the method containing the specified address.The
IDebugContainerFieldinterface is queried for the IDebugMethodField interface. It is this interface that gives access to the method's locals.IDebugExpressionEvaluator::GetMethodPropertyinstantiates a class (calledCFieldPropertyin the sample) that implements theIDebugProperty2interface to represent the method's locals. TheIDebugMethodFieldobject is placed in thisCFieldPropertyobject along with theIDebugSymbolProvider,IDebugAddressandIDebugBinderobjects.When the
CFieldPropertyobject is initialized, GetInfo is called on theIDebugMethodFieldobject to obtain a FIELD_INFO structure that contains all displayable information about the method itself.IDebugExpressionEvaluator::GetMethodPropertyreturns theCFieldPropertyobject as anIDebugProperty2object.Visual Studio calls EnumChildren on the returned
IDebugProperty2object with the filterguidFilterLocalsPlusArgs. This returns an IEnumDebugPropertyInfo2 object containing the method's locals. This enumeration is filled in by calls to EnumLocals and EnumArguments.Visual Studio calls Next to obtain a DEBUG_PROPERTY_INFO structure for each local. This structure contains a pointer to an
IDebugProperty2interface for a local.Visual Studio calls GetPropertyInfo for each local to obtain the local's name, value, and type. This is the information that is displayed in the Locals window.
In This Section
Implementing GetMethodProperty
Describes an implementation of GetMethodProperty.
Enumerating Locals
Describes how the debug engine (DE) makes a call to enumerate local variables or arguments.
Getting Local Properties
Describes how the DE makes a call to get the name, type, and value of one or more locals.
Getting Local Values
Discusses obtaining the value of the local, which requires the services of a binder object given by the evaluation context.
Evaluating Locals
Explains how locals are evaluated.
Related Sections
Evaluation Context
Provides the arguments that are passed when the DE calls the expression evaluator (EE).
MyCEE Sample
Demonstrates one implementation approach to creating an expression evaluator for the MyC language.