ruby-dap 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +7 -0
  3. data/LICENSE +201 -0
  4. data/lib/dap.rb +21 -0
  5. data/lib/dap/attach_request_arguments.rb +6 -0
  6. data/lib/dap/base.rb +145 -0
  7. data/lib/dap/breakpoint.rb +36 -0
  8. data/lib/dap/breakpoint_event_body.rb +10 -0
  9. data/lib/dap/breakpoint_location.rb +13 -0
  10. data/lib/dap/breakpoint_locations_arguments.rb +18 -0
  11. data/lib/dap/breakpoint_locations_response_body.rb +6 -0
  12. data/lib/dap/cancel_arguments.rb +9 -0
  13. data/lib/dap/capabilities.rb +110 -0
  14. data/lib/dap/capabilities_event_body.rb +6 -0
  15. data/lib/dap/checksum.rb +9 -0
  16. data/lib/dap/checksum_algorithm.rb +6 -0
  17. data/lib/dap/column_descriptor.rb +17 -0
  18. data/lib/dap/completion_item.rb +33 -0
  19. data/lib/dap/completion_item_type.rb +21 -0
  20. data/lib/dap/completions_arguments.rb +13 -0
  21. data/lib/dap/completions_response_body.rb +6 -0
  22. data/lib/dap/continue_arguments.rb +5 -0
  23. data/lib/dap/continue_response_body.rb +5 -0
  24. data/lib/dap/continued_event_body.rb +7 -0
  25. data/lib/dap/data_breakpoint.rb +16 -0
  26. data/lib/dap/data_breakpoint_access_type.rb +5 -0
  27. data/lib/dap/data_breakpoint_info_arguments.rb +8 -0
  28. data/lib/dap/data_breakpoint_info_response_body.rb +15 -0
  29. data/lib/dap/disassemble_arguments.rb +17 -0
  30. data/lib/dap/disassemble_response_body.rb +6 -0
  31. data/lib/dap/disassembled_instruction.rb +32 -0
  32. data/lib/dap/disconnect_arguments.rb +9 -0
  33. data/lib/dap/encoding.rb +47 -0
  34. data/lib/dap/enum.rb +28 -0
  35. data/lib/dap/error_response_body.rb +6 -0
  36. data/lib/dap/evaluate_arguments.rb +23 -0
  37. data/lib/dap/evaluate_response_body.rb +32 -0
  38. data/lib/dap/event.rb +42 -0
  39. data/lib/dap/exception_break_mode.rb +6 -0
  40. data/lib/dap/exception_breakpoints_filter.rb +10 -0
  41. data/lib/dap/exception_details.rb +21 -0
  42. data/lib/dap/exception_info_arguments.rb +4 -0
  43. data/lib/dap/exception_info_response_body.rb +16 -0
  44. data/lib/dap/exception_options.rb +11 -0
  45. data/lib/dap/exception_path_segment.rb +7 -0
  46. data/lib/dap/exited_event_body.rb +4 -0
  47. data/lib/dap/function_breakpoint.rb +13 -0
  48. data/lib/dap/goto_arguments.rb +7 -0
  49. data/lib/dap/goto_target.rb +22 -0
  50. data/lib/dap/goto_targets_arguments.rb +12 -0
  51. data/lib/dap/goto_targets_response_body.rb +6 -0
  52. data/lib/dap/initialize_request_arguments.rb +41 -0
  53. data/lib/dap/instruction_breakpoint.rb +18 -0
  54. data/lib/dap/invalidated_event_body.rb +10 -0
  55. data/lib/dap/launch_request_arguments.rb +9 -0
  56. data/lib/dap/loaded_source_event_body.rb +10 -0
  57. data/lib/dap/loaded_sources_response_body.rb +6 -0
  58. data/lib/dap/message.rb +23 -0
  59. data/lib/dap/module.rb +28 -0
  60. data/lib/dap/module_event_body.rb +10 -0
  61. data/lib/dap/modules_arguments.rb +7 -0
  62. data/lib/dap/modules_response_body.rb +9 -0
  63. data/lib/dap/next_arguments.rb +9 -0
  64. data/lib/dap/output_event_body.rb +36 -0
  65. data/lib/dap/pause_arguments.rb +4 -0
  66. data/lib/dap/process_event_body.rb +21 -0
  67. data/lib/dap/progress_end_event_body.rb +7 -0
  68. data/lib/dap/progress_start_event_body.rb +24 -0
  69. data/lib/dap/progress_update_event_body.rb +10 -0
  70. data/lib/dap/protocol_message.rb +38 -0
  71. data/lib/dap/read_memory_arguments.rb +10 -0
  72. data/lib/dap/read_memory_response_body.rb +12 -0
  73. data/lib/dap/relation.rb +28 -0
  74. data/lib/dap/request.rb +91 -0
  75. data/lib/dap/response.rb +86 -0
  76. data/lib/dap/restart_frame_arguments.rb +4 -0
  77. data/lib/dap/reverse_continue_arguments.rb +4 -0
  78. data/lib/dap/run_in_terminal_request_arguments.rb +17 -0
  79. data/lib/dap/run_in_terminal_response_body.rb +7 -0
  80. data/lib/dap/scope.rb +43 -0
  81. data/lib/dap/scopes_arguments.rb +4 -0
  82. data/lib/dap/scopes_response_body.rb +6 -0
  83. data/lib/dap/set_breakpoints_arguments.rb +16 -0
  84. data/lib/dap/set_breakpoints_response_body.rb +7 -0
  85. data/lib/dap/set_data_breakpoints_arguments.rb +6 -0
  86. data/lib/dap/set_data_breakpoints_response_body.rb +6 -0
  87. data/lib/dap/set_exception_breakpoints_arguments.rb +10 -0
  88. data/lib/dap/set_expression_arguments.rb +15 -0
  89. data/lib/dap/set_expression_response_body.rb +27 -0
  90. data/lib/dap/set_function_breakpoints_arguments.rb +6 -0
  91. data/lib/dap/set_function_breakpoints_response_body.rb +6 -0
  92. data/lib/dap/set_instruction_breakpoints_arguments.rb +6 -0
  93. data/lib/dap/set_instruction_breakpoints_response_body.rb +6 -0
  94. data/lib/dap/set_variable_arguments.rb +15 -0
  95. data/lib/dap/set_variable_response_body.rb +21 -0
  96. data/lib/dap/source.rb +35 -0
  97. data/lib/dap/source_arguments.rb +10 -0
  98. data/lib/dap/source_breakpoint.rb +21 -0
  99. data/lib/dap/source_response_body.rb +7 -0
  100. data/lib/dap/stack_frame.rb +36 -0
  101. data/lib/dap/stack_frame_format.rb +24 -0
  102. data/lib/dap/stack_trace_arguments.rb +16 -0
  103. data/lib/dap/stack_trace_response_body.rb +10 -0
  104. data/lib/dap/step_back_arguments.rb +9 -0
  105. data/lib/dap/step_in_arguments.rb +12 -0
  106. data/lib/dap/step_in_target.rb +7 -0
  107. data/lib/dap/step_in_targets_arguments.rb +4 -0
  108. data/lib/dap/step_in_targets_response_body.rb +6 -0
  109. data/lib/dap/step_out_arguments.rb +9 -0
  110. data/lib/dap/stepping_granularity.rb +5 -0
  111. data/lib/dap/stopped_event_body.rb +23 -0
  112. data/lib/dap/terminate_arguments.rb +4 -0
  113. data/lib/dap/terminate_threads_arguments.rb +4 -0
  114. data/lib/dap/terminated_event_body.rb +5 -0
  115. data/lib/dap/thread.rb +7 -0
  116. data/lib/dap/thread_event_body.rb +8 -0
  117. data/lib/dap/threads_response_body.rb +6 -0
  118. data/lib/dap/value_format.rb +4 -0
  119. data/lib/dap/variable.rb +34 -0
  120. data/lib/dap/variable_presentation_hint.rb +34 -0
  121. data/lib/dap/variables_arguments.rb +20 -0
  122. data/lib/dap/variables_response_body.rb +6 -0
  123. metadata +163 -0
