BP_LOCATION
指定用來描述斷點位置的結構類型。
語法
public struct BP_LOCATION {
public uint bpLocationType;
public IntPtr unionmember1;
public IntPtr unionmember2;
public IntPtr unionmember3;
public IntPtr unionmember4;
};
成員
bpLocationType
用來解譯bpLocation
等位或unionmemberX
成員之BP_LOCATION_TYPE列舉的值。
bpLocation
.bplocCodeFileLine
[僅限 C++]如果 = bpLocationType
BPLT_CODE_FILE_LINE
,則包含 BP_LOCATION_CODE_FILE_LINE 結構。
bpLocation.bplocCodeFuncOffset
[僅限 C++]如果 = bpLocationType
BPLT_CODE_FUNC_OFFSET
,則包含 BP_LOCATION_CODE_FUNC_OFFSET 結構。
bpLocation.bplocCodeContext
[僅限 C++]如果 = bpLocationType
BPLT_CODE_CONTEXT
,則包含 BP_LOCATION_CODE_CONTEXT 結構。
bpLocation.bplocCodeString
[僅限 C++]如果 = bpLocationType
BPLT_CODE_STRING
,則包含 BP_LOCATION_CODE_STRING 結構。
bpLocation.bplocCodeAddress
[僅限 C++]如果 = bpLocationType
BPLT_CODE_ADDRESS
,則包含 BP_LOCATION_CODE_ADDRESS 結構。
bpLocation.bplocDataString
[僅限 C++]如果 = bpLocationType
BPLT_DATA_STRING
,則包含 BP_LOCATION_DATA_STRING 結構。
bpLocation.bplocResolution
[僅限 C++]如果 = bpLocationType
BPLT_RESOLUTION
,則包含 BP_LOCATION_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 | - | - | - |
範例
此範例示範如何在 C# 中解譯 BP_LOCATION
型別的結構 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