Debian Codegraph @

Utilities/cmcppdap/include/dap/protocol.h

raw
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Generated with protocol_gen.go -- do not edit this file.
16 // go run scripts/protocol_gen/protocol_gen.go
17 //
18 // DAP version 1.65.0
19
20 #ifndef dap_protocol_h
21 #define dap_protocol_h
22
23 #include "optional.h"
24 #include "typeinfo.h"
25 #include "typeof.h"
26 #include "variant.h"
27
28 #include <string>
29 #include <type_traits>
30 #include <vector>
31
32 namespace dap {
33
34 struct Request {};
35 struct Response {};
36 struct Event {};
37
38 // Response to `attach` request. This is just an acknowledgement, so no body
39 // field is required.
40 struct AttachResponse : public Response {};
41
42 DAP_DECLARE_STRUCT_TYPEINFO(AttachResponse);
43
44 // The `attach` request is sent from the client to the debug adapter to attach
45 // to a debuggee that is already running. Since attaching is debugger/runtime
46 // specific, the arguments for this request are not part of this specification.
47 struct AttachRequest : public Request {
48 using Response = AttachResponse;
49 // Arbitrary data from the previous, restarted session.
50 // The data is sent as the `restart` attribute of the `terminated` event.
51 // The client should leave the data intact.
52 optional<variant<array<any>, boolean, integer, null, number, object, string>>
53 restart;
54 };
55
56 DAP_DECLARE_STRUCT_TYPEINFO(AttachRequest);
57
58 // Names of checksum algorithms that may be supported by a debug adapter.
59 //
60 // Must be one of the following enumeration values:
61 // 'MD5', 'SHA1', 'SHA256', 'timestamp'
62 using ChecksumAlgorithm = string;
63
64 // The checksum of an item calculated by the specified algorithm.
65 struct Checksum {
66 // The algorithm used to calculate this checksum.
67 ChecksumAlgorithm algorithm = "MD5";
68 // Value of the checksum, encoded as a hexadecimal value.
69 string checksum;
70 };
71
72 DAP_DECLARE_STRUCT_TYPEINFO(Checksum);
73
74 // A `Source` is a descriptor for source code.
75 // It is returned from the debug adapter as part of a `StackFrame` and it is
76 // used by clients when specifying breakpoints.
77 struct Source {
78 // Additional data that a debug adapter might want to loop through the client.
79 // The client should leave the data intact and persist it across sessions. The
80 // client should not interpret the data.
81 optional<variant<array<any>, boolean, integer, null, number, object, string>>
82 adapterData;
83 // The checksums associated with this file.
84 optional<array<Checksum>> checksums;
85 // The short name of the source. Every source returned from the debug adapter
86 // has a name. When sending a source to the debug adapter this name is
87 // optional.
88 optional<string> name;
89 // The origin of this source. For example, 'internal module', 'inlined content
90 // from source map', etc.
91 optional<string> origin;
92 // The path of the source to be shown in the UI.
93 // It is only used to locate and load the content of the source if no
94 // `sourceReference` is specified (or its value is 0).
95 optional<string> path;
96 // A hint for how to present the source in the UI.
97 // A value of `deemphasize` can be used to indicate that the source is not
98 // available or that it is skipped on stepping.
99 //
100 // Must be one of the following enumeration values:
101 // 'normal', 'emphasize', 'deemphasize'
102 optional<string> presentationHint;
103 // If the value > 0 the contents of the source must be retrieved through the
104 // `source` request (even if a path is specified). Since a `sourceReference`
105 // is only valid for a session, it can not be used to persist a source. The
106 // value should be less than or equal to 2147483647 (2^31-1).
107 optional<integer> sourceReference;
108 // A list of sources that are related to this source. These may be the source
109 // that generated this source.
110 optional<array<Source>> sources;
111 };
112
113 DAP_DECLARE_STRUCT_TYPEINFO(Source);
114
115 // Information about a breakpoint created in `setBreakpoints`,
116 // `setFunctionBreakpoints`, `setInstructionBreakpoints`, or
117 // `setDataBreakpoints` requests.
118 struct Breakpoint {
119 // Start position of the source range covered by the breakpoint. It is
120 // measured in UTF-16 code units and the client capability `columnsStartAt1`
121 // determines whether it is 0- or 1-based.
122 optional<integer> column;
123 // End position of the source range covered by the breakpoint. It is measured
124 // in UTF-16 code units and the client capability `columnsStartAt1` determines
125 // whether it is 0- or 1-based. If no end line is given, then the end column
126 // is assumed to be in the start line.
127 optional<integer> endColumn;
128 // The end line of the actual range covered by the breakpoint.
129 optional<integer> endLine;
130 // The identifier for the breakpoint. It is needed if breakpoint events are
131 // used to update or remove breakpoints.
132 optional<integer> id;
133 // A memory reference to where the breakpoint is set.
134 optional<string> instructionReference;
135 // The start line of the actual range covered by the breakpoint.
136 optional<integer> line;
137 // A message about the state of the breakpoint.
138 // This is shown to the user and can be used to explain why a breakpoint could
139 // not be verified.
140 optional<string> message;
141 // The offset from the instruction reference.
142 // This can be negative.
143 optional<integer> offset;
144 // A machine-readable explanation of why a breakpoint may not be verified. If
145 // a breakpoint is verified or a specific reason is not known, the adapter
146 // should omit this property. Possible values include:
147 //
148 // - `pending`: Indicates a breakpoint might be verified in the future, but
149 // the adapter cannot verify it in the current state.
150 // - `failed`: Indicates a breakpoint was not able to be verified, and the
151 // adapter does not believe it can be verified without intervention.
152 //
153 // Must be one of the following enumeration values:
154 // 'pending', 'failed'
155 optional<string> reason;
156 // The source where the breakpoint is located.
157 optional<Source> source;
158 // If true, the breakpoint could be set (but not necessarily at the desired
159 // location).
160 boolean verified;
161 };
162
163 DAP_DECLARE_STRUCT_TYPEINFO(Breakpoint);
164
165 // The event indicates that some information about a breakpoint has changed.
166 struct BreakpointEvent : public Event {
167 // The `id` attribute is used to find the target breakpoint, the other
168 // attributes are used as the new values.
169 Breakpoint breakpoint;
170 // The reason for the event.
171 //
172 // May be one of the following enumeration values:
173 // 'changed', 'new', 'removed'
174 string reason;
175 };
176
177 DAP_DECLARE_STRUCT_TYPEINFO(BreakpointEvent);
178
179 // Properties of a breakpoint location returned from the `breakpointLocations`
180 // request.
181 struct BreakpointLocation {
182 // The start position of a breakpoint location. Position is measured in UTF-16
183 // code units and the client capability `columnsStartAt1` determines whether
184 // it is 0- or 1-based.
185 optional<integer> column;
186 // The end position of a breakpoint location (if the location covers a range).
187 // Position is measured in UTF-16 code units and the client capability
188 // `columnsStartAt1` determines whether it is 0- or 1-based.
189 optional<integer> endColumn;
190 // The end line of breakpoint location if the location covers a range.
191 optional<integer> endLine;
192 // Start line of breakpoint location.
193 integer line;
194 };
195
196 DAP_DECLARE_STRUCT_TYPEINFO(BreakpointLocation);
197
198 // Response to `breakpointLocations` request.
199 // Contains possible locations for source breakpoints.
200 struct BreakpointLocationsResponse : public Response {
201 // Sorted set of possible breakpoint locations.
202 array<BreakpointLocation> breakpoints;
203 };
204
205 DAP_DECLARE_STRUCT_TYPEINFO(BreakpointLocationsResponse);
206
207 // The `breakpointLocations` request returns all possible locations for source
208 // breakpoints in a given range. Clients should only call this request if the
209 // corresponding capability `supportsBreakpointLocationsRequest` is true.
210 struct BreakpointLocationsRequest : public Request {
211 using Response = BreakpointLocationsResponse;
212 // Start position within `line` to search possible breakpoint locations in. It
213 // is measured in UTF-16 code units and the client capability
214 // `columnsStartAt1` determines whether it is 0- or 1-based. If no column is
215 // given, the first position in the start line is assumed.
216 optional<integer> column;
217 // End position within `endLine` to search possible breakpoint locations in.
218 // It is measured in UTF-16 code units and the client capability
219 // `columnsStartAt1` determines whether it is 0- or 1-based. If no end column
220 // is given, the last position in the end line is assumed.
221 optional<integer> endColumn;
222 // End line of range to search possible breakpoint locations in. If no end
223 // line is given, then the end line is assumed to be the start line.
224 optional<integer> endLine;
225 // Start line of range to search possible breakpoint locations in. If only the
226 // line is specified, the request returns all possible locations in that line.
227 integer line;
228 // The source location of the breakpoints; either `source.path` or
229 // `source.sourceReference` must be specified.
230 Source source;
231 };
232
233 DAP_DECLARE_STRUCT_TYPEINFO(BreakpointLocationsRequest);
234
235 // Response to `cancel` request. This is just an acknowledgement, so no body
236 // field is required.
237 struct CancelResponse : public Response {};
238
239 DAP_DECLARE_STRUCT_TYPEINFO(CancelResponse);
240
241 // The `cancel` request is used by the client in two situations:
242 // - to indicate that it is no longer interested in the result produced by a
243 // specific request issued earlier
244 // - to cancel a progress sequence.
245 // Clients should only call this request if the corresponding capability
246 // `supportsCancelRequest` is true. This request has a hint characteristic: a
247 // debug adapter can only be expected to make a 'best effort' in honoring this
248 // request but there are no guarantees. The `cancel` request may return an error
249 // if it could not cancel an operation but a client should refrain from
250 // presenting this error to end users. The request that got cancelled still
251 // needs to send a response back. This can either be a normal result (`success`
252 // attribute true) or an error response (`success` attribute false and the
253 // `message` set to `cancelled`). Returning partial results from a cancelled
254 // request is possible but please note that a client has no generic way for
255 // detecting that a response is partial or not. The progress that got cancelled
256 // still needs to send a `progressEnd` event back.
257 // A client should not assume that progress just got cancelled after sending
258 // the `cancel` request.
259 struct CancelRequest : public Request {
260 using Response = CancelResponse;
261 // The ID (attribute `progressId`) of the progress to cancel. If missing no
262 // progress is cancelled. Both a `requestId` and a `progressId` can be
263 // specified in one request.
264 optional<string> progressId;
265 // The ID (attribute `seq`) of the request to cancel. If missing no request is
266 // cancelled. Both a `requestId` and a `progressId` can be specified in one
267 // request.
268 optional<integer> requestId;
269 };
270
271 DAP_DECLARE_STRUCT_TYPEINFO(CancelRequest);
272
273 // A `ColumnDescriptor` specifies what module attribute to show in a column of
274 // the modules view, how to format it, and what the column's label should be. It
275 // is only used if the underlying UI actually supports this level of
276 // customization.
277 struct ColumnDescriptor {
278 // Name of the attribute rendered in this column.
279 string attributeName;
280 // Format to use for the rendered values in this column. TBD how the format
281 // strings looks like.
282 optional<string> format;
283 // Header UI label of column.
284 string label;
285 // Datatype of values in this column. Defaults to `string` if not specified.
286 //
287 // Must be one of the following enumeration values:
288 // 'string', 'number', 'boolean', 'unixTimestampUTC'
289 optional<string> type;
290 // Width of this column in characters (hint only).
291 optional<integer> width;
292 };
293
294 DAP_DECLARE_STRUCT_TYPEINFO(ColumnDescriptor);
295
296 // Describes one or more type of breakpoint a `BreakpointMode` applies to. This
297 // is a non-exhaustive enumeration and may expand as future breakpoint types are
298 // added.
299 using BreakpointModeApplicability = string;
300
301 // A `BreakpointMode` is provided as a option when setting breakpoints on
302 // sources or instructions.
303 struct BreakpointMode {
304 // Describes one or more type of breakpoint this mode applies to.
305 array<BreakpointModeApplicability> appliesTo;
306 // A help text providing additional information about the breakpoint mode.
307 // This string is typically shown as a hover and can be translated.
308 optional<string> description;
309 // The name of the breakpoint mode. This is shown in the UI.
310 string label;
311 // The internal ID of the mode. This value is passed to the `setBreakpoints`
312 // request.
313 string mode;
314 };
315
316 DAP_DECLARE_STRUCT_TYPEINFO(BreakpointMode);
317
318 // An `ExceptionBreakpointsFilter` is shown in the UI as an filter option for
319 // configuring how exceptions are dealt with.
320 struct ExceptionBreakpointsFilter {
321 // A help text providing information about the condition. This string is shown
322 // as the placeholder text for a text box and can be translated.
323 optional<string> conditionDescription;
324 // Initial value of the filter option. If not specified a value false is
325 // assumed.
326 optional<boolean> def;
327 // A help text providing additional information about the exception filter.
328 // This string is typically shown as a hover and can be translated.
329 optional<string> description;
330 // The internal ID of the filter option. This value is passed to the
331 // `setExceptionBreakpoints` request.
332 string filter;
333 // The name of the filter option. This is shown in the UI.
334 string label;
335 // Controls whether a condition can be specified for this filter option. If
336 // false or missing, a condition can not be set.
337 optional<boolean> supportsCondition;
338 };
339
340 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionBreakpointsFilter);
341
342 // Information about the capabilities of a debug adapter.
343 struct Capabilities {
344 // The set of additional module information exposed by the debug adapter.
345 optional<array<ColumnDescriptor>> additionalModuleColumns;
346 // Modes of breakpoints supported by the debug adapter, such as 'hardware' or
347 // 'software'. If present, the client may allow the user to select a mode and
348 // include it in its `setBreakpoints` request.
349 //
350 // Clients may present the first applicable mode in this array as the
351 // 'default' mode in gestures that set breakpoints.
352 optional<array<BreakpointMode>> breakpointModes;
353 // The set of characters that should trigger completion in a REPL. If not
354 // specified, the UI should assume the `.` character.
355 optional<array<string>> completionTriggerCharacters;
356 // Available exception filter options for the `setExceptionBreakpoints`
357 // request.
358 optional<array<ExceptionBreakpointsFilter>> exceptionBreakpointFilters;
359 // The debug adapter supports the `suspendDebuggee` attribute on the
360 // `disconnect` request.
361 optional<boolean> supportSuspendDebuggee;
362 // The debug adapter supports the `terminateDebuggee` attribute on the
363 // `disconnect` request.
364 optional<boolean> supportTerminateDebuggee;
365 // Checksum algorithms supported by the debug adapter.
366 optional<array<ChecksumAlgorithm>> supportedChecksumAlgorithms;
367 // The debug adapter supports the `breakpointLocations` request.
368 optional<boolean> supportsBreakpointLocationsRequest;
369 // The debug adapter supports the `cancel` request.
370 optional<boolean> supportsCancelRequest;
371 // The debug adapter supports the `clipboard` context value in the `evaluate`
372 // request.
373 optional<boolean> supportsClipboardContext;
374 // The debug adapter supports the `completions` request.
375 optional<boolean> supportsCompletionsRequest;
376 // The debug adapter supports conditional breakpoints.
377 optional<boolean> supportsConditionalBreakpoints;
378 // The debug adapter supports the `configurationDone` request.
379 optional<boolean> supportsConfigurationDoneRequest;
380 // The debug adapter supports data breakpoints.
381 optional<boolean> supportsDataBreakpoints;
382 // The debug adapter supports the delayed loading of parts of the stack, which
383 // requires that both the `startFrame` and `levels` arguments and the
384 // `totalFrames` result of the `stackTrace` request are supported.
385 optional<boolean> supportsDelayedStackTraceLoading;
386 // The debug adapter supports the `disassemble` request.
387 optional<boolean> supportsDisassembleRequest;
388 // The debug adapter supports a (side effect free) `evaluate` request for data
389 // hovers.
390 optional<boolean> supportsEvaluateForHovers;
391 // The debug adapter supports `filterOptions` as an argument on the
392 // `setExceptionBreakpoints` request.
393 optional<boolean> supportsExceptionFilterOptions;
394 // The debug adapter supports the `exceptionInfo` request.
395 optional<boolean> supportsExceptionInfoRequest;
396 // The debug adapter supports `exceptionOptions` on the
397 // `setExceptionBreakpoints` request.
398 optional<boolean> supportsExceptionOptions;
399 // The debug adapter supports function breakpoints.
400 optional<boolean> supportsFunctionBreakpoints;
401 // The debug adapter supports the `gotoTargets` request.
402 optional<boolean> supportsGotoTargetsRequest;
403 // The debug adapter supports breakpoints that break execution after a
404 // specified number of hits.
405 optional<boolean> supportsHitConditionalBreakpoints;
406 // The debug adapter supports adding breakpoints based on instruction
407 // references.
408 optional<boolean> supportsInstructionBreakpoints;
409 // The debug adapter supports the `loadedSources` request.
410 optional<boolean> supportsLoadedSourcesRequest;
411 // The debug adapter supports log points by interpreting the `logMessage`
412 // attribute of the `SourceBreakpoint`.
413 optional<boolean> supportsLogPoints;
414 // The debug adapter supports the `modules` request.
415 optional<boolean> supportsModulesRequest;
416 // The debug adapter supports the `readMemory` request.
417 optional<boolean> supportsReadMemoryRequest;
418 // The debug adapter supports restarting a frame.
419 optional<boolean> supportsRestartFrame;
420 // The debug adapter supports the `restart` request. In this case a client
421 // should not implement `restart` by terminating and relaunching the adapter
422 // but by calling the `restart` request.
423 optional<boolean> supportsRestartRequest;
424 // The debug adapter supports the `setExpression` request.
425 optional<boolean> supportsSetExpression;
426 // The debug adapter supports setting a variable to a value.
427 optional<boolean> supportsSetVariable;
428 // The debug adapter supports the `singleThread` property on the execution
429 // requests (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`,
430 // `stepBack`).
431 optional<boolean> supportsSingleThreadExecutionRequests;
432 // The debug adapter supports stepping back via the `stepBack` and
433 // `reverseContinue` requests.
434 optional<boolean> supportsStepBack;
435 // The debug adapter supports the `stepInTargets` request.
436 optional<boolean> supportsStepInTargetsRequest;
437 // The debug adapter supports stepping granularities (argument `granularity`)
438 // for the stepping requests.
439 optional<boolean> supportsSteppingGranularity;
440 // The debug adapter supports the `terminate` request.
441 optional<boolean> supportsTerminateRequest;
442 // The debug adapter supports the `terminateThreads` request.
443 optional<boolean> supportsTerminateThreadsRequest;
444 // The debug adapter supports a `format` attribute on the `stackTrace`,
445 // `variables`, and `evaluate` requests.
446 optional<boolean> supportsValueFormattingOptions;
447 // The debug adapter supports the `writeMemory` request.
448 optional<boolean> supportsWriteMemoryRequest;
449 };
450
451 DAP_DECLARE_STRUCT_TYPEINFO(Capabilities);
452
453 // The event indicates that one or more capabilities have changed.
454 // Since the capabilities are dependent on the client and its UI, it might not
455 // be possible to change that at random times (or too late). Consequently this
456 // event has a hint characteristic: a client can only be expected to make a
457 // 'best effort' in honoring individual capabilities but there are no
458 // guarantees. Only changed capabilities need to be included, all other
459 // capabilities keep their values.
460 struct CapabilitiesEvent : public Event {
461 // The set of updated capabilities.
462 Capabilities capabilities;
463 };
464
465 DAP_DECLARE_STRUCT_TYPEINFO(CapabilitiesEvent);
466
467 // Some predefined types for the CompletionItem. Please note that not all
468 // clients have specific icons for all of them.
469 //
470 // Must be one of the following enumeration values:
471 // 'method', 'function', 'constructor', 'field', 'variable', 'class',
472 // 'interface', 'module', 'property', 'unit', 'value', 'enum', 'keyword',
473 // 'snippet', 'text', 'color', 'file', 'reference', 'customcolor'
474 using CompletionItemType = string;
475
476 // `CompletionItems` are the suggestions returned from the `completions`
477 // request.
478 struct CompletionItem {
479 // A human-readable string with additional information about this item, like
480 // type or symbol information.
481 optional<string> detail;
482 // The label of this completion item. By default this is also the text that is
483 // inserted when selecting this completion.
484 string label;
485 // Length determines how many characters are overwritten by the completion
486 // text and it is measured in UTF-16 code units. If missing the value 0 is
487 // assumed which results in the completion text being inserted.
488 optional<integer> length;
489 // Determines the length of the new selection after the text has been inserted
490 // (or replaced) and it is measured in UTF-16 code units. The selection can
491 // not extend beyond the bounds of the completion text. If omitted the length
492 // is assumed to be 0.
493 optional<integer> selectionLength;
494 // Determines the start of the new selection after the text has been inserted
495 // (or replaced). `selectionStart` is measured in UTF-16 code units and must
496 // be in the range 0 and length of the completion text. If omitted the
497 // selection starts at the end of the completion text.
498 optional<integer> selectionStart;
499 // A string that should be used when comparing this item with other items. If
500 // not returned or an empty string, the `label` is used instead.
501 optional<string> sortText;
502 // Start position (within the `text` attribute of the `completions` request)
503 // where the completion text is added. The position is measured in UTF-16 code
504 // units and the client capability `columnsStartAt1` determines whether it is
505 // 0- or 1-based. If the start position is omitted the text is added at the
506 // location specified by the `column` attribute of the `completions` request.
507 optional<integer> start;
508 // If text is returned and not an empty string, then it is inserted instead of
509 // the label.
510 optional<string> text;
511 // The item's type. Typically the client uses this information to render the
512 // item in the UI with an icon.
513 optional<CompletionItemType> type;
514 };
515
516 DAP_DECLARE_STRUCT_TYPEINFO(CompletionItem);
517
518 // Response to `completions` request.
519 struct CompletionsResponse : public Response {
520 // The possible completions for .
521 array<CompletionItem> targets;
522 };
523
524 DAP_DECLARE_STRUCT_TYPEINFO(CompletionsResponse);
525
526 // Returns a list of possible completions for a given caret position and text.
527 // Clients should only call this request if the corresponding capability
528 // `supportsCompletionsRequest` is true.
529 struct CompletionsRequest : public Request {
530 using Response = CompletionsResponse;
531 // The position within `text` for which to determine the completion proposals.
532 // It is measured in UTF-16 code units and the client capability
533 // `columnsStartAt1` determines whether it is 0- or 1-based.
534 integer column;
535 // Returns completions in the scope of this stack frame. If not specified, the
536 // completions are returned for the global scope.
537 optional<integer> frameId;
538 // A line for which to determine the completion proposals. If missing the
539 // first line of the text is assumed.
540 optional<integer> line;
541 // One or more source lines. Typically this is the text users have typed into
542 // the debug console before they asked for completion.
543 string text;
544 };
545
546 DAP_DECLARE_STRUCT_TYPEINFO(CompletionsRequest);
547
548 // Response to `configurationDone` request. This is just an acknowledgement, so
549 // no body field is required.
550 struct ConfigurationDoneResponse : public Response {};
551
552 DAP_DECLARE_STRUCT_TYPEINFO(ConfigurationDoneResponse);
553
554 // This request indicates that the client has finished initialization of the
555 // debug adapter. So it is the last request in the sequence of configuration
556 // requests (which was started by the `initialized` event). Clients should only
557 // call this request if the corresponding capability
558 // `supportsConfigurationDoneRequest` is true.
559 struct ConfigurationDoneRequest : public Request {
560 using Response = ConfigurationDoneResponse;
561 };
562
563 DAP_DECLARE_STRUCT_TYPEINFO(ConfigurationDoneRequest);
564
565 // Response to `continue` request.
566 struct ContinueResponse : public Response {
567 // The value true (or a missing property) signals to the client that all
568 // threads have been resumed. The value false indicates that not all threads
569 // were resumed.
570 optional<boolean> allThreadsContinued;
571 };
572
573 DAP_DECLARE_STRUCT_TYPEINFO(ContinueResponse);
574
575 // The request resumes execution of all threads. If the debug adapter supports
576 // single thread execution (see capability
577 // `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument
578 // to true resumes only the specified thread. If not all threads were resumed,
579 // the `allThreadsContinued` attribute of the response should be set to false.
580 struct ContinueRequest : public Request {
581 using Response = ContinueResponse;
582 // If this flag is true, execution is resumed only for the thread with given
583 // `threadId`.
584 optional<boolean> singleThread;
585 // Specifies the active thread. If the debug adapter supports single thread
586 // execution (see `supportsSingleThreadExecutionRequests`) and the argument
587 // `singleThread` is true, only the thread with this ID is resumed.
588 integer threadId;
589 };
590
591 DAP_DECLARE_STRUCT_TYPEINFO(ContinueRequest);
592
593 // The event indicates that the execution of the debuggee has continued.
594 // Please note: a debug adapter is not expected to send this event in response
595 // to a request that implies that execution continues, e.g. `launch` or
596 // `continue`. It is only necessary to send a `continued` event if there was no
597 // previous request that implied this.
598 struct ContinuedEvent : public Event {
599 // If `allThreadsContinued` is true, a debug adapter can announce that all
600 // threads have continued.
601 optional<boolean> allThreadsContinued;
602 // The thread which was continued.
603 integer threadId;
604 };
605
606 DAP_DECLARE_STRUCT_TYPEINFO(ContinuedEvent);
607
608 // This enumeration defines all possible access types for data breakpoints.
609 //
610 // Must be one of the following enumeration values:
611 // 'read', 'write', 'readWrite'
612 using DataBreakpointAccessType = string;
613
614 // Response to `dataBreakpointInfo` request.
615 struct DataBreakpointInfoResponse : public Response {
616 // Attribute lists the available access types for a potential data breakpoint.
617 // A UI client could surface this information.
618 optional<array<DataBreakpointAccessType>> accessTypes;
619 // Attribute indicates that a potential data breakpoint could be persisted
620 // across sessions.
621 optional<boolean> canPersist;
622 // An identifier for the data on which a data breakpoint can be registered
623 // with the `setDataBreakpoints` request or null if no data breakpoint is
624 // available. If a `variablesReference` or `frameId` is passed, the `dataId`
625 // is valid in the current suspended state, otherwise it's valid indefinitely.
626 // See 'Lifetime of Object References' in the Overview section for details.
627 // Breakpoints set using the `dataId` in the `setDataBreakpoints` request may
628 // outlive the lifetime of the associated `dataId`.
629 variant<string, null> dataId;
630 // UI string that describes on what data the breakpoint is set on or why a
631 // data breakpoint is not available.
632 string description;
633 };
634
635 DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpointInfoResponse);
636
637 // Obtains information on a possible data breakpoint that could be set on an
638 // expression or variable. Clients should only call this request if the
639 // corresponding capability `supportsDataBreakpoints` is true.
640 struct DataBreakpointInfoRequest : public Request {
641 using Response = DataBreakpointInfoResponse;
642 // When `name` is an expression, evaluate it in the scope of this stack frame.
643 // If not specified, the expression is evaluated in the global scope. When
644 // `variablesReference` is specified, this property has no effect.
645 optional<integer> frameId;
646 // The mode of the desired breakpoint. If defined, this must be one of the
647 // `breakpointModes` the debug adapter advertised in its `Capabilities`.
648 optional<string> mode;
649 // The name of the variable's child to obtain data breakpoint information for.
650 // If `variablesReference` isn't specified, this can be an expression.
651 string name;
652 // Reference to the variable container if the data breakpoint is requested for
653 // a child of the container. The `variablesReference` must have been obtained
654 // in the current suspended state. See 'Lifetime of Object References' in the
655 // Overview section for details.
656 optional<integer> variablesReference;
657 };
658
659 DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpointInfoRequest);
660
661 // Represents a single disassembled instruction.
662 struct DisassembledInstruction {
663 // The address of the instruction. Treated as a hex value if prefixed with
664 // `0x`, or as a decimal value otherwise.
665 string address;
666 // The column within the line that corresponds to this instruction, if any.
667 optional<integer> column;
668 // The end column of the range that corresponds to this instruction, if any.
669 optional<integer> endColumn;
670 // The end line of the range that corresponds to this instruction, if any.
671 optional<integer> endLine;
672 // Text representing the instruction and its operands, in an
673 // implementation-defined format.
674 string instruction;
675 // Raw bytes representing the instruction and its operands, in an
676 // implementation-defined format.
677 optional<string> instructionBytes;
678 // The line within the source location that corresponds to this instruction,
679 // if any.
680 optional<integer> line;
681 // Source location that corresponds to this instruction, if any.
682 // Should always be set (if available) on the first instruction returned,
683 // but can be omitted afterwards if this instruction maps to the same source
684 // file as the previous instruction.
685 optional<Source> location;
686 // A hint for how to present the instruction in the UI.
687 //
688 // A value of `invalid` may be used to indicate this instruction is 'filler'
689 // and cannot be reached by the program. For example, unreadable memory
690 // addresses may be presented is 'invalid.'
691 //
692 // Must be one of the following enumeration values:
693 // 'normal', 'invalid'
694 optional<string> presentationHint;
695 // Name of the symbol that corresponds with the location of this instruction,
696 // if any.
697 optional<string> symbol;
698 };
699
700 DAP_DECLARE_STRUCT_TYPEINFO(DisassembledInstruction);
701
702 // Response to `disassemble` request.
703 struct DisassembleResponse : public Response {
704 // The list of disassembled instructions.
705 array<DisassembledInstruction> instructions;
706 };
707
708 DAP_DECLARE_STRUCT_TYPEINFO(DisassembleResponse);
709
710 // Disassembles code stored at the provided location.
711 // Clients should only call this request if the corresponding capability
712 // `supportsDisassembleRequest` is true.
713 struct DisassembleRequest : public Request {
714 using Response = DisassembleResponse;
715 // Number of instructions to disassemble starting at the specified location
716 // and offset. An adapter must return exactly this number of instructions -
717 // any unavailable instructions should be replaced with an
718 // implementation-defined 'invalid instruction' value.
719 integer instructionCount;
720 // Offset (in instructions) to be applied after the byte offset (if any)
721 // before disassembling. Can be negative.
722 optional<integer> instructionOffset;
723 // Memory reference to the base location containing the instructions to
724 // disassemble.
725 string memoryReference;
726 // Offset (in bytes) to be applied to the reference location before
727 // disassembling. Can be negative.
728 optional<integer> offset;
729 // If true, the adapter should attempt to resolve memory addresses and other
730 // values to symbolic names.
731 optional<boolean> resolveSymbols;
732 };
733
734 DAP_DECLARE_STRUCT_TYPEINFO(DisassembleRequest);
735
736 // Response to `disconnect` request. This is just an acknowledgement, so no body
737 // field is required.
738 struct DisconnectResponse : public Response {};
739
740 DAP_DECLARE_STRUCT_TYPEINFO(DisconnectResponse);
741
742 // The `disconnect` request asks the debug adapter to disconnect from the
743 // debuggee (thus ending the debug session) and then to shut down itself (the
744 // debug adapter). In addition, the debug adapter must terminate the debuggee if
745 // it was started with the `launch` request. If an `attach` request was used to
746 // connect to the debuggee, then the debug adapter must not terminate the
747 // debuggee. This implicit behavior of when to terminate the debuggee can be
748 // overridden with the `terminateDebuggee` argument (which is only supported by
749 // a debug adapter if the corresponding capability `supportTerminateDebuggee` is
750 // true).
751 struct DisconnectRequest : public Request {
752 using Response = DisconnectResponse;
753 // A value of true indicates that this `disconnect` request is part of a
754 // restart sequence.
755 optional<boolean> restart;
756 // Indicates whether the debuggee should stay suspended when the debugger is
757 // disconnected. If unspecified, the debuggee should resume execution. The
758 // attribute is only honored by a debug adapter if the corresponding
759 // capability `supportSuspendDebuggee` is true.
760 optional<boolean> suspendDebuggee;
761 // Indicates whether the debuggee should be terminated when the debugger is
762 // disconnected. If unspecified, the debug adapter is free to do whatever it
763 // thinks is best. The attribute is only honored by a debug adapter if the
764 // corresponding capability `supportTerminateDebuggee` is true.
765 optional<boolean> terminateDebuggee;
766 };
767
768 DAP_DECLARE_STRUCT_TYPEINFO(DisconnectRequest);
769
770 // A structured message object. Used to return errors from requests.
771 struct Message {
772 // A format string for the message. Embedded variables have the form `{name}`.
773 // If variable name starts with an underscore character, the variable does not
774 // contain user data (PII) and can be safely used for telemetry purposes.
775 string format;
776 // Unique (within a debug adapter implementation) identifier for the message.
777 // The purpose of these error IDs is to help extension authors that have the
778 // requirement that every user visible error message needs a corresponding
779 // error number, so that users or customer support can find information about
780 // the specific error more easily.
781 integer id;
782 // If true send to telemetry.
783 optional<boolean> sendTelemetry;
784 // If true show user.
785 optional<boolean> showUser;
786 // A url where additional information about this message can be found.
787 optional<string> url;
788 // A label that is presented to the user as the UI for opening the url.
789 optional<string> urlLabel;
790 // An object used as a dictionary for looking up the variables in the format
791 // string.
792 optional<object> variables;
793 };
794
795 DAP_DECLARE_STRUCT_TYPEINFO(Message);
796
797 // On error (whenever `success` is false), the body can provide more details.
798 struct ErrorResponse : public Response {
799 // A structured error message.
800 optional<Message> error;
801 };
802
803 DAP_DECLARE_STRUCT_TYPEINFO(ErrorResponse);
804
805 // Properties of a variable that can be used to determine how to render the
806 // variable in the UI.
807 struct VariablePresentationHint {
808 // Set of attributes represented as an array of strings. Before introducing
809 // additional values, try to use the listed values.
810 optional<array<string>> attributes;
811 // The kind of variable. Before introducing additional values, try to use the
812 // listed values.
813 //
814 // May be one of the following enumeration values:
815 // 'property', 'method', 'class', 'data', 'event', 'baseClass', 'innerClass',
816 // 'interface', 'mostDerivedClass', 'virtual', 'dataBreakpoint'
817 optional<string> kind;
818 // If true, clients can present the variable with a UI that supports a
819 // specific gesture to trigger its evaluation. This mechanism can be used for
820 // properties that require executing code when retrieving their value and
821 // where the code execution can be expensive and/or produce side-effects. A
822 // typical example are properties based on a getter function. Please note that
823 // in addition to the `lazy` flag, the variable's `variablesReference` is
824 // expected to refer to a variable that will provide the value through another
825 // `variable` request.
826 optional<boolean> lazy;
827 // Visibility of variable. Before introducing additional values, try to use
828 // the listed values.
829 //
830 // May be one of the following enumeration values:
831 // 'public', 'private', 'protected', 'internal', 'final'
832 optional<string> visibility;
833 };
834
835 DAP_DECLARE_STRUCT_TYPEINFO(VariablePresentationHint);
836
837 // Response to `evaluate` request.
838 struct EvaluateResponse : public Response {
839 // The number of indexed child variables.
840 // The client can use this information to present the variables in a paged UI
841 // and fetch them in chunks. The value should be less than or equal to
842 // 2147483647 (2^31-1).
843 optional<integer> indexedVariables;
844 // A memory reference to a location appropriate for this result.
845 // For pointer type eval results, this is generally a reference to the memory
846 // address contained in the pointer. This attribute may be returned by a debug
847 // adapter if corresponding capability `supportsMemoryReferences` is true.
848 optional<string> memoryReference;
849 // The number of named child variables.
850 // The client can use this information to present the variables in a paged UI
851 // and fetch them in chunks. The value should be less than or equal to
852 // 2147483647 (2^31-1).
853 optional<integer> namedVariables;
854 // Properties of an evaluate result that can be used to determine how to
855 // render the result in the UI.
856 optional<VariablePresentationHint> presentationHint;
857 // The result of the evaluate request.
858 string result;
859 // The type of the evaluate result.
860 // This attribute should only be returned by a debug adapter if the
861 // corresponding capability `supportsVariableType` is true.
862 optional<string> type;
863 // If `variablesReference` is > 0, the evaluate result is structured and its
864 // children can be retrieved by passing `variablesReference` to the
865 // `variables` request as long as execution remains suspended. See 'Lifetime
866 // of Object References' in the Overview section for details.
867 integer variablesReference;
868 };
869
870 DAP_DECLARE_STRUCT_TYPEINFO(EvaluateResponse);
871
872 // Provides formatting information for a value.
873 struct ValueFormat {
874 // Display the value in hex.
875 optional<boolean> hex;
876 };
877
878 DAP_DECLARE_STRUCT_TYPEINFO(ValueFormat);
879
880 // Evaluates the given expression in the context of the topmost stack frame.
881 // The expression has access to any variables and arguments that are in scope.
882 struct EvaluateRequest : public Request {
883 using Response = EvaluateResponse;
884 // The context in which the evaluate request is used.
885 //
886 // May be one of the following enumeration values:
887 // 'watch', 'repl', 'hover', 'clipboard', 'variables'
888 optional<string> context;
889 // The expression to evaluate.
890 string expression;
891 // Specifies details on how to format the result.
892 // The attribute is only honored by a debug adapter if the corresponding
893 // capability `supportsValueFormattingOptions` is true.
894 optional<ValueFormat> format;
895 // Evaluate the expression in the scope of this stack frame. If not specified,
896 // the expression is evaluated in the global scope.
897 optional<integer> frameId;
898 };
899
900 DAP_DECLARE_STRUCT_TYPEINFO(EvaluateRequest);
901
902 // This enumeration defines all possible conditions when a thrown exception
903 // should result in a break. never: never breaks, always: always breaks,
904 // unhandled: breaks when exception unhandled,
905 // userUnhandled: breaks if the exception is not handled by user code.
906 //
907 // Must be one of the following enumeration values:
908 // 'never', 'always', 'unhandled', 'userUnhandled'
909 using ExceptionBreakMode = string;
910
911 // Detailed information about an exception that has occurred.
912 struct ExceptionDetails {
913 // An expression that can be evaluated in the current scope to obtain the
914 // exception object.
915 optional<string> evaluateName;
916 // Fully-qualified type name of the exception object.
917 optional<string> fullTypeName;
918 // Details of the exception contained by this exception, if any.
919 optional<array<ExceptionDetails>> innerException;
920 // Message contained in the exception.
921 optional<string> message;
922 // Stack trace at the time the exception was thrown.
923 optional<string> stackTrace;
924 // Short type name of the exception object.
925 optional<string> typeName;
926 };
927
928 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionDetails);
929
930 // Response to `exceptionInfo` request.
931 struct ExceptionInfoResponse : public Response {
932 // Mode that caused the exception notification to be raised.
933 ExceptionBreakMode breakMode = "never";
934 // Descriptive text for the exception.
935 optional<string> description;
936 // Detailed information about the exception.
937 optional<ExceptionDetails> details;
938 // ID of the exception that was thrown.
939 string exceptionId;
940 };
941
942 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionInfoResponse);
943
944 // Retrieves the details of the exception that caused this event to be raised.
945 // Clients should only call this request if the corresponding capability
946 // `supportsExceptionInfoRequest` is true.
947 struct ExceptionInfoRequest : public Request {
948 using Response = ExceptionInfoResponse;
949 // Thread for which exception information should be retrieved.
950 integer threadId;
951 };
952
953 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionInfoRequest);
954
955 // The event indicates that the debuggee has exited and returns its exit code.
956 struct ExitedEvent : public Event {
957 // The exit code returned from the debuggee.
958 integer exitCode;
959 };
960
961 DAP_DECLARE_STRUCT_TYPEINFO(ExitedEvent);
962
963 // Response to `goto` request. This is just an acknowledgement, so no body field
964 // is required.
965 struct GotoResponse : public Response {};
966
967 DAP_DECLARE_STRUCT_TYPEINFO(GotoResponse);
968
969 // The request sets the location where the debuggee will continue to run.
970 // This makes it possible to skip the execution of code or to execute code
971 // again. The code between the current location and the goto target is not
972 // executed but skipped. The debug adapter first sends the response and then a
973 // `stopped` event with reason `goto`. Clients should only call this request if
974 // the corresponding capability `supportsGotoTargetsRequest` is true (because
975 // only then goto targets exist that can be passed as arguments).
976 struct GotoRequest : public Request {
977 using Response = GotoResponse;
978 // The location where the debuggee will continue to run.
979 integer targetId;
980 // Set the goto target for this thread.
981 integer threadId;
982 };
983
984 DAP_DECLARE_STRUCT_TYPEINFO(GotoRequest);
985
986 // A `GotoTarget` describes a code location that can be used as a target in the
987 // `goto` request. The possible goto targets can be determined via the
988 // `gotoTargets` request.
989 struct GotoTarget {
990 // The column of the goto target.
991 optional<integer> column;
992 // The end column of the range covered by the goto target.
993 optional<integer> endColumn;
994 // The end line of the range covered by the goto target.
995 optional<integer> endLine;
996 // Unique identifier for a goto target. This is used in the `goto` request.
997 integer id;
998 // A memory reference for the instruction pointer value represented by this
999 // target.
1000 optional<string> instructionPointerReference;
1001 // The name of the goto target (shown in the UI).
1002 string label;
1003 // The line of the goto target.
1004 integer line;
1005 };
1006
1007 DAP_DECLARE_STRUCT_TYPEINFO(GotoTarget);
1008
1009 // Response to `gotoTargets` request.
1010 struct GotoTargetsResponse : public Response {
1011 // The possible goto targets of the specified location.
1012 array<GotoTarget> targets;
1013 };
1014
1015 DAP_DECLARE_STRUCT_TYPEINFO(GotoTargetsResponse);
1016
1017 // This request retrieves the possible goto targets for the specified source
1018 // location. These targets can be used in the `goto` request. Clients should
1019 // only call this request if the corresponding capability
1020 // `supportsGotoTargetsRequest` is true.
1021 struct GotoTargetsRequest : public Request {
1022 using Response = GotoTargetsResponse;
1023 // The position within `line` for which the goto targets are determined. It is
1024 // measured in UTF-16 code units and the client capability `columnsStartAt1`
1025 // determines whether it is 0- or 1-based.
1026 optional<integer> column;
1027 // The line location for which the goto targets are determined.
1028 integer line;
1029 // The source location for which the goto targets are determined.
1030 Source source;
1031 };
1032
1033 DAP_DECLARE_STRUCT_TYPEINFO(GotoTargetsRequest);
1034
1035 // Response to `initialize` request.
1036 struct InitializeResponse : public Response {
1037 // The set of additional module information exposed by the debug adapter.
1038 optional<array<ColumnDescriptor>> additionalModuleColumns;
1039 // Modes of breakpoints supported by the debug adapter, such as 'hardware' or
1040 // 'software'. If present, the client may allow the user to select a mode and
1041 // include it in its `setBreakpoints` request.
1042 //
1043 // Clients may present the first applicable mode in this array as the
1044 // 'default' mode in gestures that set breakpoints.
1045 optional<array<BreakpointMode>> breakpointModes;
1046 // The set of characters that should trigger completion in a REPL. If not
1047 // specified, the UI should assume the `.` character.
1048 optional<array<string>> completionTriggerCharacters;
1049 // Available exception filter options for the `setExceptionBreakpoints`
1050 // request.
1051 optional<array<ExceptionBreakpointsFilter>> exceptionBreakpointFilters;
1052 // The debug adapter supports the `suspendDebuggee` attribute on the
1053 // `disconnect` request.
1054 optional<boolean> supportSuspendDebuggee;
1055 // The debug adapter supports the `terminateDebuggee` attribute on the
1056 // `disconnect` request.
1057 optional<boolean> supportTerminateDebuggee;
1058 // Checksum algorithms supported by the debug adapter.
1059 optional<array<ChecksumAlgorithm>> supportedChecksumAlgorithms;
1060 // The debug adapter supports the `breakpointLocations` request.
1061 optional<boolean> supportsBreakpointLocationsRequest;
1062 // The debug adapter supports the `cancel` request.
1063 optional<boolean> supportsCancelRequest;
1064 // The debug adapter supports the `clipboard` context value in the `evaluate`
1065 // request.
1066 optional<boolean> supportsClipboardContext;
1067 // The debug adapter supports the `completions` request.
1068 optional<boolean> supportsCompletionsRequest;
1069 // The debug adapter supports conditional breakpoints.
1070 optional<boolean> supportsConditionalBreakpoints;
1071 // The debug adapter supports the `configurationDone` request.
1072 optional<boolean> supportsConfigurationDoneRequest;
1073 // The debug adapter supports data breakpoints.
1074 optional<boolean> supportsDataBreakpoints;
1075 // The debug adapter supports the delayed loading of parts of the stack, which
1076 // requires that both the `startFrame` and `levels` arguments and the
1077 // `totalFrames` result of the `stackTrace` request are supported.
1078 optional<boolean> supportsDelayedStackTraceLoading;
1079 // The debug adapter supports the `disassemble` request.
1080 optional<boolean> supportsDisassembleRequest;
1081 // The debug adapter supports a (side effect free) `evaluate` request for data
1082 // hovers.
1083 optional<boolean> supportsEvaluateForHovers;
1084 // The debug adapter supports `filterOptions` as an argument on the
1085 // `setExceptionBreakpoints` request.
1086 optional<boolean> supportsExceptionFilterOptions;
1087 // The debug adapter supports the `exceptionInfo` request.
1088 optional<boolean> supportsExceptionInfoRequest;
1089 // The debug adapter supports `exceptionOptions` on the
1090 // `setExceptionBreakpoints` request.
1091 optional<boolean> supportsExceptionOptions;
1092 // The debug adapter supports function breakpoints.
1093 optional<boolean> supportsFunctionBreakpoints;
1094 // The debug adapter supports the `gotoTargets` request.
1095 optional<boolean> supportsGotoTargetsRequest;
1096 // The debug adapter supports breakpoints that break execution after a
1097 // specified number of hits.
1098 optional<boolean> supportsHitConditionalBreakpoints;
1099 // The debug adapter supports adding breakpoints based on instruction
1100 // references.
1101 optional<boolean> supportsInstructionBreakpoints;
1102 // The debug adapter supports the `loadedSources` request.
1103 optional<boolean> supportsLoadedSourcesRequest;
1104 // The debug adapter supports log points by interpreting the `logMessage`
1105 // attribute of the `SourceBreakpoint`.
1106 optional<boolean> supportsLogPoints;
1107 // The debug adapter supports the `modules` request.
1108 optional<boolean> supportsModulesRequest;
1109 // The debug adapter supports the `readMemory` request.
1110 optional<boolean> supportsReadMemoryRequest;
1111 // The debug adapter supports restarting a frame.
1112 optional<boolean> supportsRestartFrame;
1113 // The debug adapter supports the `restart` request. In this case a client
1114 // should not implement `restart` by terminating and relaunching the adapter
1115 // but by calling the `restart` request.
1116 optional<boolean> supportsRestartRequest;
1117 // The debug adapter supports the `setExpression` request.
1118 optional<boolean> supportsSetExpression;
1119 // The debug adapter supports setting a variable to a value.
1120 optional<boolean> supportsSetVariable;
1121 // The debug adapter supports the `singleThread` property on the execution
1122 // requests (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`,
1123 // `stepBack`).
1124 optional<boolean> supportsSingleThreadExecutionRequests;
1125 // The debug adapter supports stepping back via the `stepBack` and
1126 // `reverseContinue` requests.
1127 optional<boolean> supportsStepBack;
1128 // The debug adapter supports the `stepInTargets` request.
1129 optional<boolean> supportsStepInTargetsRequest;
1130 // The debug adapter supports stepping granularities (argument `granularity`)
1131 // for the stepping requests.
1132 optional<boolean> supportsSteppingGranularity;
1133 // The debug adapter supports the `terminate` request.
1134 optional<boolean> supportsTerminateRequest;
1135 // The debug adapter supports the `terminateThreads` request.
1136 optional<boolean> supportsTerminateThreadsRequest;
1137 // The debug adapter supports a `format` attribute on the `stackTrace`,
1138 // `variables`, and `evaluate` requests.
1139 optional<boolean> supportsValueFormattingOptions;
1140 // The debug adapter supports the `writeMemory` request.
1141 optional<boolean> supportsWriteMemoryRequest;
1142 };
1143
1144 DAP_DECLARE_STRUCT_TYPEINFO(InitializeResponse);
1145
1146 // The `initialize` request is sent as the first request from the client to the
1147 // debug adapter in order to configure it with client capabilities and to
1148 // retrieve capabilities from the debug adapter. Until the debug adapter has
1149 // responded with an `initialize` response, the client must not send any
1150 // additional requests or events to the debug adapter. In addition the debug
1151 // adapter is not allowed to send any requests or events to the client until it
1152 // has responded with an `initialize` response. The `initialize` request may
1153 // only be sent once.
1154 struct InitializeRequest : public Request {
1155 using Response = InitializeResponse;
1156 // The ID of the debug adapter.
1157 string adapterID;
1158 // The ID of the client using this adapter.
1159 optional<string> clientID;
1160 // The human-readable name of the client using this adapter.
1161 optional<string> clientName;
1162 // If true all column numbers are 1-based (default).
1163 optional<boolean> columnsStartAt1;
1164 // If true all line numbers are 1-based (default).
1165 optional<boolean> linesStartAt1;
1166 // The ISO-639 locale of the client using this adapter, e.g. en-US or de-CH.
1167 optional<string> locale;
1168 // Determines in what format paths are specified. The default is `path`, which
1169 // is the native format.
1170 //
1171 // May be one of the following enumeration values:
1172 // 'path', 'uri'
1173 optional<string> pathFormat;
1174 // Client supports the `argsCanBeInterpretedByShell` attribute on the
1175 // `runInTerminal` request.
1176 optional<boolean> supportsArgsCanBeInterpretedByShell;
1177 // Client supports the `invalidated` event.
1178 optional<boolean> supportsInvalidatedEvent;
1179 // Client supports the `memory` event.
1180 optional<boolean> supportsMemoryEvent;
1181 // Client supports memory references.
1182 optional<boolean> supportsMemoryReferences;
1183 // Client supports progress reporting.
1184 optional<boolean> supportsProgressReporting;
1185 // Client supports the `runInTerminal` request.
1186 optional<boolean> supportsRunInTerminalRequest;
1187 // Client supports the `startDebugging` request.
1188 optional<boolean> supportsStartDebuggingRequest;
1189 // Client supports the paging of variables.
1190 optional<boolean> supportsVariablePaging;
1191 // Client supports the `type` attribute for variables.
1192 optional<boolean> supportsVariableType;
1193 };
1194
1195 DAP_DECLARE_STRUCT_TYPEINFO(InitializeRequest);
1196
1197 // This event indicates that the debug adapter is ready to accept configuration
1198 // requests (e.g. `setBreakpoints`, `setExceptionBreakpoints`). A debug adapter
1199 // is expected to send this event when it is ready to accept configuration
1200 // requests (but not before the `initialize` request has finished). The sequence
1201 // of events/requests is as follows:
1202 // - adapters sends `initialized` event (after the `initialize` request has
1203 // returned)
1204 // - client sends zero or more `setBreakpoints` requests
1205 // - client sends one `setFunctionBreakpoints` request (if corresponding
1206 // capability `supportsFunctionBreakpoints` is true)
1207 // - client sends a `setExceptionBreakpoints` request if one or more
1208 // `exceptionBreakpointFilters` have been defined (or if
1209 // `supportsConfigurationDoneRequest` is not true)
1210 // - client sends other future configuration requests
1211 // - client sends one `configurationDone` request to indicate the end of the
1212 // configuration.
1213 struct InitializedEvent : public Event {};
1214
1215 DAP_DECLARE_STRUCT_TYPEINFO(InitializedEvent);
1216
1217 // Logical areas that can be invalidated by the `invalidated` event.
1218 using InvalidatedAreas = string;
1219
1220 // This event signals that some state in the debug adapter has changed and
1221 // requires that the client needs to re-render the data snapshot previously
1222 // requested. Debug adapters do not have to emit this event for runtime changes
1223 // like stopped or thread events because in that case the client refetches the
1224 // new state anyway. But the event can be used for example to refresh the UI
1225 // after rendering formatting has changed in the debug adapter. This event
1226 // should only be sent if the corresponding capability
1227 // `supportsInvalidatedEvent` is true.
1228 struct InvalidatedEvent : public Event {
1229 // Set of logical areas that got invalidated. This property has a hint
1230 // characteristic: a client can only be expected to make a 'best effort' in
1231 // honoring the areas but there are no guarantees. If this property is
1232 // missing, empty, or if values are not understood, the client should assume a
1233 // single value `all`.
1234 optional<array<InvalidatedAreas>> areas;
1235 // If specified, the client only needs to refetch data related to this stack
1236 // frame (and the `threadId` is ignored).
1237 optional<integer> stackFrameId;
1238 // If specified, the client only needs to refetch data related to this thread.
1239 optional<integer> threadId;
1240 };
1241
1242 DAP_DECLARE_STRUCT_TYPEINFO(InvalidatedEvent);
1243
1244 // Response to `launch` request. This is just an acknowledgement, so no body
1245 // field is required.
1246 struct LaunchResponse : public Response {};
1247
1248 DAP_DECLARE_STRUCT_TYPEINFO(LaunchResponse);
1249
1250 // This launch request is sent from the client to the debug adapter to start the
1251 // debuggee with or without debugging (if `noDebug` is true). Since launching is
1252 // debugger/runtime specific, the arguments for this request are not part of
1253 // this specification.
1254 struct LaunchRequest : public Request {
1255 using Response = LaunchResponse;
1256 // Arbitrary data from the previous, restarted session.
1257 // The data is sent as the `restart` attribute of the `terminated` event.
1258 // The client should leave the data intact.
1259 optional<variant<array<any>, boolean, integer, null, number, object, string>>
1260 restart;
1261 // If true, the launch request should launch the program without enabling
1262 // debugging.
1263 optional<boolean> noDebug;
1264 };
1265
1266 DAP_DECLARE_STRUCT_TYPEINFO(LaunchRequest);
1267
1268 // The event indicates that some source has been added, changed, or removed from
1269 // the set of all loaded sources.
1270 struct LoadedSourceEvent : public Event {
1271 // The reason for the event.
1272 //
1273 // Must be one of the following enumeration values:
1274 // 'new', 'changed', 'removed'
1275 string reason = "new";
1276 // The new, changed, or removed source.
1277 Source source;
1278 };
1279
1280 DAP_DECLARE_STRUCT_TYPEINFO(LoadedSourceEvent);
1281
1282 // Response to `loadedSources` request.
1283 struct LoadedSourcesResponse : public Response {
1284 // Set of loaded sources.
1285 array<Source> sources;
1286 };
1287
1288 DAP_DECLARE_STRUCT_TYPEINFO(LoadedSourcesResponse);
1289
1290 // Retrieves the set of all sources currently loaded by the debugged process.
1291 // Clients should only call this request if the corresponding capability
1292 // `supportsLoadedSourcesRequest` is true.
1293 struct LoadedSourcesRequest : public Request {
1294 using Response = LoadedSourcesResponse;
1295 };
1296
1297 DAP_DECLARE_STRUCT_TYPEINFO(LoadedSourcesRequest);
1298
1299 // This event indicates that some memory range has been updated. It should only
1300 // be sent if the corresponding capability `supportsMemoryEvent` is true.
1301 // Clients typically react to the event by re-issuing a `readMemory` request if
1302 // they show the memory identified by the `memoryReference` and if the updated
1303 // memory range overlaps the displayed range. Clients should not make
1304 // assumptions how individual memory references relate to each other, so they
1305 // should not assume that they are part of a single continuous address range and
1306 // might overlap. Debug adapters can use this event to indicate that the
1307 // contents of a memory range has changed due to some other request like
1308 // `setVariable` or `setExpression`. Debug adapters are not expected to emit
1309 // this event for each and every memory change of a running program, because
1310 // that information is typically not available from debuggers and it would flood
1311 // clients with too many events.
1312 struct MemoryEvent : public Event {
1313 // Number of bytes updated.
1314 integer count;
1315 // Memory reference of a memory range that has been updated.
1316 string memoryReference;
1317 // Starting offset in bytes where memory has been updated. Can be negative.
1318 integer offset;
1319 };
1320
1321 DAP_DECLARE_STRUCT_TYPEINFO(MemoryEvent);
1322
1323 // A Module object represents a row in the modules view.
1324 // The `id` attribute identifies a module in the modules view and is used in a
1325 // `module` event for identifying a module for adding, updating or deleting. The
1326 // `name` attribute is used to minimally render the module in the UI.
1327 //
1328 // Additional attributes can be added to the module. They show up in the module
1329 // view if they have a corresponding `ColumnDescriptor`.
1330 //
1331 // To avoid an unnecessary proliferation of additional attributes with similar
1332 // semantics but different names, we recommend to re-use attributes from the
1333 // 'recommended' list below first, and only introduce new attributes if nothing
1334 // appropriate could be found.
1335 struct Module {
1336 // Address range covered by this module.
1337 optional<string> addressRange;
1338 // Module created or modified, encoded as a RFC 3339 timestamp.
1339 optional<string> dateTimeStamp;
1340 // Unique identifier for the module.
1341 variant<integer, string> id;
1342 // True if the module is optimized.
1343 optional<boolean> isOptimized;
1344 // True if the module is considered 'user code' by a debugger that supports
1345 // 'Just My Code'.
1346 optional<boolean> isUserCode;
1347 // A name of the module.
1348 string name;
1349 // Logical full path to the module. The exact definition is implementation
1350 // defined, but usually this would be a full path to the on-disk file for the
1351 // module.
1352 optional<string> path;
1353 // Logical full path to the symbol file. The exact definition is
1354 // implementation defined.
1355 optional<string> symbolFilePath;
1356 // User-understandable description of if symbols were found for the module
1357 // (ex: 'Symbols Loaded', 'Symbols not found', etc.)
1358 optional<string> symbolStatus;
1359 // Version of Module.
1360 optional<string> version;
1361 };
1362
1363 DAP_DECLARE_STRUCT_TYPEINFO(Module);
1364
1365 // The event indicates that some information about a module has changed.
1366 struct ModuleEvent : public Event {
1367 // The new, changed, or removed module. In case of `removed` only the module
1368 // id is used.
1369 Module module;
1370 // The reason for the event.
1371 //
1372 // Must be one of the following enumeration values:
1373 // 'new', 'changed', 'removed'
1374 string reason = "new";
1375 };
1376
1377 DAP_DECLARE_STRUCT_TYPEINFO(ModuleEvent);
1378
1379 // Response to `modules` request.
1380 struct ModulesResponse : public Response {
1381 // All modules or range of modules.
1382 array<Module> modules;
1383 // The total number of modules available.
1384 optional<integer> totalModules;
1385 };
1386
1387 DAP_DECLARE_STRUCT_TYPEINFO(ModulesResponse);
1388
1389 // Modules can be retrieved from the debug adapter with this request which can
1390 // either return all modules or a range of modules to support paging. Clients
1391 // should only call this request if the corresponding capability
1392 // `supportsModulesRequest` is true.
1393 struct ModulesRequest : public Request {
1394 using Response = ModulesResponse;
1395 // The number of modules to return. If `moduleCount` is not specified or 0,
1396 // all modules are returned.
1397 optional<integer> moduleCount;
1398 // The index of the first module to return; if omitted modules start at 0.
1399 optional<integer> startModule;
1400 };
1401
1402 DAP_DECLARE_STRUCT_TYPEINFO(ModulesRequest);
1403
1404 // Response to `next` request. This is just an acknowledgement, so no body field
1405 // is required.
1406 struct NextResponse : public Response {};
1407
1408 DAP_DECLARE_STRUCT_TYPEINFO(NextResponse);
1409
1410 // The granularity of one 'step' in the stepping requests `next`, `stepIn`,
1411 // `stepOut`, and `stepBack`.
1412 //
1413 // Must be one of the following enumeration values:
1414 // 'statement', 'line', 'instruction'
1415 using SteppingGranularity = string;
1416
1417 // The request executes one step (in the given granularity) for the specified
1418 // thread and allows all other threads to run freely by resuming them. If the
1419 // debug adapter supports single thread execution (see capability
1420 // `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument
1421 // to true prevents other suspended threads from resuming. The debug adapter
1422 // first sends the response and then a `stopped` event (with reason `step`)
1423 // after the step has completed.
1424 struct NextRequest : public Request {
1425 using Response = NextResponse;
1426 // Stepping granularity. If no granularity is specified, a granularity of
1427 // `statement` is assumed.
1428 optional<SteppingGranularity> granularity;
1429 // If this flag is true, all other suspended threads are not resumed.
1430 optional<boolean> singleThread;
1431 // Specifies the thread for which to resume execution for one step (of the
1432 // given granularity).
1433 integer threadId;
1434 };
1435
1436 DAP_DECLARE_STRUCT_TYPEINFO(NextRequest);
1437
1438 // The event indicates that the target has produced some output.
1439 struct OutputEvent : public Event {
1440 // The output category. If not specified or if the category is not understood
1441 // by the client, `console` is assumed.
1442 //
1443 // May be one of the following enumeration values:
1444 // 'console', 'important', 'stdout', 'stderr', 'telemetry'
1445 optional<string> category;
1446 // The position in `line` where the output was produced. It is measured in
1447 // UTF-16 code units and the client capability `columnsStartAt1` determines
1448 // whether it is 0- or 1-based.
1449 optional<integer> column;
1450 // Additional data to report. For the `telemetry` category the data is sent to
1451 // telemetry, for the other categories the data is shown in JSON format.
1452 optional<variant<array<any>, boolean, integer, null, number, object, string>>
1453 data;
1454 // Support for keeping an output log organized by grouping related messages.
1455 //
1456 // Must be one of the following enumeration values:
1457 // 'start', 'startCollapsed', 'end'
1458 optional<string> group;
1459 // The source location's line where the output was produced.
1460 optional<integer> line;
1461 // The output to report.
1462 string output;
1463 // The source location where the output was produced.
1464 optional<Source> source;
1465 // If an attribute `variablesReference` exists and its value is > 0, the
1466 // output contains objects which can be retrieved by passing
1467 // `variablesReference` to the `variables` request as long as execution
1468 // remains suspended. See 'Lifetime of Object References' in the Overview
1469 // section for details.
1470 optional<integer> variablesReference;
1471 };
1472
1473 DAP_DECLARE_STRUCT_TYPEINFO(OutputEvent);
1474
1475 // Response to `pause` request. This is just an acknowledgement, so no body
1476 // field is required.
1477 struct PauseResponse : public Response {};
1478
1479 DAP_DECLARE_STRUCT_TYPEINFO(PauseResponse);
1480
1481 // The request suspends the debuggee.
1482 // The debug adapter first sends the response and then a `stopped` event (with
1483 // reason `pause`) after the thread has been paused successfully.
1484 struct PauseRequest : public Request {
1485 using Response = PauseResponse;
1486 // Pause execution for this thread.
1487 integer threadId;
1488 };
1489
1490 DAP_DECLARE_STRUCT_TYPEINFO(PauseRequest);
1491
1492 // The event indicates that the debugger has begun debugging a new process.
1493 // Either one that it has launched, or one that it has attached to.
1494 struct ProcessEvent : public Event {
1495 // If true, the process is running on the same computer as the debug adapter.
1496 optional<boolean> isLocalProcess;
1497 // The logical name of the process. This is usually the full path to process's
1498 // executable file. Example: /home/example/myproj/program.js.
1499 string name;
1500 // The size of a pointer or address for this process, in bits. This value may
1501 // be used by clients when formatting addresses for display.
1502 optional<integer> pointerSize;
1503 // Describes how the debug engine started debugging this process.
1504 //
1505 // Must be one of the following enumeration values:
1506 // 'launch', 'attach', 'attachForSuspendedLaunch'
1507 optional<string> startMethod;
1508 // The system process id of the debugged process. This property is missing for
1509 // non-system processes.
1510 optional<integer> systemProcessId;
1511 };
1512
1513 DAP_DECLARE_STRUCT_TYPEINFO(ProcessEvent);
1514
1515 // The event signals the end of the progress reporting with a final message.
1516 // This event should only be sent if the corresponding capability
1517 // `supportsProgressReporting` is true.
1518 struct ProgressEndEvent : public Event {
1519 // More detailed progress message. If omitted, the previous message (if any)
1520 // is used.
1521 optional<string> message;
1522 // The ID that was introduced in the initial `ProgressStartEvent`.
1523 string progressId;
1524 };
1525
1526 DAP_DECLARE_STRUCT_TYPEINFO(ProgressEndEvent);
1527
1528 // The event signals that a long running operation is about to start and
1529 // provides additional information for the client to set up a corresponding
1530 // progress and cancellation UI. The client is free to delay the showing of the
1531 // UI in order to reduce flicker. This event should only be sent if the
1532 // corresponding capability `supportsProgressReporting` is true.
1533 struct ProgressStartEvent : public Event {
1534 // If true, the request that reports progress may be cancelled with a `cancel`
1535 // request. So this property basically controls whether the client should use
1536 // UX that supports cancellation. Clients that don't support cancellation are
1537 // allowed to ignore the setting.
1538 optional<boolean> cancellable;
1539 // More detailed progress message.
1540 optional<string> message;
1541 // Progress percentage to display (value range: 0 to 100). If omitted no
1542 // percentage is shown.
1543 optional<number> percentage;
1544 // An ID that can be used in subsequent `progressUpdate` and `progressEnd`
1545 // events to make them refer to the same progress reporting. IDs must be
1546 // unique within a debug session.
1547 string progressId;
1548 // The request ID that this progress report is related to. If specified a
1549 // debug adapter is expected to emit progress events for the long running
1550 // request until the request has been either completed or cancelled. If the
1551 // request ID is omitted, the progress report is assumed to be related to some
1552 // general activity of the debug adapter.
1553 optional<integer> requestId;
1554 // Short title of the progress reporting. Shown in the UI to describe the long
1555 // running operation.
1556 string title;
1557 };
1558
1559 DAP_DECLARE_STRUCT_TYPEINFO(ProgressStartEvent);
1560
1561 // The event signals that the progress reporting needs to be updated with a new
1562 // message and/or percentage. The client does not have to update the UI
1563 // immediately, but the clients needs to keep track of the message and/or
1564 // percentage values. This event should only be sent if the corresponding
1565 // capability `supportsProgressReporting` is true.
1566 struct ProgressUpdateEvent : public Event {
1567 // More detailed progress message. If omitted, the previous message (if any)
1568 // is used.
1569 optional<string> message;
1570 // Progress percentage to display (value range: 0 to 100). If omitted no
1571 // percentage is shown.
1572 optional<number> percentage;
1573 // The ID that was introduced in the initial `progressStart` event.
1574 string progressId;
1575 };
1576
1577 DAP_DECLARE_STRUCT_TYPEINFO(ProgressUpdateEvent);
1578
1579 // Response to `readMemory` request.
1580 struct ReadMemoryResponse : public Response {
1581 // The address of the first byte of data returned.
1582 // Treated as a hex value if prefixed with `0x`, or as a decimal value
1583 // otherwise.
1584 string address;
1585 // The bytes read from memory, encoded using base64. If the decoded length of
1586 // `data` is less than the requested `count` in the original `readMemory`
1587 // request, and `unreadableBytes` is zero or omitted, then the client should
1588 // assume it's reached the end of readable memory.
1589 optional<string> data;
1590 // The number of unreadable bytes encountered after the last successfully read
1591 // byte. This can be used to determine the number of bytes that should be
1592 // skipped before a subsequent `readMemory` request succeeds.
1593 optional<integer> unreadableBytes;
1594 };
1595
1596 DAP_DECLARE_STRUCT_TYPEINFO(ReadMemoryResponse);
1597
1598 // Reads bytes from memory at the provided location.
1599 // Clients should only call this request if the corresponding capability
1600 // `supportsReadMemoryRequest` is true.
1601 struct ReadMemoryRequest : public Request {
1602 using Response = ReadMemoryResponse;
1603 // Number of bytes to read at the specified location and offset.
1604 integer count;
1605 // Memory reference to the base location from which data should be read.
1606 string memoryReference;
1607 // Offset (in bytes) to be applied to the reference location before reading
1608 // data. Can be negative.
1609 optional<integer> offset;
1610 };
1611
1612 DAP_DECLARE_STRUCT_TYPEINFO(ReadMemoryRequest);
1613
1614 // Response to `restartFrame` request. This is just an acknowledgement, so no
1615 // body field is required.
1616 struct RestartFrameResponse : public Response {};
1617
1618 DAP_DECLARE_STRUCT_TYPEINFO(RestartFrameResponse);
1619
1620 // The request restarts execution of the specified stack frame.
1621 // The debug adapter first sends the response and then a `stopped` event (with
1622 // reason `restart`) after the restart has completed. Clients should only call
1623 // this request if the corresponding capability `supportsRestartFrame` is true.
1624 struct RestartFrameRequest : public Request {
1625 using Response = RestartFrameResponse;
1626 // Restart the stack frame identified by `frameId`. The `frameId` must have
1627 // been obtained in the current suspended state. See 'Lifetime of Object
1628 // References' in the Overview section for details.
1629 integer frameId;
1630 };
1631
1632 DAP_DECLARE_STRUCT_TYPEINFO(RestartFrameRequest);
1633
1634 // Response to `restart` request. This is just an acknowledgement, so no body
1635 // field is required.
1636 struct RestartResponse : public Response {};
1637
1638 DAP_DECLARE_STRUCT_TYPEINFO(RestartResponse);
1639
1640 // Restarts a debug session. Clients should only call this request if the
1641 // corresponding capability `supportsRestartRequest` is true. If the capability
1642 // is missing or has the value false, a typical client emulates `restart` by
1643 // terminating the debug adapter first and then launching it anew.
1644 struct RestartRequest : public Request {
1645 using Response = RestartResponse;
1646 // The latest version of the `launch` or `attach` configuration.
1647 optional<object> arguments;
1648 };
1649
1650 DAP_DECLARE_STRUCT_TYPEINFO(RestartRequest);
1651
1652 // Response to `reverseContinue` request. This is just an acknowledgement, so no
1653 // body field is required.
1654 struct ReverseContinueResponse : public Response {};
1655
1656 DAP_DECLARE_STRUCT_TYPEINFO(ReverseContinueResponse);
1657
1658 // The request resumes backward execution of all threads. If the debug adapter
1659 // supports single thread execution (see capability
1660 // `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument
1661 // to true resumes only the specified thread. If not all threads were resumed,
1662 // the `allThreadsContinued` attribute of the response should be set to false.
1663 // Clients should only call this request if the corresponding capability
1664 // `supportsStepBack` is true.
1665 struct ReverseContinueRequest : public Request {
1666 using Response = ReverseContinueResponse;
1667 // If this flag is true, backward execution is resumed only for the thread
1668 // with given `threadId`.
1669 optional<boolean> singleThread;
1670 // Specifies the active thread. If the debug adapter supports single thread
1671 // execution (see `supportsSingleThreadExecutionRequests`) and the
1672 // `singleThread` argument is true, only the thread with this ID is resumed.
1673 integer threadId;
1674 };
1675
1676 DAP_DECLARE_STRUCT_TYPEINFO(ReverseContinueRequest);
1677
1678 // Response to `runInTerminal` request.
1679 struct RunInTerminalResponse : public Response {
1680 // The process ID. The value should be less than or equal to 2147483647
1681 // (2^31-1).
1682 optional<integer> processId;
1683 // The process ID of the terminal shell. The value should be less than or
1684 // equal to 2147483647 (2^31-1).
1685 optional<integer> shellProcessId;
1686 };
1687
1688 DAP_DECLARE_STRUCT_TYPEINFO(RunInTerminalResponse);
1689
1690 // This request is sent from the debug adapter to the client to run a command in
1691 // a terminal. This is typically used to launch the debuggee in a terminal
1692 // provided by the client. This request should only be called if the
1693 // corresponding client capability `supportsRunInTerminalRequest` is true.
1694 // Client implementations of `runInTerminal` are free to run the command however
1695 // they choose including issuing the command to a command line interpreter (aka
1696 // 'shell'). Argument strings passed to the `runInTerminal` request must arrive
1697 // verbatim in the command to be run. As a consequence, clients which use a
1698 // shell are responsible for escaping any special shell characters in the
1699 // argument strings to prevent them from being interpreted (and modified) by the
1700 // shell. Some users may wish to take advantage of shell processing in the
1701 // argument strings. For clients which implement `runInTerminal` using an
1702 // intermediary shell, the `argsCanBeInterpretedByShell` property can be set to
1703 // true. In this case the client is requested not to escape any special shell
1704 // characters in the argument strings.
1705 struct RunInTerminalRequest : public Request {
1706 using Response = RunInTerminalResponse;
1707 // List of arguments. The first argument is the command to run.
1708 array<string> args;
1709 // This property should only be set if the corresponding capability
1710 // `supportsArgsCanBeInterpretedByShell` is true. If the client uses an
1711 // intermediary shell to launch the application, then the client must not
1712 // attempt to escape characters with special meanings for the shell. The user
1713 // is fully responsible for escaping as needed and that arguments using
1714 // special characters may not be portable across shells.
1715 optional<boolean> argsCanBeInterpretedByShell;
1716 // Working directory for the command. For non-empty, valid paths this
1717 // typically results in execution of a change directory command.
1718 string cwd;
1719 // Environment key-value pairs that are added to or removed from the default
1720 // environment.
1721 optional<object> env;
1722 // What kind of terminal to launch. Defaults to `integrated` if not specified.
1723 //
1724 // Must be one of the following enumeration values:
1725 // 'integrated', 'external'
1726 optional<string> kind;
1727 // Title of the terminal.
1728 optional<string> title;
1729 };
1730
1731 DAP_DECLARE_STRUCT_TYPEINFO(RunInTerminalRequest);
1732
1733 // A `Scope` is a named container for variables. Optionally a scope can map to a
1734 // source or a range within a source.
1735 struct Scope {
1736 // Start position of the range covered by the scope. It is measured in UTF-16
1737 // code units and the client capability `columnsStartAt1` determines whether
1738 // it is 0- or 1-based.
1739 optional<integer> column;
1740 // End position of the range covered by the scope. It is measured in UTF-16
1741 // code units and the client capability `columnsStartAt1` determines whether
1742 // it is 0- or 1-based.
1743 optional<integer> endColumn;
1744 // The end line of the range covered by this scope.
1745 optional<integer> endLine;
1746 // If true, the number of variables in this scope is large or expensive to
1747 // retrieve.
1748 boolean expensive;
1749 // The number of indexed variables in this scope.
1750 // The client can use this information to present the variables in a paged UI
1751 // and fetch them in chunks.
1752 optional<integer> indexedVariables;
1753 // The start line of the range covered by this scope.
1754 optional<integer> line;
1755 // Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This
1756 // string is shown in the UI as is and can be translated.
1757 string name;
1758 // The number of named variables in this scope.
1759 // The client can use this information to present the variables in a paged UI
1760 // and fetch them in chunks.
1761 optional<integer> namedVariables;
1762 // A hint for how to present this scope in the UI. If this attribute is
1763 // missing, the scope is shown with a generic UI.
1764 //
1765 // May be one of the following enumeration values:
1766 // 'arguments', 'locals', 'registers'
1767 optional<string> presentationHint;
1768 // The source for this scope.
1769 optional<Source> source;
1770 // The variables of this scope can be retrieved by passing the value of
1771 // `variablesReference` to the `variables` request as long as execution
1772 // remains suspended. See 'Lifetime of Object References' in the Overview
1773 // section for details.
1774 integer variablesReference;
1775 };
1776
1777 DAP_DECLARE_STRUCT_TYPEINFO(Scope);
1778
1779 // Response to `scopes` request.
1780 struct ScopesResponse : public Response {
1781 // The scopes of the stack frame. If the array has length zero, there are no
1782 // scopes available.
1783 array<Scope> scopes;
1784 };
1785
1786 DAP_DECLARE_STRUCT_TYPEINFO(ScopesResponse);
1787
1788 // The request returns the variable scopes for a given stack frame ID.
1789 struct ScopesRequest : public Request {
1790 using Response = ScopesResponse;
1791 // Retrieve the scopes for the stack frame identified by `frameId`. The
1792 // `frameId` must have been obtained in the current suspended state. See
1793 // 'Lifetime of Object References' in the Overview section for details.
1794 integer frameId;
1795 };
1796
1797 DAP_DECLARE_STRUCT_TYPEINFO(ScopesRequest);
1798
1799 // Response to `setBreakpoints` request.
1800 // Returned is information about each breakpoint created by this request.
1801 // This includes the actual code location and whether the breakpoint could be
1802 // verified. The breakpoints returned are in the same order as the elements of
1803 // the `breakpoints` (or the deprecated `lines`) array in the arguments.
1804 struct SetBreakpointsResponse : public Response {
1805 // Information about the breakpoints.
1806 // The array elements are in the same order as the elements of the
1807 // `breakpoints` (or the deprecated `lines`) array in the arguments.
1808 array<Breakpoint> breakpoints;
1809 };
1810
1811 DAP_DECLARE_STRUCT_TYPEINFO(SetBreakpointsResponse);
1812
1813 // Properties of a breakpoint or logpoint passed to the `setBreakpoints`
1814 // request.
1815 struct SourceBreakpoint {
1816 // Start position within source line of the breakpoint or logpoint. It is
1817 // measured in UTF-16 code units and the client capability `columnsStartAt1`
1818 // determines whether it is 0- or 1-based.
1819 optional<integer> column;
1820 // The expression for conditional breakpoints.
1821 // It is only honored by a debug adapter if the corresponding capability
1822 // `supportsConditionalBreakpoints` is true.
1823 optional<string> condition;
1824 // The expression that controls how many hits of the breakpoint are ignored.
1825 // The debug adapter is expected to interpret the expression as needed.
1826 // The attribute is only honored by a debug adapter if the corresponding
1827 // capability `supportsHitConditionalBreakpoints` is true. If both this
1828 // property and `condition` are specified, `hitCondition` should be evaluated
1829 // only if the `condition` is met, and the debug adapter should stop only if
1830 // both conditions are met.
1831 optional<string> hitCondition;
1832 // The source line of the breakpoint or logpoint.
1833 integer line;
1834 // If this attribute exists and is non-empty, the debug adapter must not
1835 // 'break' (stop) but log the message instead. Expressions within `{}` are
1836 // interpolated. The attribute is only honored by a debug adapter if the
1837 // corresponding capability `supportsLogPoints` is true. If either
1838 // `hitCondition` or `condition` is specified, then the message should only be
1839 // logged if those conditions are met.
1840 optional<string> logMessage;
1841 // The mode of this breakpoint. If defined, this must be one of the
1842 // `breakpointModes` the debug adapter advertised in its `Capabilities`.
1843 optional<string> mode;
1844 };
1845
1846 DAP_DECLARE_STRUCT_TYPEINFO(SourceBreakpoint);
1847
1848 // Sets multiple breakpoints for a single source and clears all previous
1849 // breakpoints in that source. To clear all breakpoint for a source, specify an
1850 // empty array. When a breakpoint is hit, a `stopped` event (with reason
1851 // `breakpoint`) is generated.
1852 struct SetBreakpointsRequest : public Request {
1853 using Response = SetBreakpointsResponse;
1854 // The code locations of the breakpoints.
1855 optional<array<SourceBreakpoint>> breakpoints;
1856 // Deprecated: The code locations of the breakpoints.
1857 optional<array<integer>> lines;
1858 // The source location of the breakpoints; either `source.path` or
1859 // `source.sourceReference` must be specified.
1860 Source source;
1861 // A value of true indicates that the underlying source has been modified
1862 // which results in new breakpoint locations.
1863 optional<boolean> sourceModified;
1864 };
1865
1866 DAP_DECLARE_STRUCT_TYPEINFO(SetBreakpointsRequest);
1867
1868 // Response to `setDataBreakpoints` request.
1869 // Returned is information about each breakpoint created by this request.
1870 struct SetDataBreakpointsResponse : public Response {
1871 // Information about the data breakpoints. The array elements correspond to
1872 // the elements of the input argument `breakpoints` array.
1873 array<Breakpoint> breakpoints;
1874 };
1875
1876 DAP_DECLARE_STRUCT_TYPEINFO(SetDataBreakpointsResponse);
1877
1878 // Properties of a data breakpoint passed to the `setDataBreakpoints` request.
1879 struct DataBreakpoint {
1880 // The access type of the data.
1881 optional<DataBreakpointAccessType> accessType;
1882 // An expression for conditional breakpoints.
1883 optional<string> condition;
1884 // An id representing the data. This id is returned from the
1885 // `dataBreakpointInfo` request.
1886 string dataId;
1887 // An expression that controls how many hits of the breakpoint are ignored.
1888 // The debug adapter is expected to interpret the expression as needed.
1889 optional<string> hitCondition;
1890 };
1891
1892 DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpoint);
1893
1894 // Replaces all existing data breakpoints with new data breakpoints.
1895 // To clear all data breakpoints, specify an empty array.
1896 // When a data breakpoint is hit, a `stopped` event (with reason `data
1897 // breakpoint`) is generated. Clients should only call this request if the
1898 // corresponding capability `supportsDataBreakpoints` is true.
1899 struct SetDataBreakpointsRequest : public Request {
1900 using Response = SetDataBreakpointsResponse;
1901 // The contents of this array replaces all existing data breakpoints. An empty
1902 // array clears all data breakpoints.
1903 array<DataBreakpoint> breakpoints;
1904 };
1905
1906 DAP_DECLARE_STRUCT_TYPEINFO(SetDataBreakpointsRequest);
1907
1908 // Response to `setExceptionBreakpoints` request.
1909 // The response contains an array of `Breakpoint` objects with information about
1910 // each exception breakpoint or filter. The `Breakpoint` objects are in the same
1911 // order as the elements of the `filters`, `filterOptions`, `exceptionOptions`
1912 // arrays given as arguments. If both `filters` and `filterOptions` are given,
1913 // the returned array must start with `filters` information first, followed by
1914 // `filterOptions` information. The `verified` property of a `Breakpoint` object
1915 // signals whether the exception breakpoint or filter could be successfully
1916 // created and whether the condition is valid. In case of an error the `message`
1917 // property explains the problem. The `id` property can be used to introduce a
1918 // unique ID for the exception breakpoint or filter so that it can be updated
1919 // subsequently by sending breakpoint events. For backward compatibility both
1920 // the `breakpoints` array and the enclosing `body` are optional. If these
1921 // elements are missing a client is not able to show problems for individual
1922 // exception breakpoints or filters.
1923 struct SetExceptionBreakpointsResponse : public Response {
1924 // Information about the exception breakpoints or filters.
1925 // The breakpoints returned are in the same order as the elements of the
1926 // `filters`, `filterOptions`, `exceptionOptions` arrays in the arguments. If
1927 // both `filters` and `filterOptions` are given, the returned array must start
1928 // with `filters` information first, followed by `filterOptions` information.
1929 optional<array<Breakpoint>> breakpoints;
1930 };
1931
1932 DAP_DECLARE_STRUCT_TYPEINFO(SetExceptionBreakpointsResponse);
1933
1934 // An `ExceptionPathSegment` represents a segment in a path that is used to
1935 // match leafs or nodes in a tree of exceptions. If a segment consists of more
1936 // than one name, it matches the names provided if `negate` is false or missing,
1937 // or it matches anything except the names provided if `negate` is true.
1938 struct ExceptionPathSegment {
1939 // Depending on the value of `negate` the names that should match or not
1940 // match.
1941 array<string> names;
1942 // If false or missing this segment matches the names provided, otherwise it
1943 // matches anything except the names provided.
1944 optional<boolean> negate;
1945 };
1946
1947 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionPathSegment);
1948
1949 // An `ExceptionOptions` assigns configuration options to a set of exceptions.
1950 struct ExceptionOptions {
1951 // Condition when a thrown exception should result in a break.
1952 ExceptionBreakMode breakMode = "never";
1953 // A path that selects a single or multiple exceptions in a tree. If `path` is
1954 // missing, the whole tree is selected. By convention the first segment of the
1955 // path is a category that is used to group exceptions in the UI.
1956 optional<array<ExceptionPathSegment>> path;
1957 };
1958
1959 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionOptions);
1960
1961 // An `ExceptionFilterOptions` is used to specify an exception filter together
1962 // with a condition for the `setExceptionBreakpoints` request.
1963 struct ExceptionFilterOptions {
1964 // An expression for conditional exceptions.
1965 // The exception breaks into the debugger if the result of the condition is
1966 // true.
1967 optional<string> condition;
1968 // ID of an exception filter returned by the `exceptionBreakpointFilters`
1969 // capability.
1970 string filterId;
1971 // The mode of this exception breakpoint. If defined, this must be one of the
1972 // `breakpointModes` the debug adapter advertised in its `Capabilities`.
1973 optional<string> mode;
1974 };
1975
1976 DAP_DECLARE_STRUCT_TYPEINFO(ExceptionFilterOptions);
1977
1978 // The request configures the debugger's response to thrown exceptions. Each of
1979 // the `filters`, `filterOptions`, and `exceptionOptions` in the request are
1980 // independent configurations to a debug adapter indicating a kind of exception
1981 // to catch. An exception thrown in a program should result in a `stopped` event
1982 // from the debug adapter (with reason `exception`) if any of the configured
1983 // filters match. Clients should only call this request if the corresponding
1984 // capability `exceptionBreakpointFilters` returns one or more filters.
1985 struct SetExceptionBreakpointsRequest : public Request {
1986 using Response = SetExceptionBreakpointsResponse;
1987 // Configuration options for selected exceptions.
1988 // The attribute is only honored by a debug adapter if the corresponding
1989 // capability `supportsExceptionOptions` is true.
1990 optional<array<ExceptionOptions>> exceptionOptions;
1991 // Set of exception filters and their options. The set of all possible
1992 // exception filters is defined by the `exceptionBreakpointFilters`
1993 // capability. This attribute is only honored by a debug adapter if the
1994 // corresponding capability `supportsExceptionFilterOptions` is true. The
1995 // `filter` and `filterOptions` sets are additive.
1996 optional<array<ExceptionFilterOptions>> filterOptions;
1997 // Set of exception filters specified by their ID. The set of all possible
1998 // exception filters is defined by the `exceptionBreakpointFilters`
1999 // capability. The `filter` and `filterOptions` sets are additive.
2000 array<string> filters;
2001 };
2002
2003 DAP_DECLARE_STRUCT_TYPEINFO(SetExceptionBreakpointsRequest);
2004
2005 // Response to `setExpression` request.
2006 struct SetExpressionResponse : public Response {
2007 // The number of indexed child variables.
2008 // The client can use this information to present the variables in a paged UI
2009 // and fetch them in chunks. The value should be less than or equal to
2010 // 2147483647 (2^31-1).
2011 optional<integer> indexedVariables;
2012 // A memory reference to a location appropriate for this result.
2013 // For pointer type eval results, this is generally a reference to the memory
2014 // address contained in the pointer. This attribute may be returned by a debug
2015 // adapter if corresponding capability `supportsMemoryReferences` is true.
2016 optional<string> memoryReference;
2017 // The number of named child variables.
2018 // The client can use this information to present the variables in a paged UI
2019 // and fetch them in chunks. The value should be less than or equal to
2020 // 2147483647 (2^31-1).
2021 optional<integer> namedVariables;
2022 // Properties of a value that can be used to determine how to render the
2023 // result in the UI.
2024 optional<VariablePresentationHint> presentationHint;
2025 // The type of the value.
2026 // This attribute should only be returned by a debug adapter if the
2027 // corresponding capability `supportsVariableType` is true.
2028 optional<string> type;
2029 // The new value of the expression.
2030 string value;
2031 // If `variablesReference` is > 0, the evaluate result is structured and its
2032 // children can be retrieved by passing `variablesReference` to the
2033 // `variables` request as long as execution remains suspended. See 'Lifetime
2034 // of Object References' in the Overview section for details.
2035 optional<integer> variablesReference;
2036 };
2037
2038 DAP_DECLARE_STRUCT_TYPEINFO(SetExpressionResponse);
2039
2040 // Evaluates the given `value` expression and assigns it to the `expression`
2041 // which must be a modifiable l-value. The expressions have access to any
2042 // variables and arguments that are in scope of the specified frame. Clients
2043 // should only call this request if the corresponding capability
2044 // `supportsSetExpression` is true. If a debug adapter implements both
2045 // `setExpression` and `setVariable`, a client uses `setExpression` if the
2046 // variable has an `evaluateName` property.
2047 struct SetExpressionRequest : public Request {
2048 using Response = SetExpressionResponse;
2049 // The l-value expression to assign to.
2050 string expression;
2051 // Specifies how the resulting value should be formatted.
2052 optional<ValueFormat> format;
2053 // Evaluate the expressions in the scope of this stack frame. If not
2054 // specified, the expressions are evaluated in the global scope.
2055 optional<integer> frameId;
2056 // The value expression to assign to the l-value expression.
2057 string value;
2058 };
2059
2060 DAP_DECLARE_STRUCT_TYPEINFO(SetExpressionRequest);
2061
2062 // Response to `setFunctionBreakpoints` request.
2063 // Returned is information about each breakpoint created by this request.
2064 struct SetFunctionBreakpointsResponse : public Response {
2065 // Information about the breakpoints. The array elements correspond to the
2066 // elements of the `breakpoints` array.
2067 array<Breakpoint> breakpoints;
2068 };
2069
2070 DAP_DECLARE_STRUCT_TYPEINFO(SetFunctionBreakpointsResponse);
2071
2072 // Properties of a breakpoint passed to the `setFunctionBreakpoints` request.
2073 struct FunctionBreakpoint {
2074 // An expression for conditional breakpoints.
2075 // It is only honored by a debug adapter if the corresponding capability
2076 // `supportsConditionalBreakpoints` is true.
2077 optional<string> condition;
2078 // An expression that controls how many hits of the breakpoint are ignored.
2079 // The debug adapter is expected to interpret the expression as needed.
2080 // The attribute is only honored by a debug adapter if the corresponding
2081 // capability `supportsHitConditionalBreakpoints` is true.
2082 optional<string> hitCondition;
2083 // The name of the function.
2084 string name;
2085 };
2086
2087 DAP_DECLARE_STRUCT_TYPEINFO(FunctionBreakpoint);
2088
2089 // Replaces all existing function breakpoints with new function breakpoints.
2090 // To clear all function breakpoints, specify an empty array.
2091 // When a function breakpoint is hit, a `stopped` event (with reason `function
2092 // breakpoint`) is generated. Clients should only call this request if the
2093 // corresponding capability `supportsFunctionBreakpoints` is true.
2094 struct SetFunctionBreakpointsRequest : public Request {
2095 using Response = SetFunctionBreakpointsResponse;
2096 // The function names of the breakpoints.
2097 array<FunctionBreakpoint> breakpoints;
2098 };
2099
2100 DAP_DECLARE_STRUCT_TYPEINFO(SetFunctionBreakpointsRequest);
2101
2102 // Response to `setInstructionBreakpoints` request
2103 struct SetInstructionBreakpointsResponse : public Response {
2104 // Information about the breakpoints. The array elements correspond to the
2105 // elements of the `breakpoints` array.
2106 array<Breakpoint> breakpoints;
2107 };
2108
2109 DAP_DECLARE_STRUCT_TYPEINFO(SetInstructionBreakpointsResponse);
2110
2111 // Properties of a breakpoint passed to the `setInstructionBreakpoints` request
2112 struct InstructionBreakpoint {
2113 // An expression for conditional breakpoints.
2114 // It is only honored by a debug adapter if the corresponding capability
2115 // `supportsConditionalBreakpoints` is true.
2116 optional<string> condition;
2117 // An expression that controls how many hits of the breakpoint are ignored.
2118 // The debug adapter is expected to interpret the expression as needed.
2119 // The attribute is only honored by a debug adapter if the corresponding
2120 // capability `supportsHitConditionalBreakpoints` is true.
2121 optional<string> hitCondition;
2122 // The instruction reference of the breakpoint.
2123 // This should be a memory or instruction pointer reference from an
2124 // `EvaluateResponse`, `Variable`, `StackFrame`, `GotoTarget`, or
2125 // `Breakpoint`.
2126 string instructionReference;
2127 // The mode of this breakpoint. If defined, this must be one of the
2128 // `breakpointModes` the debug adapter advertised in its `Capabilities`.
2129 optional<string> mode;
2130 // The offset from the instruction reference in bytes.
2131 // This can be negative.
2132 optional<integer> offset;
2133 };
2134
2135 DAP_DECLARE_STRUCT_TYPEINFO(InstructionBreakpoint);
2136
2137 // Replaces all existing instruction breakpoints. Typically, instruction
2138 // breakpoints would be set from a disassembly window. To clear all instruction
2139 // breakpoints, specify an empty array. When an instruction breakpoint is hit, a
2140 // `stopped` event (with reason `instruction breakpoint`) is generated. Clients
2141 // should only call this request if the corresponding capability
2142 // `supportsInstructionBreakpoints` is true.
2143 struct SetInstructionBreakpointsRequest : public Request {
2144 using Response = SetInstructionBreakpointsResponse;
2145 // The instruction references of the breakpoints
2146 array<InstructionBreakpoint> breakpoints;
2147 };
2148
2149 DAP_DECLARE_STRUCT_TYPEINFO(SetInstructionBreakpointsRequest);
2150
2151 // Response to `setVariable` request.
2152 struct SetVariableResponse : public Response {
2153 // The number of indexed child variables.
2154 // The client can use this information to present the variables in a paged UI
2155 // and fetch them in chunks. The value should be less than or equal to
2156 // 2147483647 (2^31-1).
2157 optional<integer> indexedVariables;
2158 // A memory reference to a location appropriate for this result.
2159 // For pointer type eval results, this is generally a reference to the memory
2160 // address contained in the pointer. This attribute may be returned by a debug
2161 // adapter if corresponding capability `supportsMemoryReferences` is true.
2162 optional<string> memoryReference;
2163 // The number of named child variables.
2164 // The client can use this information to present the variables in a paged UI
2165 // and fetch them in chunks. The value should be less than or equal to
2166 // 2147483647 (2^31-1).
2167 optional<integer> namedVariables;
2168 // The type of the new value. Typically shown in the UI when hovering over the
2169 // value.
2170 optional<string> type;
2171 // The new value of the variable.
2172 string value;
2173 // If `variablesReference` is > 0, the new value is structured and its
2174 // children can be retrieved by passing `variablesReference` to the
2175 // `variables` request as long as execution remains suspended. See 'Lifetime
2176 // of Object References' in the Overview section for details.
2177 optional<integer> variablesReference;
2178 };
2179
2180 DAP_DECLARE_STRUCT_TYPEINFO(SetVariableResponse);
2181
2182 // Set the variable with the given name in the variable container to a new
2183 // value. Clients should only call this request if the corresponding capability
2184 // `supportsSetVariable` is true. If a debug adapter implements both
2185 // `setVariable` and `setExpression`, a client will only use `setExpression` if
2186 // the variable has an `evaluateName` property.
2187 struct SetVariableRequest : public Request {
2188 using Response = SetVariableResponse;
2189 // Specifies details on how to format the response value.
2190 optional<ValueFormat> format;
2191 // The name of the variable in the container.
2192 string name;
2193 // The value of the variable.
2194 string value;
2195 // The reference of the variable container. The `variablesReference` must have
2196 // been obtained in the current suspended state. See 'Lifetime of Object
2197 // References' in the Overview section for details.
2198 integer variablesReference;
2199 };
2200
2201 DAP_DECLARE_STRUCT_TYPEINFO(SetVariableRequest);
2202
2203 // Response to `source` request.
2204 struct SourceResponse : public Response {
2205 // Content of the source reference.
2206 string content;
2207 // Content type (MIME type) of the source.
2208 optional<string> mimeType;
2209 };
2210
2211 DAP_DECLARE_STRUCT_TYPEINFO(SourceResponse);
2212
2213 // The request retrieves the source code for a given source reference.
2214 struct SourceRequest : public Request {
2215 using Response = SourceResponse;
2216 // Specifies the source content to load. Either `source.path` or
2217 // `source.sourceReference` must be specified.
2218 optional<Source> source;
2219 // The reference to the source. This is the same as `source.sourceReference`.
2220 // This is provided for backward compatibility since old clients do not
2221 // understand the `source` attribute.
2222 integer sourceReference;
2223 };
2224
2225 DAP_DECLARE_STRUCT_TYPEINFO(SourceRequest);
2226
2227 // A Stackframe contains the source location.
2228 struct StackFrame {
2229 // Indicates whether this frame can be restarted with the `restart` request.
2230 // Clients should only use this if the debug adapter supports the `restart`
2231 // request and the corresponding capability `supportsRestartRequest` is true.
2232 // If a debug adapter has this capability, then `canRestart` defaults to
2233 // `true` if the property is absent.
2234 optional<boolean> canRestart;
2235 // Start position of the range covered by the stack frame. It is measured in
2236 // UTF-16 code units and the client capability `columnsStartAt1` determines
2237 // whether it is 0- or 1-based. If attribute `source` is missing or doesn't
2238 // exist, `column` is 0 and should be ignored by the client.
2239 integer column;
2240 // End position of the range covered by the stack frame. It is measured in
2241 // UTF-16 code units and the client capability `columnsStartAt1` determines
2242 // whether it is 0- or 1-based.
2243 optional<integer> endColumn;
2244 // The end line of the range covered by the stack frame.
2245 optional<integer> endLine;
2246 // An identifier for the stack frame. It must be unique across all threads.
2247 // This id can be used to retrieve the scopes of the frame with the `scopes`
2248 // request or to restart the execution of a stack frame.
2249 integer id;
2250 // A memory reference for the current instruction pointer in this frame.
2251 optional<string> instructionPointerReference;
2252 // The line within the source of the frame. If the source attribute is missing
2253 // or doesn't exist, `line` is 0 and should be ignored by the client.
2254 integer line;
2255 // The module associated with this frame, if any.
2256 optional<variant<integer, string>> moduleId;
2257 // The name of the stack frame, typically a method name.
2258 string name;
2259 // A hint for how to present this frame in the UI.
2260 // A value of `label` can be used to indicate that the frame is an artificial
2261 // frame that is used as a visual label or separator. A value of `subtle` can
2262 // be used to change the appearance of a frame in a 'subtle' way.
2263 //
2264 // Must be one of the following enumeration values:
2265 // 'normal', 'label', 'subtle'
2266 optional<string> presentationHint;
2267 // The source of the frame.
2268 optional<Source> source;
2269 };
2270
2271 DAP_DECLARE_STRUCT_TYPEINFO(StackFrame);
2272
2273 // Response to `stackTrace` request.
2274 struct StackTraceResponse : public Response {
2275 // The frames of the stack frame. If the array has length zero, there are no
2276 // stack frames available. This means that there is no location information
2277 // available.
2278 array<StackFrame> stackFrames;
2279 // The total number of frames available in the stack. If omitted or if
2280 // `totalFrames` is larger than the available frames, a client is expected to
2281 // request frames until a request returns less frames than requested (which
2282 // indicates the end of the stack). Returning monotonically increasing
2283 // `totalFrames` values for subsequent requests can be used to enforce paging
2284 // in the client.
2285 optional<integer> totalFrames;
2286 };
2287
2288 DAP_DECLARE_STRUCT_TYPEINFO(StackTraceResponse);
2289
2290 // Provides formatting information for a stack frame.
2291 struct StackFrameFormat : public ValueFormat {
2292 // Includes all stack frames, including those the debug adapter might
2293 // otherwise hide.
2294 optional<boolean> includeAll;
2295 // Displays the line number of the stack frame.
2296 optional<boolean> line;
2297 // Displays the module of the stack frame.
2298 optional<boolean> module;
2299 // Displays the names of parameters for the stack frame.
2300 optional<boolean> parameterNames;
2301 // Displays the types of parameters for the stack frame.
2302 optional<boolean> parameterTypes;
2303 // Displays the values of parameters for the stack frame.
2304 optional<boolean> parameterValues;
2305 // Displays parameters for the stack frame.
2306 optional<boolean> parameters;
2307 };
2308
2309 DAP_DECLARE_STRUCT_TYPEINFO(StackFrameFormat);
2310
2311 // The request returns a stacktrace from the current execution state of a given
2312 // thread. A client can request all stack frames by omitting the startFrame and
2313 // levels arguments. For performance-conscious clients and if the corresponding
2314 // capability `supportsDelayedStackTraceLoading` is true, stack frames can be
2315 // retrieved in a piecemeal way with the `startFrame` and `levels` arguments.
2316 // The response of the `stackTrace` request may contain a `totalFrames` property
2317 // that hints at the total number of frames in the stack. If a client needs this
2318 // total number upfront, it can issue a request for a single (first) frame and
2319 // depending on the value of `totalFrames` decide how to proceed. In any case a
2320 // client should be prepared to receive fewer frames than requested, which is an
2321 // indication that the end of the stack has been reached.
2322 struct StackTraceRequest : public Request {
2323 using Response = StackTraceResponse;
2324 // Specifies details on how to format the stack frames.
2325 // The attribute is only honored by a debug adapter if the corresponding
2326 // capability `supportsValueFormattingOptions` is true.
2327 optional<StackFrameFormat> format;
2328 // The maximum number of frames to return. If levels is not specified or 0,
2329 // all frames are returned.
2330 optional<integer> levels;
2331 // The index of the first frame to return; if omitted frames start at 0.
2332 optional<integer> startFrame;
2333 // Retrieve the stacktrace for this thread.
2334 integer threadId;
2335 };
2336
2337 DAP_DECLARE_STRUCT_TYPEINFO(StackTraceRequest);
2338
2339 // Response to `startDebugging` request. This is just an acknowledgement, so no
2340 // body field is required.
2341 struct StartDebuggingResponse : public Response {};
2342
2343 DAP_DECLARE_STRUCT_TYPEINFO(StartDebuggingResponse);
2344
2345 // This request is sent from the debug adapter to the client to start a new
2346 // debug session of the same type as the caller. This request should only be
2347 // sent if the corresponding client capability `supportsStartDebuggingRequest`
2348 // is true. A client implementation of `startDebugging` should start a new debug
2349 // session (of the same type as the caller) in the same way that the caller's
2350 // session was started. If the client supports hierarchical debug sessions, the
2351 // newly created session can be treated as a child of the caller session.
2352 struct StartDebuggingRequest : public Request {
2353 using Response = StartDebuggingResponse;
2354 // Arguments passed to the new debug session. The arguments must only contain
2355 // properties understood by the `launch` or `attach` requests of the debug
2356 // adapter and they must not contain any client-specific properties (e.g.
2357 // `type`) or client-specific features (e.g. substitutable 'variables').
2358 object configuration;
2359 // Indicates whether the new debug session should be started with a `launch`
2360 // or `attach` request.
2361 //
2362 // Must be one of the following enumeration values:
2363 // 'launch', 'attach'
2364 string request = "launch";
2365 };
2366
2367 DAP_DECLARE_STRUCT_TYPEINFO(StartDebuggingRequest);
2368
2369 // Response to `stepBack` request. This is just an acknowledgement, so no body
2370 // field is required.
2371 struct StepBackResponse : public Response {};
2372
2373 DAP_DECLARE_STRUCT_TYPEINFO(StepBackResponse);
2374
2375 // The request executes one backward step (in the given granularity) for the
2376 // specified thread and allows all other threads to run backward freely by
2377 // resuming them. If the debug adapter supports single thread execution (see
2378 // capability `supportsSingleThreadExecutionRequests`), setting the
2379 // `singleThread` argument to true prevents other suspended threads from
2380 // resuming. The debug adapter first sends the response and then a `stopped`
2381 // event (with reason `step`) after the step has completed. Clients should only
2382 // call this request if the corresponding capability `supportsStepBack` is true.
2383 struct StepBackRequest : public Request {
2384 using Response = StepBackResponse;
2385 // Stepping granularity to step. If no granularity is specified, a granularity
2386 // of `statement` is assumed.
2387 optional<SteppingGranularity> granularity;
2388 // If this flag is true, all other suspended threads are not resumed.
2389 optional<boolean> singleThread;
2390 // Specifies the thread for which to resume execution for one step backwards
2391 // (of the given granularity).
2392 integer threadId;
2393 };
2394
2395 DAP_DECLARE_STRUCT_TYPEINFO(StepBackRequest);
2396
2397 // Response to `stepIn` request. This is just an acknowledgement, so no body
2398 // field is required.
2399 struct StepInResponse : public Response {};
2400
2401 DAP_DECLARE_STRUCT_TYPEINFO(StepInResponse);
2402
2403 // The request resumes the given thread to step into a function/method and
2404 // allows all other threads to run freely by resuming them. If the debug adapter
2405 // supports single thread execution (see capability
2406 // `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument
2407 // to true prevents other suspended threads from resuming. If the request cannot
2408 // step into a target, `stepIn` behaves like the `next` request. The debug
2409 // adapter first sends the response and then a `stopped` event (with reason
2410 // `step`) after the step has completed. If there are multiple function/method
2411 // calls (or other targets) on the source line, the argument `targetId` can be
2412 // used to control into which target the `stepIn` should occur. The list of
2413 // possible targets for a given source line can be retrieved via the
2414 // `stepInTargets` request.
2415 struct StepInRequest : public Request {
2416 using Response = StepInResponse;
2417 // Stepping granularity. If no granularity is specified, a granularity of
2418 // `statement` is assumed.
2419 optional<SteppingGranularity> granularity;
2420 // If this flag is true, all other suspended threads are not resumed.
2421 optional<boolean> singleThread;
2422 // Id of the target to step into.
2423 optional<integer> targetId;
2424 // Specifies the thread for which to resume execution for one step-into (of
2425 // the given granularity).
2426 integer threadId;
2427 };
2428
2429 DAP_DECLARE_STRUCT_TYPEINFO(StepInRequest);
2430
2431 // A `StepInTarget` can be used in the `stepIn` request and determines into
2432 // which single target the `stepIn` request should step.
2433 struct StepInTarget {
2434 // Start position of the range covered by the step in target. It is measured
2435 // in UTF-16 code units and the client capability `columnsStartAt1` determines
2436 // whether it is 0- or 1-based.
2437 optional<integer> column;
2438 // End position of the range covered by the step in target. It is measured in
2439 // UTF-16 code units and the client capability `columnsStartAt1` determines
2440 // whether it is 0- or 1-based.
2441 optional<integer> endColumn;
2442 // The end line of the range covered by the step-in target.
2443 optional<integer> endLine;
2444 // Unique identifier for a step-in target.
2445 integer id;
2446 // The name of the step-in target (shown in the UI).
2447 string label;
2448 // The line of the step-in target.
2449 optional<integer> line;
2450 };
2451
2452 DAP_DECLARE_STRUCT_TYPEINFO(StepInTarget);
2453
2454 // Response to `stepInTargets` request.
2455 struct StepInTargetsResponse : public Response {
2456 // The possible step-in targets of the specified source location.
2457 array<StepInTarget> targets;
2458 };
2459
2460 DAP_DECLARE_STRUCT_TYPEINFO(StepInTargetsResponse);
2461
2462 // This request retrieves the possible step-in targets for the specified stack
2463 // frame. These targets can be used in the `stepIn` request. Clients should only
2464 // call this request if the corresponding capability
2465 // `supportsStepInTargetsRequest` is true.
2466 struct StepInTargetsRequest : public Request {
2467 using Response = StepInTargetsResponse;
2468 // The stack frame for which to retrieve the possible step-in targets.
2469 integer frameId;
2470 };
2471
2472 DAP_DECLARE_STRUCT_TYPEINFO(StepInTargetsRequest);
2473
2474 // Response to `stepOut` request. This is just an acknowledgement, so no body
2475 // field is required.
2476 struct StepOutResponse : public Response {};
2477
2478 DAP_DECLARE_STRUCT_TYPEINFO(StepOutResponse);
2479
2480 // The request resumes the given thread to step out (return) from a
2481 // function/method and allows all other threads to run freely by resuming them.
2482 // If the debug adapter supports single thread execution (see capability
2483 // `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument
2484 // to true prevents other suspended threads from resuming. The debug adapter
2485 // first sends the response and then a `stopped` event (with reason `step`)
2486 // after the step has completed.
2487 struct StepOutRequest : public Request {
2488 using Response = StepOutResponse;
2489 // Stepping granularity. If no granularity is specified, a granularity of
2490 // `statement` is assumed.
2491 optional<SteppingGranularity> granularity;
2492 // If this flag is true, all other suspended threads are not resumed.
2493 optional<boolean> singleThread;
2494 // Specifies the thread for which to resume execution for one step-out (of the
2495 // given granularity).
2496 integer threadId;
2497 };
2498
2499 DAP_DECLARE_STRUCT_TYPEINFO(StepOutRequest);
2500
2501 // The event indicates that the execution of the debuggee has stopped due to
2502 // some condition. This can be caused by a breakpoint previously set, a stepping
2503 // request has completed, by executing a debugger statement etc.
2504 struct StoppedEvent : public Event {
2505 // If `allThreadsStopped` is true, a debug adapter can announce that all
2506 // threads have stopped.
2507 // - The client should use this information to enable that all threads can be
2508 // expanded to access their stacktraces.
2509 // - If the attribute is missing or false, only the thread with the given
2510 // `threadId` can be expanded.
2511 optional<boolean> allThreadsStopped;
2512 // The full reason for the event, e.g. 'Paused on exception'. This string is
2513 // shown in the UI as is and can be translated.
2514 optional<string> description;
2515 // Ids of the breakpoints that triggered the event. In most cases there is
2516 // only a single breakpoint but here are some examples for multiple
2517 // breakpoints:
2518 // - Different types of breakpoints map to the same location.
2519 // - Multiple source breakpoints get collapsed to the same instruction by the
2520 // compiler/runtime.
2521 // - Multiple function breakpoints with different function names map to the
2522 // same location.
2523 optional<array<integer>> hitBreakpointIds;
2524 // A value of true hints to the client that this event should not change the
2525 // focus.
2526 optional<boolean> preserveFocusHint;
2527 // The reason for the event.
2528 // For backward compatibility this string is shown in the UI if the
2529 // `description` attribute is missing (but it must not be translated).
2530 //
2531 // May be one of the following enumeration values:
2532 // 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function
2533 // breakpoint', 'data breakpoint', 'instruction breakpoint'
2534 string reason;
2535 // Additional information. E.g. if reason is `exception`, text contains the
2536 // exception name. This string is shown in the UI.
2537 optional<string> text;
2538 // The thread which was stopped.
2539 optional<integer> threadId;
2540 };
2541
2542 DAP_DECLARE_STRUCT_TYPEINFO(StoppedEvent);
2543
2544 // Response to `terminate` request. This is just an acknowledgement, so no body
2545 // field is required.
2546 struct TerminateResponse : public Response {};
2547
2548 DAP_DECLARE_STRUCT_TYPEINFO(TerminateResponse);
2549
2550 // The `terminate` request is sent from the client to the debug adapter in order
2551 // to shut down the debuggee gracefully. Clients should only call this request
2552 // if the capability `supportsTerminateRequest` is true. Typically a debug
2553 // adapter implements `terminate` by sending a software signal which the
2554 // debuggee intercepts in order to clean things up properly before terminating
2555 // itself. Please note that this request does not directly affect the state of
2556 // the debug session: if the debuggee decides to veto the graceful shutdown for
2557 // any reason by not terminating itself, then the debug session just continues.
2558 // Clients can surface the `terminate` request as an explicit command or they
2559 // can integrate it into a two stage Stop command that first sends `terminate`
2560 // to request a graceful shutdown, and if that fails uses `disconnect` for a
2561 // forceful shutdown.
2562 struct TerminateRequest : public Request {
2563 using Response = TerminateResponse;
2564 // A value of true indicates that this `terminate` request is part of a
2565 // restart sequence.
2566 optional<boolean> restart;
2567 };
2568
2569 DAP_DECLARE_STRUCT_TYPEINFO(TerminateRequest);
2570
2571 // Response to `terminateThreads` request. This is just an acknowledgement, no
2572 // body field is required.
2573 struct TerminateThreadsResponse : public Response {};
2574
2575 DAP_DECLARE_STRUCT_TYPEINFO(TerminateThreadsResponse);
2576
2577 // The request terminates the threads with the given ids.
2578 // Clients should only call this request if the corresponding capability
2579 // `supportsTerminateThreadsRequest` is true.
2580 struct TerminateThreadsRequest : public Request {
2581 using Response = TerminateThreadsResponse;
2582 // Ids of threads to be terminated.
2583 optional<array<integer>> threadIds;
2584 };
2585
2586 DAP_DECLARE_STRUCT_TYPEINFO(TerminateThreadsRequest);
2587
2588 // The event indicates that debugging of the debuggee has terminated. This does
2589 // **not** mean that the debuggee itself has exited.
2590 struct TerminatedEvent : public Event {
2591 // A debug adapter may set `restart` to true (or to an arbitrary object) to
2592 // request that the client restarts the session. The value is not interpreted
2593 // by the client and passed unmodified as an attribute `__restart` to the
2594 // `launch` and `attach` requests.
2595 optional<variant<array<any>, boolean, integer, null, number, object, string>>
2596 restart;
2597 };
2598
2599 DAP_DECLARE_STRUCT_TYPEINFO(TerminatedEvent);
2600
2601 // The event indicates that a thread has started or exited.
2602 struct ThreadEvent : public Event {
2603 // The reason for the event.
2604 //
2605 // May be one of the following enumeration values:
2606 // 'started', 'exited'
2607 string reason;
2608 // The identifier of the thread.
2609 integer threadId;
2610 };
2611
2612 DAP_DECLARE_STRUCT_TYPEINFO(ThreadEvent);
2613
2614 // A Thread
2615 struct Thread {
2616 // Unique identifier for the thread.
2617 integer id;
2618 // The name of the thread.
2619 string name;
2620 };
2621
2622 DAP_DECLARE_STRUCT_TYPEINFO(Thread);
2623
2624 // Response to `threads` request.
2625 struct ThreadsResponse : public Response {
2626 // All threads.
2627 array<Thread> threads;
2628 };
2629
2630 DAP_DECLARE_STRUCT_TYPEINFO(ThreadsResponse);
2631
2632 // The request retrieves a list of all threads.
2633 struct ThreadsRequest : public Request {
2634 using Response = ThreadsResponse;
2635 };
2636
2637 DAP_DECLARE_STRUCT_TYPEINFO(ThreadsRequest);
2638
2639 // A Variable is a name/value pair.
2640 // The `type` attribute is shown if space permits or when hovering over the
2641 // variable's name. The `kind` attribute is used to render additional properties
2642 // of the variable, e.g. different icons can be used to indicate that a variable
2643 // is public or private. If the value is structured (has children), a handle is
2644 // provided to retrieve the children with the `variables` request. If the number
2645 // of named or indexed children is large, the numbers should be returned via the
2646 // `namedVariables` and `indexedVariables` attributes. The client can use this
2647 // information to present the children in a paged UI and fetch them in chunks.
2648 struct Variable {
2649 // The evaluatable name of this variable which can be passed to the `evaluate`
2650 // request to fetch the variable's value.
2651 optional<string> evaluateName;
2652 // The number of indexed child variables.
2653 // The client can use this information to present the children in a paged UI
2654 // and fetch them in chunks.
2655 optional<integer> indexedVariables;
2656 // A memory reference associated with this variable.
2657 // For pointer type variables, this is generally a reference to the memory
2658 // address contained in the pointer. For executable data, this reference may
2659 // later be used in a `disassemble` request. This attribute may be returned by
2660 // a debug adapter if corresponding capability `supportsMemoryReferences` is
2661 // true.
2662 optional<string> memoryReference;
2663 // The variable's name.
2664 string name;
2665 // The number of named child variables.
2666 // The client can use this information to present the children in a paged UI
2667 // and fetch them in chunks.
2668 optional<integer> namedVariables;
2669 // Properties of a variable that can be used to determine how to render the
2670 // variable in the UI.
2671 optional<VariablePresentationHint> presentationHint;
2672 // The type of the variable's value. Typically shown in the UI when hovering
2673 // over the value. This attribute should only be returned by a debug adapter
2674 // if the corresponding capability `supportsVariableType` is true.
2675 optional<string> type;
2676 // The variable's value.
2677 // This can be a multi-line text, e.g. for a function the body of a function.
2678 // For structured variables (which do not have a simple value), it is
2679 // recommended to provide a one-line representation of the structured object.
2680 // This helps to identify the structured object in the collapsed state when
2681 // its children are not yet visible. An empty string can be used if no value
2682 // should be shown in the UI.
2683 string value;
2684 // If `variablesReference` is > 0, the variable is structured and its children
2685 // can be retrieved by passing `variablesReference` to the `variables` request
2686 // as long as execution remains suspended. See 'Lifetime of Object References'
2687 // in the Overview section for details.
2688 integer variablesReference;
2689 };
2690
2691 DAP_DECLARE_STRUCT_TYPEINFO(Variable);
2692
2693 // Response to `variables` request.
2694 struct VariablesResponse : public Response {
2695 // All (or a range) of variables for the given variable reference.
2696 array<Variable> variables;
2697 };
2698
2699 DAP_DECLARE_STRUCT_TYPEINFO(VariablesResponse);
2700
2701 // Retrieves all child variables for the given variable reference.
2702 // A filter can be used to limit the fetched children to either named or indexed
2703 // children.
2704 struct VariablesRequest : public Request {
2705 using Response = VariablesResponse;
2706 // The number of variables to return. If count is missing or 0, all variables
2707 // are returned. The attribute is only honored by a debug adapter if the
2708 // corresponding capability `supportsVariablePaging` is true.
2709 optional<integer> count;
2710 // Filter to limit the child variables to either named or indexed. If omitted,
2711 // both types are fetched.
2712 //
2713 // Must be one of the following enumeration values:
2714 // 'indexed', 'named'
2715 optional<string> filter;
2716 // Specifies details on how to format the Variable values.
2717 // The attribute is only honored by a debug adapter if the corresponding
2718 // capability `supportsValueFormattingOptions` is true.
2719 optional<ValueFormat> format;
2720 // The index of the first variable to return; if omitted children start at 0.
2721 // The attribute is only honored by a debug adapter if the corresponding
2722 // capability `supportsVariablePaging` is true.
2723 optional<integer> start;
2724 // The variable for which to retrieve its children. The `variablesReference`
2725 // must have been obtained in the current suspended state. See 'Lifetime of
2726 // Object References' in the Overview section for details.
2727 integer variablesReference;
2728 };
2729
2730 DAP_DECLARE_STRUCT_TYPEINFO(VariablesRequest);
2731
2732 // Response to `writeMemory` request.
2733 struct WriteMemoryResponse : public Response {
2734 // Property that should be returned when `allowPartial` is true to indicate
2735 // the number of bytes starting from address that were successfully written.
2736 optional<integer> bytesWritten;
2737 // Property that should be returned when `allowPartial` is true to indicate
2738 // the offset of the first byte of data successfully written. Can be negative.
2739 optional<integer> offset;
2740 };
2741
2742 DAP_DECLARE_STRUCT_TYPEINFO(WriteMemoryResponse);
2743
2744 // Writes bytes to memory at the provided location.
2745 // Clients should only call this request if the corresponding capability
2746 // `supportsWriteMemoryRequest` is true.
2747 struct WriteMemoryRequest : public Request {
2748 using Response = WriteMemoryResponse;
2749 // Property to control partial writes. If true, the debug adapter should
2750 // attempt to write memory even if the entire memory region is not writable.
2751 // In such a case the debug adapter should stop after hitting the first byte
2752 // of memory that cannot be written and return the number of bytes written in
2753 // the response via the `offset` and `bytesWritten` properties. If false or
2754 // missing, a debug adapter should attempt to verify the region is writable
2755 // before writing, and fail the response if it is not.
2756 optional<boolean> allowPartial;
2757 // Bytes to write, encoded using base64.
2758 string data;
2759 // Memory reference to the base location to which data should be written.
2760 string memoryReference;
2761 // Offset (in bytes) to be applied to the reference location before writing
2762 // data. Can be negative.
2763 optional<integer> offset;
2764 };
2765
2766 DAP_DECLARE_STRUCT_TYPEINFO(WriteMemoryRequest);
2767
2768 } // namespace dap
2769
2770 #endif // dap_protocol_h