Fix generation of named enumerator types

Schema top-level definitions, such as `InvalidatedAreas` and `SteppingGranularity` were being emitted as empty structures, when they were actually enumerators.

Re-work protocol_gen.go to emit these correctly.

Also bumps the protocol to DAP version 1.46.0
This commit is contained in:
Ben Clayton
2021-04-12 13:08:58 +01:00
parent ad185ee762
commit be5b677c7b
7 changed files with 1233 additions and 333 deletions

View File

@@ -15,7 +15,7 @@
// Generated with protocol_gen.go -- do not edit this file.
// go run scripts/protocol_gen/protocol_gen.go
//
// DAP version 1.43.0
// DAP version 1.46.0
#ifndef dap_protocol_h
#define dap_protocol_h
@@ -56,14 +56,15 @@ struct AttachRequest : public Request {
DAP_DECLARE_STRUCT_TYPEINFO(AttachRequest);
// Names of checksum algorithms that may be supported by a debug adapter.
struct ChecksumAlgorithm {};
DAP_DECLARE_STRUCT_TYPEINFO(ChecksumAlgorithm);
//
// Must be one of the following enumeration values:
// 'MD5', 'SHA1', 'SHA256', 'timestamp'
using ChecksumAlgorithm = string;
// The checksum of an item calculated by the specified algorithm.
struct Checksum {
// The algorithm used to calculate this checksum.
ChecksumAlgorithm algorithm;
ChecksumAlgorithm algorithm = "MD5";
// Value of the checksum.
string checksum;
};
@@ -272,9 +273,16 @@ DAP_DECLARE_STRUCT_TYPEINFO(ColumnDescriptor);
// An ExceptionBreakpointsFilter is shown in the UI as an filter option for
// configuring how exceptions are dealt with.
struct ExceptionBreakpointsFilter {
// An optional help text providing information about the condition. This
// string is shown as the placeholder text for a text box and must be
// translated.
optional<string> conditionDescription;
// Initial value of the filter option. If not specified a value 'false' is
// assumed.
optional<boolean> def;
// An optional help text providing additional information about the exception
// filter. This string is typically shown as a hover and must be translated.
optional<string> description;
// The internal ID of the filter option. This value is passed to the
// 'setExceptionBreakpoints' request.
string filter;
@@ -318,7 +326,7 @@ struct Capabilities {
// The debug adapter supports data breakpoints.
optional<boolean> supportsDataBreakpoints;
// The debug adapter supports the delayed loading of parts of the stack, which
// requires that both the 'startFrame' and 'levels' arguments and the
// requires that both the 'startFrame' and 'levels' arguments and an optional
// 'totalFrames' result of the 'StackTrace' request are supported.
optional<boolean> supportsDelayedStackTraceLoading;
// The debug adapter supports the 'disassemble' request.
@@ -398,9 +406,12 @@ DAP_DECLARE_STRUCT_TYPEINFO(CapabilitiesEvent);
// Some predefined types for the CompletionItem. Please note that not all
// clients have specific icons for all of them.
struct CompletionItemType {};
DAP_DECLARE_STRUCT_TYPEINFO(CompletionItemType);
//
// Must be one of the following enumeration values:
// 'method', 'function', 'constructor', 'field', 'variable', 'class',
// 'interface', 'module', 'property', 'unit', 'value', 'enum', 'keyword',
// 'snippet', 'text', 'color', 'file', 'reference', 'customcolor'
using CompletionItemType = string;
// CompletionItems are the suggestions returned from the CompletionsRequest.
struct CompletionItem {
@@ -519,9 +530,10 @@ struct ContinuedEvent : public Event {
DAP_DECLARE_STRUCT_TYPEINFO(ContinuedEvent);
// This enumeration defines all possible access types for data breakpoints.
struct DataBreakpointAccessType {};
DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpointAccessType);
//
// Must be one of the following enumeration values:
// 'read', 'write', 'readWrite'
using DataBreakpointAccessType = string;
// Response to 'dataBreakpointInfo' request.
struct DataBreakpointInfoResponse : public Response {
@@ -548,7 +560,7 @@ DAP_DECLARE_STRUCT_TYPEINFO(DataBreakpointInfoResponse);
struct DataBreakpointInfoRequest : public Request {
using Response = DataBreakpointInfoResponse;
// The name of the Variable's child to obtain data breakpoint information for.
// If variableReference isnt provided, this can be an expression.
// If variablesReference isnt provided, this can be an expression.
string name;
// Reference to the Variable container if the data breakpoint is requested for
// a child of the container.
@@ -777,9 +789,10 @@ DAP_DECLARE_STRUCT_TYPEINFO(EvaluateRequest);
// should result in a break. never: never breaks, always: always breaks,
// unhandled: breaks when exception unhandled,
// userUnhandled: breaks if the exception is not handled by user code.
struct ExceptionBreakMode {};
DAP_DECLARE_STRUCT_TYPEINFO(ExceptionBreakMode);
//
// Must be one of the following enumeration values:
// 'never', 'always', 'unhandled', 'userUnhandled'
using ExceptionBreakMode = string;
// Detailed information about an exception that has occurred.
struct ExceptionDetails {
@@ -803,7 +816,7 @@ DAP_DECLARE_STRUCT_TYPEINFO(ExceptionDetails);
// Response to 'exceptionInfo' request.
struct ExceptionInfoResponse : public Response {
// Mode that caused the exception notification to be raised.
ExceptionBreakMode breakMode;
ExceptionBreakMode breakMode = "never";
// Descriptive text for the exception provided by the debug adapter.
optional<string> description;
// Detailed information about the exception.
@@ -934,7 +947,7 @@ struct InitializeResponse : public Response {
// The debug adapter supports data breakpoints.
optional<boolean> supportsDataBreakpoints;
// The debug adapter supports the delayed loading of parts of the stack, which
// requires that both the 'startFrame' and 'levels' arguments and the
// requires that both the 'startFrame' and 'levels' arguments and an optional
// 'totalFrames' result of the 'StackTrace' request are supported.
optional<boolean> supportsDelayedStackTraceLoading;
// The debug adapter supports the 'disassemble' request.
@@ -1064,9 +1077,7 @@ struct InitializedEvent : public Event {};
DAP_DECLARE_STRUCT_TYPEINFO(InitializedEvent);
// Logical areas that can be invalidated by the 'invalidated' event.
struct InvalidatedAreas {};
DAP_DECLARE_STRUCT_TYPEINFO(InvalidatedAreas);
using InvalidatedAreas = string;
// This event signals that some state in the debug adapter has changed and
// requires that the client needs to re-render the data snapshot previously
@@ -1239,9 +1250,10 @@ DAP_DECLARE_STRUCT_TYPEINFO(NextResponse);
// The granularity of one 'step' in the stepping requests 'next', 'stepIn',
// 'stepOut', and 'stepBack'.
struct SteppingGranularity {};
DAP_DECLARE_STRUCT_TYPEINFO(SteppingGranularity);
//
// Must be one of the following enumeration values:
// 'statement', 'line', 'instruction'
using SteppingGranularity = string;
// The request starts the debuggee to run again for one step.
// The debug adapter first sends the response and then a 'stopped' event (with
@@ -1698,7 +1710,7 @@ DAP_DECLARE_STRUCT_TYPEINFO(ExceptionPathSegment);
// An ExceptionOptions assigns configuration options to a set of exceptions.
struct ExceptionOptions {
// Condition when a thrown exception should result in a break.
ExceptionBreakMode breakMode;
ExceptionBreakMode breakMode = "never";
// A path that selects a single or multiple exceptions in a tree. If 'path' is
// missing, the whole tree is selected. By convention the first segment of the
// path is a category that is used to group exceptions in the UI.
@@ -1724,7 +1736,9 @@ DAP_DECLARE_STRUCT_TYPEINFO(ExceptionFilterOptions);
// The request configures the debuggers response to thrown exceptions.
// If an exception is configured to break, a 'stopped' event is fired (with
// reason 'exception'). Clients should only call this request if the capability
// 'exceptionBreakpointFilters' returns one or more filters.
// 'exceptionBreakpointFilters' returns one or more filters. If a filter or
// filter option is invalid (e.g. due to an invalid 'condition'), the request
// should fail with an 'ErrorResponse' explaining the problem(s).
struct SetExceptionBreakpointsRequest : public Request {
using Response = SetExceptionBreakpointsResponse;
// Configuration options for selected exceptions.
@@ -1948,6 +1962,10 @@ DAP_DECLARE_STRUCT_TYPEINFO(SourceRequest);
// A Stackframe contains the source location.
struct StackFrame {
// Indicates whether this frame can be restarted with the 'restart' request.
// Clients should only use this if the debug adapter supports the 'restart'
// request (capability 'supportsRestartRequest' is true).
optional<boolean> canRestart;
// The column within the line. If source is null or doesn't exist, column is 0
// and must be ignored.
integer column;
@@ -2023,10 +2041,11 @@ DAP_DECLARE_STRUCT_TYPEINFO(StackFrameFormat);
// The request returns a stacktrace from the current execution state of a given
// thread. A client can request all stack frames by omitting the startFrame and
// levels arguments. For performance conscious clients stack frames can be
// retrieved in a piecemeal way with the startFrame and levels arguments. The
// response of the stackTrace request may contain a totalFrames property that
// hints at the total number of frames in the stack. If a client needs this
// levels arguments. For performance conscious clients and if the debug
// adapter's 'supportsDelayedStackTraceLoading' capability is true, stack frames
// can be retrieved in a piecemeal way with the startFrame and levels arguments.
// The response of the stackTrace request may contain a totalFrames property
// that hints at the total number of frames in the stack. If a client needs this
// total number upfront, it can issue a request for a single (first) frame and
// depending on the value of totalFrames decide how to proceed. In any case a
// client should be prepared to receive less frames than requested, which is an
@@ -2162,6 +2181,15 @@ struct StoppedEvent : public Event {
// The full reason for the event, e.g. 'Paused on exception'. This string is
// shown in the UI as is and must be translated.
optional<string> description;
// Ids of the breakpoints that triggered the event. In most cases there will
// be only a single breakpoint but here are some examples for multiple
// breakpoints:
// - Different types of breakpoints map to the same location.
// - Multiple source breakpoints get collapsed to the same instruction by the
// compiler/runtime.
// - Multiple function breakpoints with different function names map to the
// same location.
optional<array<integer>> hitBreakpointIds;
// A value of true hints to the frontend that this event should not change the
// focus.
optional<boolean> preserveFocusHint;