BP_LOCATION
指定用來描述,中斷點的位置的結構的型別。
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 + +]Contains the BP_LOCATION_CODE_FILE_LINE structure if bpLocationType = BPLT_CODE_FILE_LINE.bpLocation.bplocCodeFuncOffset
[只有 c + +]Contains the BP_LOCATION_CODE_FUNC_OFFSET structure if bpLocationType = BPLT_CODE_FUNC_OFFSET.bpLocation.bplocCodeContext
[只有 c + +]Contains the BP_LOCATION_CODE_CONTEXT structure if bpLocationType = BPLT_CODE_CONTEXT.bpLocation.bplocCodeString
[只有 c + +]Contains the BP_LOCATION_CODE_STRING structure if bpLocationType = BPLT_CODE_STRING.bpLocation.bplocCodeAddress
[只有 c + +]Contains the BP_LOCATION_CODE_ADDRESS structure if bpLocationType = BPLT_CODE_ADDRESS.bpLocation.bplocDataString
[只有 c + +]Contains the BP_LOCATION_DATA_STRING structure if bpLocationType = BPLT_DATA_STRING.bpLocation.bplocResolution
[只有 c + +]Contains the BP_LOCATION_RESOLUTION structure if 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(內容) |
- |
- |
|
BPLT_CODE_FUNC_OFFSET |
string(內容) |
- |
- |
|
BPLT_CODE_CONTEXT |
- |
- |
- |
|
BPLT_CODE_STRING |
string(內容) |
string(條件式運算式) |
- |
- |
BPLT_CODE_ADDRESS |
string(內容) |
string(模組 URL) |
string(函式名稱) |
string(位址) |
BPLT_DATA_STRING |
string(內容) |
string(資料的運算式) |
uint(項目數目) |
|
BPLT_RESOLUTION |
- |
- |
- |
範例
這個範例會示範如何解譯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
Namespace: Microsoft.VisualStudio.Debugger.Interop
組件: Microsoft.VisualStudio.Debugger.Interop.dll