@@ -0,0 +1,18 @@
1
+ require_relative 'source'
2
+
3
+ class DAP::BreakpointLocationsArguments < DAP::Base
4
+ # The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified.
5
+ property :source, as: DAP::Source
6
+
7
+ # Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line.
8
+ property :line
9
+
10
+ # Optional start column of range to search possible breakpoint locations in. If no start column is given, the first column in the start line is assumed.
11
+ property :column, required: false
12
+
13
+ # Optional end line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line.
14
+ property :endLine, required: false
15
+
16
+ # Optional end column of range to search possible breakpoint locations in. If no end column is given, then it is assumed to be in the last column of the end line.
17
+ property :endColumn, required: false
18
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'breakpoint_location'
2
+
3
+ class DAP::BreakpointLocationsResponseBody < DAP::Base
4
+ # Sorted set of possible breakpoint locations.
5
+ property :breakpoints, as: many(DAP::BreakpointLocation)
6
+ end
@@ -0,0 +1,9 @@
1
+ class DAP::CancelArguments < DAP::Base
2
+ # The ID (attribute 'seq') of the request to cancel. If missing no request is cancelled.
3
+ # Both a 'requestId' and a 'progressId' can be specified in one request.
4
+ property :requestId, required: false
5
+
6
+ # The ID (attribute 'progressId') of the progress to cancel. If missing no progress is cancelled.
7
+ # Both a 'requestId' and a 'progressId' can be specified in one request.
8
+ property :progressId, required: false
9
+ end
@@ -0,0 +1,110 @@
1
+ require_relative 'exception_breakpoints_filter'
2
+ require_relative 'column_descriptor'
3
+ require_relative 'checksum_algorithm'
4
+
5
+ class DAP::Capabilities < DAP::Base
6
+ # The debug adapter supports the 'configurationDone' request.
7
+ property :supportsConfigurationDoneRequest, required: false
8
+
9
+ # The debug adapter supports function breakpoints.
10
+ property :supportsFunctionBreakpoints, required: false
11
+
12
+ # The debug adapter supports conditional breakpoints.
13
+ property :supportsConditionalBreakpoints, required: false
14
+
15
+ # The debug adapter supports breakpoints that break execution after a specified number of hits.
16
+ property :supportsHitConditionalBreakpoints, required: false
17
+
18
+ # The debug adapter supports a (side effect free) evaluate request for data hovers.
19
+ property :supportsEvaluateForHovers, required: false
20
+
21
+ # Available filters or options for the setExceptionBreakpoints request.
22
+ property :exceptionBreakpointFilters, required: false, as: many(DAP::ExceptionBreakpointsFilter)
23
+
24
+ # The debug adapter supports stepping back via the 'stepBack' and 'reverseContinue' requests.
25
+ property :supportsStepBack, required: false
26
+
27
+ # The debug adapter supports setting a variable to a value.
28
+ property :supportsSetVariable, required: false
29
+
30
+ # The debug adapter supports restarting a frame.
31
+ property :supportsRestartFrame, required: false
32
+
33
+ # The debug adapter supports the 'gotoTargets' request.
34
+ property :supportsGotoTargetsRequest, required: false
35
+
36
+ # The debug adapter supports the 'stepInTargets' request.
37
+ property :supportsStepInTargetsRequest, required: false
38
+
39
+ # The debug adapter supports the 'completions' request.
40
+ property :supportsCompletionsRequest, required: false
41
+
42
+ # The set of characters that should trigger completion in a REPL. If not specified, the UI should assume the '.' character.
43
+ property :completionTriggerCharacters, required: false
44
+
45
+ # The debug adapter supports the 'modules' request.
46
+ property :supportsModulesRequest, required: false
47
+
48
+ # The set of additional module information exposed by the debug adapter.
49
+ property :additionalModuleColumns, required: false, as: many(DAP::ColumnDescriptor)
50
+
51
+ # Checksum algorithms supported by the debug adapter.
52
+ property :supportedChecksumAlgorithms, required: false, as: many(DAP::ChecksumAlgorithm)
53
+
54
+ # The debug adapter supports the 'restart' request. In this case a client should not implement 'restart' by terminating and relaunching the adapter but by calling the RestartRequest.
55
+ property :supportsRestartRequest, required: false
56
+
57
+ # The debug adapter supports 'exceptionOptions' on the setExceptionBreakpoints request.
58
+ property :supportsExceptionOptions, required: false
59
+
60
+ # The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest.
61
+ property :supportsValueFormattingOptions, required: false
62
+
63
+ # The debug adapter supports the 'exceptionInfo' request.
64
+ property :supportsExceptionInfoRequest, required: false
65
+
66
+ # The debug adapter supports the 'terminateDebuggee' attribute on the 'disconnect' request.
67
+ property :supportTerminateDebuggee, required: false
68
+
69
+ # The debug adapter supports the delayed loading of parts of the stack, which requires that both the 'startFrame' and 'levels' arguments and the 'totalFrames' result of the 'StackTrace' request are supported.
70
+ property :supportsDelayedStackTraceLoading, required: false
71
+
72
+ # The debug adapter supports the 'loadedSources' request.
73
+ property :supportsLoadedSourcesRequest, required: false
74
+
75
+ # The debug adapter supports logpoints by interpreting the 'logMessage' attribute of the SourceBreakpoint.
76
+ property :supportsLogPoints, required: false
77
+
78
+ # The debug adapter supports the 'terminateThreads' request.
79
+ property :supportsTerminateThreadsRequest, required: false
80
+
81
+ # The debug adapter supports the 'setExpression' request.
82
+ property :supportsSetExpression, required: false
83
+
84
+ # The debug adapter supports the 'terminate' request.
85
+ property :supportsTerminateRequest, required: false
86
+
87
+ # The debug adapter supports data breakpoints.
88
+ property :supportsDataBreakpoints, required: false
89
+
90
+ # The debug adapter supports the 'readMemory' request.
91
+ property :supportsReadMemoryRequest, required: false
92
+
93
+ # The debug adapter supports the 'disassemble' request.
94
+ property :supportsDisassembleRequest, required: false
95
+
96
+ # The debug adapter supports the 'cancel' request.
97
+ property :supportsCancelRequest, required: false
98
+
99
+ # The debug adapter supports the 'breakpointLocations' request.
100
+ property :supportsBreakpointLocationsRequest, required: false
101
+
102
+ # The debug adapter supports the 'clipboard' context value in the 'evaluate' request.
103
+ property :supportsClipboardContext, required: false
104
+
105
+ # The debug adapter supports stepping granularities (argument 'granularity') for the stepping requests.
106
+ property :supportsSteppingGranularity, required: false
107
+
108
+ # The debug adapter supports adding breakpoints based on instruction references.
109
+ property :supportsInstructionBreakpoints, required: false
110
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'capabilities'
2
+
3
+ class DAP::CapabilitiesEventBody < DAP::Base
4
+ # The set of updated capabilities.
5
+ property :capabilities, as: DAP::Capabilities
6
+ end
@@ -0,0 +1,9 @@
1
+ require_relative 'checksum_algorithm'
2
+
3
+ class DAP::Checksum < DAP::Base
4
+ # The algorithm used to calculate this checksum.
5
+ property :algorithm, as: DAP::ChecksumAlgorithm
6
+
7
+ # Value of the checksum.
8
+ property :checksum
9
+ end
@@ -0,0 +1,6 @@
1
+ class DAP::ChecksumAlgorithm < DAP::Enum
2
+ MD5 = new('MD5')
3
+ SHA1 = new('SHA1')
4
+ SHA256 = new('SHA256')
5
+ TIMESTAMP = new('timestamp')
6
+ end
@@ -0,0 +1,17 @@
1
+ class DAP::ColumnDescriptor < DAP::Base
2
+ # Name of the attribute rendered in this column.
3
+ property :attributeName
4
+
5
+ # Header UI label of column.
6
+ property :label
7
+
8
+ # Format to use for the rendered values in this column. TBD how the format strings looks like.
9
+ property :format, required: false
10
+
11
+ # Datatype of values in this column. Defaults to 'string' if not specified.
12
+ # Values: 'string', 'number', 'boolean', 'unixTimestampUTC', etc.
13
+ property :type, required: false # 'string' | 'number' | 'boolean' | 'unixTimestampUTC'
14
+
15
+ # Width of this column in characters (hint only).
16
+ property :width, required: false
17
+ end
@@ -0,0 +1,33 @@
1
+ require_relative 'completion_item_type'
2
+
3
+ class DAP::CompletionItem < DAP::Base
4
+ # The label of this completion item. By default this is also the text that is inserted when selecting this completion.
5
+ property :label
6
+
7
+ # If text is not falsy then it is inserted instead of the label.
8
+ property :text, required: false
9
+
10
+ # A string that should be used when comparing this item with other items. When `falsy` the label is used.
11
+ property :sortText, required: false
12
+
13
+ # The item's type. Typically the client uses this information to render the item in the UI with an icon.
14
+ property :type, required: false, as: DAP::CompletionItemType
15
+
16
+ # This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.
17
+ # If missing the text is added at the location specified by the CompletionsRequest's 'column' attribute.
18
+ property :start, required: false
19
+
20
+ # This value determines how many characters are overwritten by the completion text.
21
+ # If missing the value 0 is assumed which results in the completion text being inserted.
22
+ property :length, required: false
23
+
24
+ # Determines the start of the new selection after the text has been inserted (or replaced).
25
+ # The start position must in the range 0 and length of the completion text.
26
+ # If omitted the selection starts at the end of the completion text.
27
+ property :selectionStart, required: false
28
+
29
+ # Determines the length of the new selection after the text has been inserted (or replaced).
30
+ # The selection can not extend beyond the bounds of the completion text.
31
+ # If omitted the length is assumed to be 0.
32
+ property :selectionLength, required: false
33
+ end
@@ -0,0 +1,21 @@
1
+ class DAP::CompletionItemType < DAP::Enum
2
+ METHOD = new('method')
3
+ FUNCTION = new('function')
4
+ CONSTRUCTOR = new('constructor')
5
+ FIELD = new('field')
6
+ VARIABLE = new('variable')
7
+ CLASS = new('class')
8
+ INTERFACE = new('interface')
9
+ MODULE = new('module')
10
+ PROPERTY = new('property')
11
+ UNIT = new('unit')
12
+ VALUE = new('value')
13
+ ENUM = new('enum')
14
+ KEYWORD = new('keyword')
15
+ SNIPPET = new('snippet')
16
+ TEXT = new('text')
17
+ COLOR = new('color')
18
+ FILE = new('file')
19
+ REFERENCE = new('reference')
20
+ CUSTOMCOLOR = new('customcolor')
21
+ end
@@ -0,0 +1,13 @@
1
+ class DAP::CompletionsArguments < DAP::Base
2
+ # Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope.
3
+ property :frameId, required: false
4
+
5
+ # One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion.
6
+ property :text
7
+
8
+ # The character position for which to determine the completion proposals.
9
+ property :column
10
+
11
+ # An optional line for which to determine the completion proposals. If missing the first line of the text is assumed.
12
+ property :line, required: false
13
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'completion_item'
2
+
3
+ class DAP::CompletionsResponseBody < DAP::Base
4
+ # The possible completions for .
5
+ property :targets, as: many(DAP::CompletionItem)
6
+ end
@@ -0,0 +1,5 @@
1
+ class DAP::ContinueArguments < DAP::Base
2
+ # Continue execution for the specified thread (if possible).
3
+ # If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true.
4
+ property :threadId
5
+ end
@@ -0,0 +1,5 @@
1
+ class DAP::ContinueResponseBody < DAP::Base
2
+ # If true, the 'continue' request has ignored the specified thread and continued all threads instead.
3
+ # If this attribute is missing a value of 'true' is assumed for backward compatibility.
4
+ property :allThreadsContinued, required: false
5
+ end
@@ -0,0 +1,7 @@
1
+ class DAP::ContinuedEventBody < DAP::Base
2
+ # The thread which was continued.
3
+ property :threadId
4
+
5
+ # If 'allThreadsContinued' is true, a debug adapter can announce that all threads have continued.
6
+ property :allThreadsContinued, required: false
7
+ end
@@ -0,0 +1,16 @@
1
+ require_relative 'data_breakpoint_access_type'
2
+
3
+ class DAP::DataBreakpoint < DAP::Base
4
+ # An id representing the data. This id is returned from the dataBreakpointInfo request.
5
+ property :dataId
6
+
7
+ # The access type of the data.
8
+ property :accessType, required: false, as: DAP::DataBreakpointAccessType
9
+
10
+ # An optional expression for conditional breakpoints.
11
+ property :condition, required: false
12
+
13
+ # An optional expression that controls how many hits of the breakpoint are ignored.
14
+ # The backend is expected to interpret the expression as needed.
15
+ property :hitCondition, required: false
16
+ end
@@ -0,0 +1,5 @@
1
+ class DAP::DataBreakpointAccessType < DAP::Enum
2
+ READ = new('read')
3
+ WRITE = new('write')
4
+ READWRITE = new('readWrite')
5
+ end
@@ -0,0 +1,8 @@
1
+ class DAP::DataBreakpointInfoArguments < DAP::Base
2
+ # Reference to the Variable container if the data breakpoint is requested for a child of the container.
3
+ property :variablesReference, required: false
4
+
5
+ # The name of the Variable's child to obtain data breakpoint information for.
6
+ # If variableReference isn’t provided, this can be an expression.
7
+ property :name
8
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'data_breakpoint_access_type'
2
+
3
+ class DAP::DataBreakpointInfoResponseBody < DAP::Base
4
+ # An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available.
5
+ property :dataId
6
+
7
+ # UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available.
8
+ property :description
9
+
10
+ # Optional attribute listing the available access types for a potential data breakpoint. A UI frontend could surface this information.
11
+ property :accessTypes, required: false, as: many(DAP::DataBreakpointAccessType)
12
+
13
+ # Optional attribute indicating that a potential data breakpoint could be persisted across sessions.
14
+ property :canPersist, required: false
15
+ end
@@ -0,0 +1,17 @@
1
+ class DAP::DisassembleArguments < DAP::Base
2
+ # Memory reference to the base location containing the instructions to disassemble.
3
+ property :memoryReference
4
+
5
+ # Optional offset (in bytes) to be applied to the reference location before disassembling. Can be negative.
6
+ property :offset, required: false
7
+
8
+ # Optional offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative.
9
+ property :instructionOffset, required: false
10
+
11
+ # Number of instructions to disassemble starting at the specified location and offset.
12
+ # An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value.
13
+ property :instructionCount
14
+
15
+ # If true, the adapter should attempt to resolve memory addresses and other values to symbolic names.
16
+ property :resolveSymbols, required: false
17
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'disassembled_instruction'
2
+
3
+ class DAP::DisassembleResponseBody < DAP::Base
4
+ # The list of disassembled instructions.
5
+ property :instructions, as: many(DAP::DisassembledInstruction)
6
+ end
@@ -0,0 +1,32 @@
1
+ require_relative 'source'
2
+
3
+ class DAP::DisassembledInstruction < DAP::Base
4
+ # The address of the instruction. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise.
5
+ property :address
6
+
7
+ # Optional raw bytes representing the instruction and its operands, in an implementation-defined format.
8
+ property :instructionBytes, required: false
9
+
10
+ # Text representing the instruction and its operands, in an implementation-defined format.
11
+ property :instruction
12
+
13
+ # Name of the symbol that corresponds with the location of this instruction, if any.
14
+ property :symbol, required: false
15
+
16
+ # Source location that corresponds to this instruction, if any.
17
+ # Should always be set (if available) on the first instruction returned,
18
+ # but can be omitted afterwards if this instruction maps to the same source file as the previous instruction.
19
+ property :location, required: false, as: DAP::Source
20
+
21
+ # The line within the source location that corresponds to this instruction, if any.
22
+ property :line, required: false
23
+
24
+ # The column within the line that corresponds to this instruction, if any.
25
+ property :column, required: false
26
+
27
+ # The end line of the range that corresponds to this instruction, if any.
28
+ property :endLine, required: false
29
+
30
+ # The end column of the range that corresponds to this instruction, if any.
31
+ property :endColumn, required: false
32
+ end
@@ -0,0 +1,9 @@
1
+ class DAP::DisconnectArguments < DAP::Base
2
+ # A value of true indicates that this 'disconnect' request is part of a restart sequence.
3
+ property :restart, required: false
4
+
5
+ # Indicates whether the debuggee should be terminated when the debugger is disconnected.
6
+ # If unspecified, the debug adapter is free to do whatever it thinks is best.
7
+ # The attribute is only honored by a debug adapter if the capability 'supportTerminateDebuggee' is true.
8
+ property :terminateDebuggee, required: false
9
+ end
@@ -0,0 +1,47 @@
1
+ module DAP::Encoding
2
+ CONTENT_LENGTH_HEADER = 'Content-Length'
3
+
4
+ def self.decode(s)
5
+ headers = {}
6
+
7
+ loop do
8
+ l = s.gets
9
+ raise EOFError if l.nil?
10
+
11
+ l = l.strip
12
+ break if l.empty?
13
+
14
+ name, value = l.split(':', 2)
15
+ raise "Invalid header '#{l}'" unless value
16
+
17
+ headers[name.strip] = value.strip
18
+ end
19
+
20
+ raise "No headers" unless headers.size
21
+ raise "Missing content length" unless headers.key?(CONTENT_LENGTH_HEADER)
22
+
23
+ cl = headers[CONTENT_LENGTH_HEADER].to_i
24
+ raise "Invalid content length" unless cl.to_s == headers[CONTENT_LENGTH_HEADER]
25
+
26
+ body = s.read(cl)
27
+ values = JSON.parse(body)
28
+ DAP::ProtocolMessage.from(values)
29
+ end
30
+
31
+ def self.encode(message)
32
+ raise "Body must be a protocol message" unless message.is_a? DAP::ProtocolMessage
33
+
34
+ headers = {}
35
+
36
+ body = JSON.dump(message.to_wire)
37
+ headers[CONTENT_LENGTH_HEADER] = body.size
38
+
39
+ headers.map { |name, value| "#{name}: #{value}\r\n" }.join + "\r\n" + body
40
+ end
41
+
42
+ def self.decode_all(s)
43
+ loop do
44
+ yield decode(s)
45
+ end
46
+ end
47
+ end