Skip to content

Commit 55f5fd8

Browse files
committed
add support for instruction breakpoints
1 parent 57e4241 commit 55f5fd8

File tree

2 files changed

+151
-4
lines changed

2 files changed

+151
-4
lines changed

debugProtocol.json

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
"reason": {
194194
"type": "string",
195195
"description": "The reason for the event.\nFor backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated).",
196-
"_enum": [ "step", "breakpoint", "exception", "pause", "entry", "goto", "function breakpoint", "data breakpoint" ]
196+
"_enum": [ "step", "breakpoint", "exception", "pause", "entry", "goto", "function breakpoint", "data breakpoint", "instruction breakpoint" ]
197197
},
198198
"description": {
199199
"type": "string",
@@ -1356,6 +1356,63 @@
13561356
}]
13571357
},
13581358

1359+
"SetInstructionBreakpointsRequest": {
1360+
"allOf": [
1361+
{ "$ref": "#/definitions/Request" },
1362+
{
1363+
"type": "object",
1364+
"description": "Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a diassembly window. \nTo clear all instruction breakpoints, specify an empty array.\nWhen an instruction breakpoint is hit, a 'stopped' event (with reason 'instruction breakpoint') is generated.\nClients should only call this request if the capability 'supportsInstructionBreakpoints' is true.",
1365+
"properties": {
1366+
"command": {
1367+
"type": "string",
1368+
"enum": [ "setInstructionBreakpoints" ]
1369+
},
1370+
"arguments": {
1371+
"$ref": "#/definitions/SetInstructionBreakpointsArguments"
1372+
}
1373+
},
1374+
"required": [ "command", "arguments" ]
1375+
}]
1376+
},
1377+
"SetInstructionBreakpointsArguments": {
1378+
"type": "object",
1379+
"description": "Arguments for 'setInstructionBreakpoints' request",
1380+
"properties": {
1381+
"breakpoints": {
1382+
"type": "array",
1383+
"items": {
1384+
"$ref": "#/definitions/InstructionBreakpoint"
1385+
},
1386+
"description": "The instruction references of the breakpoints"
1387+
}
1388+
},
1389+
"required": ["breakpoints"]
1390+
},
1391+
"SetInstructionBreakpointsResponse": {
1392+
"allOf": [
1393+
{ "$ref": "#/definitions/Response" },
1394+
{
1395+
"type": "object",
1396+
"description": "Response to 'setInstructionBreakpoints' request",
1397+
"properties": {
1398+
"body": {
1399+
"type": "object",
1400+
"properties": {
1401+
"breakpoints": {
1402+
"type": "array",
1403+
"items": {
1404+
"$ref": "#/definitions/Breakpoint"
1405+
},
1406+
"description": "Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array."
1407+
}
1408+
},
1409+
"required": [ "breakpoints" ]
1410+
}
1411+
},
1412+
"required": [ "body" ]
1413+
}]
1414+
},
1415+
13591416
"ContinueRequest": {
13601417
"allOf": [ { "$ref": "#/definitions/Request" }, {
13611418
"type": "object",
@@ -2860,6 +2917,10 @@
28602917
"supportsSteppingGranularity": {
28612918
"type": "boolean",
28622919
"description": "The debug adapter supports stepping granularities (argument 'granularity') for the stepping requests."
2920+
},
2921+
"supportsInstructionBreakpoints": {
2922+
"type": "boolean",
2923+
"description": "The debug adapter supports adding breakpoints based on instruction references."
28632924
}
28642925
}
28652926
},
@@ -3377,9 +3438,33 @@
33773438
"required": [ "dataId" ]
33783439
},
33793440

