Partager via


BP_LOCATION

Specifies the type of structure used to describe the location of the breakpoint.

typedef struct _BP_LOCATION {
   BP_LOCATION_TYPE bpLocationType;
   union {
      BP_LOCATION_CODE_FILE_LINE   bplocCodeFileLine;
      BP_LOCATION_CODE_FUNC_OFFSET bplocCodeFuncOffset;
      BP_LOCATION_CODE_CONTEXT     bplocCodeContext;
      BP_LOCATION_CODE_STRING      bplocCodeString;
      BP_LOCATION_CODE_ADDRESS     bplocCodeAddress;
      BP_LOCATION_DATA_STRING      bplocDataString;
      BP_LOCATION_RESOLUTION       bplocResolution;
      DWORD                        unused;
   } bpLocation;
} BP_LOCATION;
public struct BP_LOCATION {
   public uint   bpLocationType;
   public IntPtr unionmember1;
   public IntPtr unionmember2;
   public IntPtr unionmember3;
   public IntPtr unionmember4;
};

Members

  • bpLocationType
    A value from the BP_LOCATION_TYPE enumeration used to interpret the bpLocation union or the unionmemberX members.

  • bpLocation.bplocCodeFileLine
    [C++ only] Contains the BP_LOCATION_CODE_FILE_LINE structure if bpLocationType = BPLT_CODE_FILE_LINE.

  • bpLocation.bplocCodeFuncOffset
    [C++ only] Contains the BP_LOCATION_CODE_FUNC_OFFSET structure if bpLocationType = BPLT_CODE_FUNC_OFFSET.

  • bpLocation.bplocCodeContext
    [C++ only] Contains the BP_LOCATION_CODE_CONTEXT structure if bpLocationType = BPLT_CODE_CONTEXT.

  • bpLocation.bplocCodeString
    [C++ only] Contains the BP_LOCATION_CODE_STRING structure if bpLocationType = BPLT_CODE_STRING.

  • bpLocation.bplocCodeAddress
    [C++ only] Contains the BP_LOCATION_CODE_ADDRESS structure if bpLocationType = BPLT_CODE_ADDRESS.

  • bpLocation.bplocDataString
    [C++ only] Contains the BP_LOCATION_DATA_STRING structure if bpLocationType = BPLT_DATA_STRING.

  • bpLocation.bplocResolution
    [C++ only] Contains the BP_LOCATION_RESOLUTION structure if bpLocationType = BPLT_RESOLUTION.

  • 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_REQUEST_INFO and BP_REQUEST_INFO2 structures.

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

bpLocationType

unionmember1

unionmember2

unionmember3

unionmember4

BPLT_CODE_FILE_LINE

string (a context)

IDebugDocumentPosition2

-

-

BPLT_CODE_FUNC_OFFSET

string (a context)

IDebugFunctionPosition2

-

-

BPLT_CODE_CONTEXT

IDebugCodeContext2

-

-

-

BPLT_CODE_STRING

string (a context)

string (conditional expression)

-

-

BPLT_CODE_ADDRESS

string (a context)

string (module URL)

string (function name)

string (address)

BPLT_DATA_STRING

IDebugThread2

string (a context)

string (data expression)

uint (number of elements)

BPLT_RESOLUTION

IDebugBreakpointResolution2

-

-

-

Example

This example shows how to interpret the BP_LOCATION structure in C# for the BPLT_DATA_STRING type. This particular type shows how to interpret all four unionmemberX members in all possible formats (object, string, and number).

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

namespace MyPackage
{
    public class MyClass
    {
        public void Interpret(BP_LOCATION bp)
        {
            if (bp.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING)
            {
                 IDebugThread2 pThread = (IDebugThread2)Marshal.GetObjectForIUnknown(bp.unionmember1);
                 string context = Marshal.PtrToStringBSTR(bp.unionmember2);
                 string dataExpression = Marshal.PtrToStringBSTR(bp.unionmember3);
                 uint numElements = (uint)Marshal.ReadInt32(bp.unionmember4);
            }
        }
    }
}

Requirements

Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See Also

Reference

Structures and Unions

BP_REQUEST_INFO

BP_LOCATION_CODE_FILE_LINE

BP_LOCATION_CODE_FUNC_OFFSET

BP_LOCATION_CODE_CONTEXT

BP_LOCATION_CODE_STRING

BP_LOCATION_CODE_ADDRESS

BP_LOCATION_DATA_STRING

BP_LOCATION_RESOLUTION