protocol.h 122 KB

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