다음을 통해 공유


Displaying Locals

Execution always takes place within the context of a method, also known as the containing method or current method. When execution pauses, Visual Studio calls the debug engine (DE) to get a list of local variables and arguments, collectively called the locals of the method. Visual Studio displays these locals and their values in the Locals window.

To display locals, the DE calls the IDebugExpressionEvaluator::GetMethodProperty method belonging to the EE and gives it an evaluation context, that is, a symbol provider (SP), the current execution address, and a binder object. For more information, see Evaluation Context. If the call succeeds, the IDebugExpressionEvaluator::GetMethodProperty method returns an IDebugProperty2 object, which represents the method that contains the current execution address.

The DE calls IDebugProperty2::EnumChildren to get an IEnumDebugPropertyInfo2 object, which is filtered to return only locals and enumerated to produce a list of DEBUG_PROPERTY_INFO structures. Each structure contains the name, type, and value of a local. The type and value are stored as formatted strings, suitable for display. The name, type, and value are typically displayed together in one line of the Locals window.

Note

The QuickWatch and Watch windows also display variables with the same format of name, value, and type. However, those values are obtained by calling IDebugProperty2::GetPropertyInfo instead of IDebugProperty2::EnumChildren.

In This Section

  • Evaluation Context
    Explains that when the debug engine (DE) calls the expression evaluator (EE), it passes three arguments.

See Also

Other Resources

Writing a Common Language Runtime Expression Evaluator