3441+
"InstructionBreakpoint": {
3442+
"type": "object",
3443+
"description": "Properties of a breakpoint passed to the setInstructionBreakpoints request",
3444+
"properties": {
3445+
"instructionReference": {
3446+
"type": "string",
3447+
"description": "The instruction reference of the breakpoint.\nThis should be a memory or instruction pointer reference from an EvaluateResponse, Variable, StackFrame, GotoTarget, or Breakpoint."
3448+
},
3449+
"offset": {
3450+
"type": "integer",
3451+
"description": "An optional offset from the instruction reference.\nThis can be negative."
3452+
},
3453+
"condition": {
3454+
"type": "string",
3455+
"description": "An optional expression for conditional breakpoints.\nIt is only honored by a debug adapter if the capability 'supportsConditionalBreakpoints' is true."
3456+
},
3457+
"hitCondition": {
3458+
"type": "string",
3459+
"description": "An optional expression that controls how many hits of the breakpoint are ignored.\nThe backend is expected to interpret the expression as needed.\nThe attribute is only honored by a debug adapter if the capability 'supportsHitConditionalBreakpoints' is true."
3460+
}
3461+
},
3462+
"required": [ "instructionReference" ]
3463+
},
3464+
33803465
"Breakpoint": {
33813466
"type": "object",
3382-
"description": "Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints.",
3467+
"description": "Information about a Breakpoint created in setBreakpoints, setFunctionBreakpoints, setInstructionBreakpoints, or setDataBreakpoints.",
33833468
"properties": {
33843469
"id": {
33853470
"type": "integer",
@@ -3412,6 +3497,14 @@
34123497
"endColumn": {
34133498
"type": "integer",
34143499
"description": "An optional end column of the actual range covered by the breakpoint.\nIf no end line is given, then the end column is assumed to be in the start line."
3500+
},
3501+
"instructionReference": {
3502+
"type": "string",
3503+
"description": "An optional memory reference to where the breakpoint is set."
3504+
},
3505+
"offset": {
3506+
"type": "integer",
3507+
"description": "An optional offset from the instruction reference.\nThis can be negative."
34153508
}
34163509
},
34173510
"required": [ "verified" ]

protocol/src/debugProtocol.ts

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export module DebugProtocol {
128128
body: {
129129
/** The reason for the event.
130130
For backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated).
131-
Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', etc.
131+
Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', 'instruction breakpoint', etc.
132132
*/
133133
reason: string;
134134
/** The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and must be translated. */
@@ -766,6 +766,31 @@ export module DebugProtocol {
766766
};
767767
}
768768

769+
/** SetInstructionBreakpoints request; value of command field is 'setInstructionBreakpoints'.
770+
Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a diassembly window.
771+
To clear all instruction breakpoints, specify an empty array.
772+
When an instruction breakpoint is hit, a 'stopped' event (with reason 'instruction breakpoint') is generated.
773+
Clients should only call this request if the capability 'supportsInstructionBreakpoints' is true.
774+
*/
775+
export interface SetInstructionBreakpointsRequest extends Request {
776+
// command: 'setInstructionBreakpoints';
777+
arguments: SetInstructionBreakpointsArguments;
778+
}
779+
780+
/** Arguments for 'setInstructionBreakpoints' request */
781+
export interface SetInstructionBreakpointsArguments {
782+
/** The instruction references of the breakpoints */
783+
breakpoints: InstructionBreakpoint[];
784+
}
785+
786+
/** Response to 'setInstructionBreakpoints' request */
787+
export interface SetInstructionBreakpointsResponse extends Response {
788+
body: {
789+
/** Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. */
790+
breakpoints: Breakpoint[];
791+
};
792+
}
793+
769794
/** Continue request; value of command field is 'continue'.
770795
The request starts the debuggee to run again.
771796
*/
@@ -1571,6 +1596,8 @@ export module DebugProtocol {
15711596
supportsClipboardContext?: boolean;
15721597
/** The debug adapter supports stepping granularities (argument 'granularity') for the stepping requests. */
15731598
supportsSteppingGranularity?: boolean;
1599+
/** The debug adapter supports adding breakpoints based on instruction references. */
1600+
supportsInstructionBreakpoints?: boolean;
15741601
}
15751602

15761603
/** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */
@@ -1907,7 +1934,28 @@ export module DebugProtocol {
19071934
hitCondition?: string;
19081935
}
19091936

1910-
/** Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints. */
1937+
/** Properties of a breakpoint passed to the setInstructionBreakpoints request */
1938+
export interface InstructionBreakpoint {
1939+
/** The instruction reference of the breakpoint.
1940+
This should be a memory or instruction pointer reference from an EvaluateResponse, Variable, StackFrame, GotoTarget, or Breakpoint.
1941+
*/
1942+
instructionReference: string;
1943+
/** An optional offset from the instruction reference.
1944+
This can be negative.
1945+
*/
1946+
offset?: number;
1947+
/** An optional expression for conditional breakpoints.
1948+
It is only honored by a debug adapter if the capability 'supportsConditionalBreakpoints' is true.
1949+
*/
1950+
condition?: string;
1951+
/** An optional expression that controls how many hits of the breakpoint are ignored.
1952+
The backend is expected to interpret the expression as needed.
1953+
The attribute is only honored by a debug adapter if the capability 'supportsHitConditionalBreakpoints' is true.
1954+
*/
1955+
hitCondition?: string;
1956+
}
1957+
1958+
/** Information about a Breakpoint created in setBreakpoints, setFunctionBreakpoints, setInstructionBreakpoints, or setDataBreakpoints. */
19111959
export interface Breakpoint {
19121960
/** An optional identifier for the breakpoint. It is needed if breakpoint events are used to update or remove breakpoints. */
19131961
id?: number;
@@ -1929,6 +1977,12 @@ export module DebugProtocol {
19291977
If no end line is given, then the end column is assumed to be in the start line.
19301978
*/
19311979
endColumn?: number;
1980+
/** An optional memory reference to where the breakpoint is set. */
1981+
instructionReference?: string;
1982+
/** An optional offset from the instruction reference.
1983+
This can be negative.
1984+
*/
1985+
offset?: number;
19321986
}
19331987

19341988
/** The granularity of one 'step' in the stepping requests 'next', 'stepIn', 'stepOut', and 'stepBack'.

0 commit comments

Comments
 (0)