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