Debian Codegraph @

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