DEBUG_ADDRESS_UNION
說明不同類型的地址。
typedef struct _tagDEBUG_ADDRESS_UNION {
ADDRESS_KIND dwKind;
union {
NATIVE_ADDRESS addrNative;
UNMANAGED_ADDRESS_THIS_RELATIVE addrThisRel;
UNMANAGED_ADDRESS_PHYSICAL addrUPhysical;
METADATA_ADDRESS_METHOD addrMethod;
METADATA_ADDRESS_FIELD addrField;
METADATA_ADDRESS_LOCAL addrLocal;
METADATA_ADDRESS_PARAM addrParam;
METADATA_ADDRESS_ARRAYELEM addrArrayElem;
METADATA_ADDRESS_RETVAL addrRetVal;
DWORD unused;
} addr;
} DEBUG_ADDRESS_UNION;
public struct DEBUG_ADDRESS_UNION {
public ADDRESS_KIND dwKind;
public IntPtr unionmember;
}
詞彙
dwKind
介於ADDRESS_KIND列舉型別,指定如何解譯聯集。addr.addrNative
[只有 c + +]包含NATIVE_ADDRESS結構,如果dwKind = ADDRESS_KIND_NATIVE。addr.addrThisRel
[只有 c + +]包含UNMANAGED_ADDRESS_THIS_RELATIVE結構,如果dwKind = ADDRESS_KIND_UNMANAGED_THIS_RELATIVE。addr.addUPhysical
[只有 c + +]包含UNMANAGED_ADDRESS_PHYSICAL結構,如果dwKind = ADDRESS_KIND_UNMANAGED_PHYSICAL。addr.addrMethod
[只有 c + +]包含METADATA_ADDRESS_METHOD結構,如果dwKind = ADDRESS_KIND_METHOD。addr.addrField
[只有 c + +]包含METADATA_ADDRESS_FIELD結構,如果dwKind = ADDRESS_KIND_FIELD。addr.addrLocal
[只有 c + +]包含METADATA_ADDRESS_LOCAL結構,如果dwKind = ADDRESS_KIND_LOCAL。addr.addrParam
[只有 c + +]包含METADATA_ADDRESS_PARAM結構,如果dwKind = ADDRESS_KIND_PARAM。addr.addrArrayElem
[只有 c + +]包含METADATA_ADDRESS_ARRAYELEM結構,如果dwKind = ADDRESS_KIND_ARRAYELEM。addr.addrRetVal
[只有 c + +]包含METADATA_ADDRESS_RETVAL結構,如果dwKind = ADDRESS_KIND_RETVAL。addr.unused
[只有 c + +] 與邊框距離。地址
[只有 c + +]聯集的名稱。unionmember
[C# 只]這個值必須為基礎的適當的結構類型來封送處理dwKind。 如之間的關聯,請參閱 「 備註 」 dwKind和轉譯的聯集。
備註
在這種結構屬於DEBUG_ADDRESS架構,表示其中一個為數種不同類型的地址 ( DEBUG_ADDRESS結構會填入由呼叫IDebugAddress::GetAddress方法)。
[C# 只]下表顯示如何解譯unionmember每一類型的地址的成員。 此範例顯示如何這麼做是一種地址。
dwKind |
unionmember解譯為 |
---|---|
ADDRESS_KIND_NATIVE |
|
ADDRESS_KIND_UNMANAGED_THIS_RELATIVE |
|
ADDRESS_KIND_UNMANAGED_PHYSICAL |
|
ADDRESS_KIND_METHOD |
|
ADDRESS_KIND_FIELD |
|
ADDRESS_KIND_LOCAL |
|
ADDRESS_KIND_PARAM |
|
ADDRESS_KIND_ARRAYELEM |
|
ADDRESS_KIND_RETVAL |
範例
這個範例會示範如何解譯其中一種地址 (METADATA_ADDRESS_ARRAYELEM) 的DEBUG_ADDRESS_UNION C# 中的結構。 其餘的項目可以解譯方式完全相同。
using System;
using System.Runtime.Interop.Services;
using Microsoft.VisualStudio.Debugger.Interop;
namespace MyPackage
{
public class MyClass
{
public void Interpret(DEBUG_ADDRESS_UNION dau)
{
if (dau.dwKind == (uint)enum_ADDRESS_KIND.ADDRESS_KIND_METADATA_ARRAYELEM)
{
METADATA_ADDRESS_ARRAYELEM arrayElem =
(METADATA_ADDRESS_ARRAYELEM)Marshal.PtrToStructure(dau.unionmember,
typeof(METADATA_ADDRESS_ARRAYELEM));
}
}
}
}
需求
標頭: sh.h
Namespace: Microsoft.VisualStudio.Debugger.Interop
組件: Microsoft.VisualStudio.Debugger.Interop.dll