共用方式為


BP_RESOLUTION_LOCATION

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

Specifies the structure of the breakpoint resolution location.

Syntax

struct _BP_RESOLUTION_LOCATION {
    BP_TYPE bpType;
    union {
        BP_RESOLUTION_CODE bpresCode;
        BP_RESOLUTION_DATA bpresData;
        int                unused;
    } bpResLocation;
} BP_RESOLUTION_LOCATION;
public struct BP_RESOLUTION_LOCATION {
    public uint   bpType;
    public IntPtr unionmember1;
    public IntPtr unionmember2;
    public IntPtr unionmember3;
    public uint   unionmember4;
};

Members

bpType
A value from the BP_TYPE enumeration that specifies how to interpret the bpResLocation union or unionmemberX members.

bpResLocation.bpresCode
[C++ only] Contains the BP_RESOLUTION_CODE structure if bpType = BPT_CODE.

bpResLocation.bpresData
[C++ only] Contains the BP_RESOLUTION_DATA structure if bpType = BPT_DATA.

bpResLocation.unused
[C++ only] A placeholder.

unionmember1
[C# only] See Remarks on how to interpret.

unionmember2
[C# only] See Remarks on how to interpret.

unionmember3
[C# only] See Remarks on how to interpret.

unionmember4
[C# only] See Remarks on how to interpret.

Remarks

This structure is a member of the BP_ERROR_RESOLUTION_INFO and BP_RESOLUTION_INFO structures.

[C# only] The unionmemberX members are interpreted according to the following table. Look down the left column for the bpType value then across to determine what each unionmemberX member represents and marshal the unionmemberX accordingly. See the Example for a way to interpret this structure in C#.

bpLocationType unionmember1 unionmember2 unionmember3 unionmember4
BPT_CODE IDebugCodeContext2 - - -
BPT_DATA string (data expression) string (function name) string (image name) enum_BP_RES_DATA_FLAGS

Example

This example shows how to interpret the BP_RESOLUTION_LOCATION structure in C#.

using System;
using System.Runtime.Interop.Services;
using Microsoft.VisualStudio.Debugger.Interop;

namespace MyPackage
{
    public class MyClass
    {
        public void Interpret(BP_RESOLUTION_LOCATION bprl)
        {
            if (bprl.bpType == (uint)enum_BP_TYPE.BPT_CODE)
            {
                IDebugCodeContext2 pContext = (IDebugCodeContext2)Marshal.GetObjectForIUnknown(bp.unionmember1);
            }
            else if (bprl.bpType == (uint)enum_BP_TYPE.BPT_DATA)
            {
                string dataExpression = Marshal.PtrToStringBSTR(bp.unionmember3);
                string functionName = Marshal.PtrToStringBSTR(bp.unionmember2);
                string imageName = Marshal.PtrToStringBSTR(bp.unionmember3);
                enum_BP_RES_DATA_FLAGS numElements = (enum_BP_RES_DATA_FLAGS)bp.unionmember4;
            }
        }
    }
}

Requirements

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also