这是概述 Visual Studio 如何获取一个方法的本地从表达式计算器 (EE):
Visual Studio 调用调试引擎的 (DE) IDebugStackFrame2:: GetDebugProperty 获取表示堆栈帧的所有属性的一 IDebugProperty2 对象,包括本地。
IDebugStackFrame2::GetDebugProperty 调用 IDebugExpressionEvaluator:: GetMethodProperty 获取描述方法在断点发生的对象。 DE 提供一个符号提供程序 (IDebugSymbolProvider),一个地址 (IDebugAddress) 和一个编程序 (IDebugBinder)。
IDebugExpressionEvaluator::GetMethodProperty 来调用所提供的 IDebugAddress 对象访问的 IDebugSymbolProvider:: GetContainerField 表示方法的 IDebugContainerField 包含指定的地址。
IDebugContainerField 接口。 IDebugMethodField 接口中查询。 它是允许对方法的本地的访问此接口。
IDebugExpressionEvaluator::GetMethodProperty 实例化类 (称为示例中的 CFieldProperty ) 实现 IDebugProperty2 接口表示方法的情况。 IDebugMethodField 对象该 CFieldProperty 对象放置一 IDebugSymbolProvider、 IDebugAddress 和 IDebugBinder 对象。
当 CFieldProperty 对象初始化时, IDebugField:: GetInfo 调用获取包含有关该方法的所有可显示的信息的 FIELD_INFO 结构的 IDebugMethodField 对象。
IDebugExpressionEvaluator::GetMethodProperty 返回 CFieldProperty 对象作为 IDebugProperty2 对象。
Visual Studio 调用返回的 IDebugProperty2 对象的 IDebugProperty2:: EnumChildren 用筛选器 guidFilterLocalsPlusArgs。 这将返回包含方法的本地的 IEnumDebugPropertyInfo2 对象。 此枚举填充调用 IDebugMethodField:: EnumLocals 和 IDebugMethodField:: EnumArguments。
Visual Studio IEnumDebugPropertyInfo2:: 接下来 调用获取每本地的一 DEBUG_PROPERTY_INFO 结构。 此结构包含指向本地的一 IDebugProperty2 接口。
Visual Studio 为每个本地的 IDebugProperty2:: GetPropertyInfo 可以获取本地的名称、值和类型。 这是在 本地 窗口中显示的信息。
本节内容
实现 GetMethodProperty
描述 IDebugExpressionEvaluator:: GetMethodProperty的实现。枚举本地
描述调试引擎 (DE)如何仅仅是枚举局部变量或参数。获取本地属性
描述、如何使调用以获取名称、类型和值一个或多个本地。获取本地值
讨论获取本地的值,需要计算上下文中给定的联编程序对象服务。计算的本地
解释本地如何计算。
相关章节
计算上下文
通过实参,在 DE 调用表达式计算器时 (EE)。MyCEE Sample
为创建 MyC 语言的一个表达式计算器演示一个实现方法。