IDebugHostField::GetLocationKind 方法 (dbgmodel.h)
GetLocationKind 方法根据 LocationKind 枚举返回符号所在的位置类型。 此类枚举可以是以下值之一:
枚举 | 意义 |
---|---|
LocationMember | 该字段是类、结构、联合或其他类型构造的常规数据成员。 它具有相对于包含类型构造的基址的偏移量。 此类基址通常由此指针表示。 可以通过 GetOffset 方法检索字段的偏移量。 对于 LocationMember 的字段,GetLocation 和 GetValue 方法将失败。 |
LocationStatic | 该字段是静态的,具有自己的地址。 GetLocation 方法将返回静态字段的抽象位置(例如:address)。 对于 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...)
}
要求
要求 | 价值 |
---|---|
标头 | dbgmodel.h |