Jaa


DEBUG_ADDRESS_UNION

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Describes different kinds of addresses.

Syntax

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;
}

Members

dwKind
A value from the ADDRESS_KIND enumeration, specifying how to interpret the union.

addr.addrNative
[C++ only] Contains the NATIVE_ADDRESS structure if dwKind = ADDRESS_KIND_NATIVE.

addr.addrThisRel
[C++ only] Contains theUNMANAGED_ADDRESS_THIS_RELATIVE structure if dwKind = ADDRESS_KIND_UNMANAGED_THIS_RELATIVE.

addr.addUPhysical
[C++ only] Contains theUNMANAGED_ADDRESS_PHYSICAL structure if dwKind = ADDRESS_KIND_UNMANAGED_PHYSICAL.

addr.addrMethod
[C++ only] Contains theMETADATA_ADDRESS_METHOD structure if dwKind = ADDRESS_KIND_METHOD.

addr.addrField
[C++ only] Contains theMETADATA_ADDRESS_FIELD structure if dwKind = ADDRESS_KIND_FIELD.

addr.addrLocal
[C++ only] Contains theMETADATA_ADDRESS_LOCAL structure if dwKind = ADDRESS_KIND_LOCAL.

addr.addrParam
[C++ only] Contains theMETADATA_ADDRESS_PARAM structure if dwKind = ADDRESS_KIND_PARAM.

addr.addrArrayElem
[C++ only] Contains theMETADATA_ADDRESS_ARRAYELEM structure if dwKind = ADDRESS_KIND_ARRAYELEM.

addr.addrRetVal
[C++ only] Contains theMETADATA_ADDRESS_RETVAL structure if dwKind = ADDRESS_KIND_RETVAL.

addr.unused
[C++ only] padding.

addr
[C++ only] The name of the union.

unionmember
[C# only] This value needs to be marshaled to the appropriate structure type based on dwKind. See Remarks for the association between dwKind and interpretation of the union.

Remarks

This structure is part of the DEBUG_ADDRESS structure and represents one of a number of different kinds of addresses (the DEBUG_ADDRESS structure is filled in by a call to the GetAddress method).

[C# only] The following table shows how to interpret the unionmember member for each kind of address. The Example shows how this is done for one kind of address.

dwKind unionmember interpreted as
ADDRESS_KIND_NATIVE NATIVE_ADDRESS
ADDRESS_KIND_UNMANAGED_THIS_RELATIVE UNMANAGED_ADDRESS_THIS_RELATIVE
ADDRESS_KIND_UNMANAGED_PHYSICAL UNMANAGED_ADDRESS_PHYSICAL
ADDRESS_KIND_METHOD METADATA_ADDRESS_METHOD
ADDRESS_KIND_FIELD METADATA_ADDRESS_FIELD
ADDRESS_KIND_LOCAL METADATA_ADDRESS_LOCAL
ADDRESS_KIND_PARAM METADATA_ADDRESS_PARAM
ADDRESS_KIND_ARRAYELEM METADATA_ADDRESS_ARRAYELEM
ADDRESS_KIND_RETVAL METADATA_ADDRESS_RETVAL

Example

This example shows how to interpret one kind of address (METADATA_ADDRESS_ARRAYELEM) of the DEBUG_ADDRESS_UNION structure in C#. The remaining elements can be interpreted in exactly the same way.

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));
            }
        }
    }
}

Requirements

Header: sh.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also