BP_LOCATION
如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件。
指定用來描述之中斷點的位置的結構類型。
語法
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
介於BP_LOCATION_TYPE列舉用來解譯bpLocation
等位或unionmemberX
成員。
bpLocation
.bplocCodeFileLine
[只有 c + +]包含BP_LOCATION_CODE_FILE_LINE結構如果bpLocationType
= BPLT_CODE_FILE_LINE
。
bpLocation.bplocCodeFuncOffset
[只有 c + +]包含BP_LOCATION_CODE_FUNC_OFFSET結構如果bpLocationType
= BPLT_CODE_FUNC_OFFSET
。
bpLocation.bplocCodeContext
[只有 c + +]包含BP_LOCATION_CODE_CONTEXT結構如果bpLocationType
= BPLT_CODE_CONTEXT
。
bpLocation.bplocCodeString
[只有 c + +]包含BP_LOCATION_CODE_STRING結構如果bpLocationType
= BPLT_CODE_STRING
。
bpLocation.bplocCodeAddress
[只有 c + +]包含BP_LOCATION_CODE_ADDRESS結構如果bpLocationType
= BPLT_CODE_ADDRESS
。
bpLocation.bplocDataString
[只有 c + +]包含BP_LOCATION_DATA_STRING結構如果bpLocationType
= BPLT_DATA_STRING
。
bpLocation.bplocResolution
[只有 c + +]包含BP_LOCATION_RESOLUTION結構如果bpLocationType
= BPLT_RESOLUTION
。
unionmember1
[僅限 C#]請參閱 < 備註 >,有關如何解譯。
unionmember2
[僅限 C#]請參閱 < 備註 >,有關如何解譯。
unionmember3
[僅限 C#]請參閱 < 備註 >,有關如何解譯。
unionmember4
[僅限 C#]請參閱 < 備註 >,有關如何解譯。
備註
此結構是屬於BP_REQUEST_INFO和BP_REQUEST_INFO2結構。
[僅限 C#]unionmemberX
成員會根據下表來解譯。 往下的左欄bpLocationType
值,然後觀察內其他資料行來判斷每個unionmemberX
成員表示和封送處理unionmemberX
據此。 請參閱範例的方式來解譯此結構在 C# 中的一部分。
bpLocationType |
unionmember1 |
unionmember2 |
unionmember3 |
unionmember4 |
---|---|---|---|---|
BPLT_CODE_FILE_LINE |
string (內容) |
IDebugDocumentPosition2 | - | - |
BPLT_CODE_FUNC_OFFSET |
string (內容) |
IDebugFunctionPosition2 | - | - |
BPLT_CODE_CONTEXT |
IDebugCodeContext2 | - | - | - |
BPLT_CODE_STRING |
string (內容) |
string (條件式運算式) |
- | - |
BPLT_CODE_ADDRESS |
string (內容) |
string (模組 URL) |
string (函式名稱) |
string (位址) |
BPLT_DATA_STRING |
IDebugThread2 | string (內容) |
string (資料運算式) |
uint (數字的項目) |
BPLT_RESOLUTION |
IDebugBreakpointResolution2 | - | - | - |
範例
這個範例示範如何解譯BP_LOCATION
結構中的 C#BPLT_DATA_STRING
型別。 此特定的型別會顯示如何解譯這四種unionmemberX
中所有可能的格式 (物件、 字串和數字) 的成員。
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);
}
}
}
}
需求
標頭︰ msdbg.h
命名空間︰ Microsoft.VisualStudio.Debugger.Interop
組件︰ Microsoft.VisualStudio.Debugger.Interop.dll
另請參閱
結構和等位
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