protocol.h 117 KB

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