Skip to content

Commit 57e4241

Browse files
committed
add support for stepping granularities
1 parent f8ef57e commit 57e4241

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

debugProtocol.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"StoppedEvent": {
182182
"allOf": [ { "$ref": "#/definitions/Event" }, {
183183
"type": "object",
184-
"description": "The event indicates that the execution of the debuggee has stopped due to some condition.\nThis can be caused by a break point previously set, a stepping action has completed, by executing a debugger statement etc.",
184+
"description": "The event indicates that the execution of the debuggee has stopped due to some condition.\nThis can be caused by a break point previously set, a stepping request has completed, by executing a debugger statement etc.",
185185
"properties": {
186186
"event": {
187187
"type": "string",
@@ -1425,6 +1425,10 @@
14251425
"threadId": {
14261426
"type": "integer",
14271427
"description": "Execute 'next' for this thread."
1428+
},
1429+
"granularity": {
1430+
"$ref": "#/definitions/SteppingGranularity",
1431+
"description": "Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed."
14281432
}
14291433
},
14301434
"required": [ "threadId" ]
@@ -1463,6 +1467,10 @@
14631467
"targetId": {
14641468
"type": "integer",
14651469
"description": "Optional id of the target to step into."
1470+
},
1471+
"granularity": {
1472+
"$ref": "#/definitions/SteppingGranularity",
1473+
"description": "Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed."
14661474
}
14671475
},
14681476
"required": [ "threadId" ]
@@ -1497,6 +1505,10 @@
14971505
"threadId": {
14981506
"type": "integer",
14991507
"description": "Execute 'stepOut' for this thread."
1508+
},
1509+
"granularity": {
1510+
"$ref": "#/definitions/SteppingGranularity",
1511+
"description": "Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed."
15001512
}
15011513
},
15021514
"required": [ "threadId" ]
@@ -1531,6 +1543,10 @@
15311543
"threadId": {
15321544
"type": "integer",
15331545
"description": "Execute 'stepBack' for this thread."
1546+
},
1547+
"granularity": {
1548+
"$ref": "#/definitions/SteppingGranularity",
1549+
"description": "Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed."
15341550
}
15351551
},
15361552
"required": [ "threadId" ]
@@ -2840,6 +2856,10 @@
28402856
"supportsClipboardContext": {
28412857
"type": "boolean",
28422858
"description": "The debug adapter supports the 'clipboard' context value in the 'evaluate' request."
2859+
},
2860+
"supportsSteppingGranularity": {
2861+
"type": "boolean",
2862+
"description": "The debug adapter supports stepping granularities (argument 'granularity') for the stepping requests."
28432863
}
28442864
}
28452865
},
@@ -3397,6 +3417,17 @@
33973417
"required": [ "verified" ]
33983418
},
33993419

3420+
"SteppingGranularity": {
3421+
"type": "string",
3422+
"description": "The granularity of one 'step' in the stepping requests 'next', 'stepIn', 'stepOut', and 'stepBack'.",
3423+
"enum": [ "statement", "line", "instruction" ],
3424+
"enumDescriptions": [
3425+
"The step should allow the program to run until the current statement has finished executing.\nThe meaning of a statement is determined by the adapter and it may be considered equivalent to a line.\nFor example 'for(int i = 0; i < 10; i++) could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.",
3426+
"The step should allow the program to run until the current source line has executed.",
3427+
"The step should allow one instruction to execute (e.g. one x86 instruction)."
3428+
]
3429+
},
3430+
34003431
"StepInTarget": {
34013432
"type": "object",
34023433
"description": "A StepInTarget can be used in the 'stepIn' request and determines into which single target the stepIn request should step.",

protocol/src/debugProtocol.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export module DebugProtocol {
121121

122122
/** Event message for 'stopped' event type.
123123
The event indicates that the execution of the debuggee has stopped due to some condition.
124-
This can be caused by a break point previously set, a stepping action has completed, by executing a debugger statement etc.
124+
This can be caused by a break point previously set, a stepping request has completed, by executing a debugger statement etc.
125125
*/
126126
export interface StoppedEvent extends Event {
127127
// event: 'stopped';
@@ -805,6 +805,8 @@ export module DebugProtocol {
805805
export interface NextArguments {
806806
/** Execute 'next' for this thread. */
807807
threadId: number;
808+
/** Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed. */
809+
granularity?: SteppingGranularity;
808810
}
809811

810812
/** Response to 'next' request. This is just an acknowledgement, so no body field is required. */
@@ -830,6 +832,8 @@ export module DebugProtocol {
830832
threadId: number;
831833
/** Optional id of the target to step into. */
832834
targetId?: number;
835+
/** Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed. */
836+
granularity?: SteppingGranularity;
833837
}
834838

835839
/** Response to 'stepIn' request. This is just an acknowledgement, so no body field is required. */
@@ -849,6 +853,8 @@ export module DebugProtocol {
849853
export interface StepOutArguments {
850854
/** Execute 'stepOut' for this thread. */
851855
threadId: number;
856+
/** Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed. */
857+
granularity?: SteppingGranularity;
852858
}
853859

854860
/** Response to 'stepOut' request. This is just an acknowledgement, so no body field is required. */
@@ -869,6 +875,8 @@ export module DebugProtocol {
869875
export interface StepBackArguments {
870876
/** Execute 'stepBack' for this thread. */
871877
threadId: number;
878+
/** Optional granularity to step. If no granularity is specified, a granularity of 'statement' is assumed. */
879+
granularity?: SteppingGranularity;
872880
}
873881

874882
/** Response to 'stepBack' request. This is just an acknowledgement, so no body field is required. */
@@ -1561,6 +1569,8 @@ export module DebugProtocol {
15611569
supportsBreakpointLocationsRequest?: boolean;
15621570
/** The debug adapter supports the 'clipboard' context value in the 'evaluate' request. */
15631571
supportsClipboardContext?: boolean;
1572+
/** The debug adapter supports stepping granularities (argument 'granularity') for the stepping requests. */
1573+
supportsSteppingGranularity?: boolean;
15641574
}
15651575

15661576
/** An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. */
@@ -1921,6 +1931,15 @@ export module DebugProtocol {
19211931
endColumn?: number;
19221932
}
19231933

1934+
/** The granularity of one 'step' in the stepping requests 'next', 'stepIn', 'stepOut', and 'stepBack'.
1935+
'statement': The step should allow the program to run until the current statement has finished executing.
1936+
The meaning of a statement is determined by the adapter and it may be considered equivalent to a line.
1937+
For example 'for(int i = 0; i < 10; i++) could be considered to have 3 statements 'int i = 0', 'i < 10', and 'i++'.
1938+
'line': The step should allow the program to run until the current source line has executed.
1939+
'instruction': The step should allow one instruction to execute (e.g. one x86 instruction).
1940+
*/
1941+
export type SteppingGranularity = 'statement' | 'line' | 'instruction';
1942+
19241943
/** A StepInTarget can be used in the 'stepIn' request and determines into which single target the stepIn request should step. */
19251944
export interface StepInTarget {
19261945
/** Unique identifier for a stepIn target. */

0 commit comments

Comments
 (0)