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 themethod 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 . If the call succeeds, the IDebugExpressionEvaluator::GetMethodProperty method returns an object, which represents the method that contains the current execution address.
The DE callsto get an object, which is filtered to return only locals and enumerated to produce a list of 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.
The QuickWatch and Watch windows also display variables with the same format of name, value, and type. However, those values are obtained by callinginstead of IDebugProperty2::EnumChildren.
In This Section
Uses examples to step through the process of implementing locals.