IDebugHostField::GetLocationKind 方法 (dbgmodel.h)

GetLocationKind 方法根据 LocationKind 枚举返回符号所在的位置类型。 此类枚举可以是以下值之一:

枚举 含义
LocationMember 字段是类、结构、联合或其他类型构造的常规数据成员。 它具有相对于包含类型构造的基址的偏移量。 此类基址通常由此指针表示。 可以通过 GetOffset 方法检索字段的偏移量。 对于 LocationMember 字段,GetLocation 和 GetValue 方法将失败。
LocationStatic 字段是静态的,并且具有自己的地址。 GetLocation 方法将返回抽象位置 (例如静态字段的地址) 。 对于 LocationStatic 字段,GetOffset 和 GetValue 方法将失败。
LocationConstant 字段是一个常量,并且具有值。 GetValue 方法将返回常量的值。 对于 LocationConstant 字段,GetOffset 和 GetLocation 方法将失败
LocationNone 字段没有位置。 它可能已由编译器优化,也可能是声明但从未定义的静态字段。 无论这种领域是如何出现,它都没有物理存在或价值。 它仅在符号中。 对于 LocationNone 字段, (GetOffset、GetLocation 和 GetValue) 的所有获取方法都将失败。

语法

HRESULT GetLocationKind(
  LocationKind *locationKind
);

参数

locationKind

此字段的位置类型将在此处作为 LocationKind 枚举的值返回。

返回值

此方法返回指示成功或失败的 HRESULT。

注解

示例代码

ComPtr<IDebugHostField> spField; /* get a field symbol */

LocationKind kind;
if (SUCCEEDED(spField->GetLocationKind(&kind)))
{
    // kind indicates the kind of location (e.g.: static, constant, member, etc...)
}

要求

要求
Header dbgmodel.h

另请参阅

IDebugHostField 接口