| OLD | NEW |
| (Empty) | |
| 1 Note: this dev version of the protocol contains not yet released functionality, |
| 2 and is subject to change. |
| 3 |
| 4 # Dart VM Service Protocol 3.6-dev |
| 5 |
| 6 > Please post feedback to the [observatory-discuss group][discuss-list] |
| 7 |
| 8 This document describes of _version 3.5_ of the Dart VM Service Protocol. This |
| 9 protocol is used to communicate with a running Dart Virtual Machine. |
| 10 |
| 11 To use the Service Protocol, start the VM with the *--observe* flag. |
| 12 The VM will start a webserver which services protocol requests via WebSocket. |
| 13 It is possible to make HTTP (non-WebSocket) requests, |
| 14 but this does not allow access to VM _events_ and is not documented |
| 15 here. |
| 16 |
| 17 The Service Protocol uses [JSON-RPC 2.0][]. |
| 18 |
| 19 [JSON-RPC 2.0]: http://www.jsonrpc.org/specification |
| 20 |
| 21 **Table of Contents** |
| 22 |
| 23 - [RPCs, Requests, and Responses](#rpcs-requests-and-responses) |
| 24 - [Events](#events) |
| 25 - [Types](#types) |
| 26 - [IDs and Names](#ids-and-names) |
| 27 - [Versioning](#versioning) |
| 28 - [Private RPCs, Types, and Properties](#private-rpcs-types-and-properties) |
| 29 - [Public RPCs](#public-rpcs) |
| 30 - [addBreakpoint](#addbreakpoint) |
| 31 - [addBreakpointWithScriptUri](#addbreakpointwithscripturi) |
| 32 - [addBreakpointAtEntry](#addbreakpointatentry) |
| 33 - [evaluate](#evaluate) |
| 34 - [evaluateInFrame](#evaluateinframe) |
| 35 - [getFlagList](#getflaglist) |
| 36 - [getIsolate](#getisolate) |
| 37 - [getObject](#getobject) |
| 38 - [getSourceReport](#getsourcereport) |
| 39 - [getStack](#getstack) |
| 40 - [getVersion](#getversion) |
| 41 - [getVM](#getvm) |
| 42 - [pause](#pause) |
| 43 - [reloadSources](#reloadsources) |
| 44 - [removeBreakpoint](#removebreakpoint) |
| 45 - [resume](#resume) |
| 46 - [setExceptionPauseMode](#setexceptionpausemode) |
| 47 - [setLibraryDebuggable](#setlibrarydebuggable) |
| 48 - [setName](#setname) |
| 49 - [setVMName](#setvmname) |
| 50 - [streamCancel](#streamcancel) |
| 51 - [streamListen](#streamlisten) |
| 52 - [Public Types](#public-types) |
| 53 - [BoundField](#boundfield) |
| 54 - [BoundVariable](#boundvariable) |
| 55 - [Breakpoint](#breakpoint) |
| 56 - [Class](#class) |
| 57 - [ClassList](#classlist) |
| 58 - [Code](#code) |
| 59 - [CodeKind](#codekind) |
| 60 - [Context](#context) |
| 61 - [ContextElement](#contextelement) |
| 62 - [Error](#error) |
| 63 - [ErrorKind](#errorkind) |
| 64 - [Event](#event) |
| 65 - [EventKind](#eventkind) |
| 66 - [ExtensionData](#extensiondata) |
| 67 - [Field](#field) |
| 68 - [Flag](#flag) |
| 69 - [FlagList](#flaglist) |
| 70 - [Frame](#frame) |
| 71 - [Function](#function) |
| 72 - [Instance](#instance) |
| 73 - [Isolate](#isolate) |
| 74 - [Library](#library) |
| 75 - [LibraryDependency](#librarydependency) |
| 76 - [MapAssociation](#mapassociation) |
| 77 - [Message](#message) |
| 78 - [Null](#null) |
| 79 - [Object](#object) |
| 80 - [ReloadReport](#reloadreport) |
| 81 - [Response](#response) |
| 82 - [Sentinel](#sentinel) |
| 83 - [SentinelKind](#sentinelkind) |
| 84 - [Script](#script) |
| 85 - [SourceLocation](#sourcelocation) |
| 86 - [SourceReport](#sourcereport) |
| 87 - [SourceReportCoverage](#sourcereportcoverage) |
| 88 - [SourceReportKind](#sourcereportkind) |
| 89 - [SourceReportRange](#sourcereportrange) |
| 90 - [Stack](#stack) |
| 91 - [StepOption](#stepoption) |
| 92 - [Success](#success) |
| 93 - [TypeArguments](#typearguments) |
| 94 - [UresolvedSourceLocation](#unresolvedsourcelocation) |
| 95 - [Version](#version) |
| 96 - [VM](#vm) |
| 97 - [Revision History](#revision-history) |
| 98 |
| 99 ## RPCs, Requests, and Responses |
| 100 |
| 101 An RPC request is a JSON object sent to the server. Here is an |
| 102 example [getVersion](#getversion) request: |
| 103 |
| 104 ``` |
| 105 { |
| 106 "jsonrpc": "2.0", |
| 107 "method": "getVersion", |
| 108 "params": {}, |
| 109 "id": "1" |
| 110 } |
| 111 ``` |
| 112 |
| 113 The _id_ property must be a string, number, or `null`. The Service Protocol |
| 114 optionally accepts requests without the _jsonprc_ property. |
| 115 |
| 116 An RPC response is a JSON object (http://json.org/). The response always specifi
es an |
| 117 _id_ property to pair it with the corresponding request. If the RPC |
| 118 was successful, the _result_ property provides the result. |
| 119 |
| 120 Here is an example response for our [getVersion](#getversion) request above: |
| 121 |
| 122 ``` |
| 123 { |
| 124 "jsonrpc": "2.0", |
| 125 "result": { |
| 126 "type": "Version", |
| 127 "major": 3, |
| 128 "minor": 5 |
| 129 } |
| 130 "id": "1" |
| 131 } |
| 132 ``` |
| 133 |
| 134 Parameters for RPC requests are always provided as _named_ parameters. |
| 135 The JSON-RPC spec provides for _positional_ parameters as well, but they |
| 136 are not supported by the Dart VM. |
| 137 |
| 138 By convention, every response returned by the Service Protocol is a subtype |
| 139 of [Response](#response) and provides a _type_ parameter which can be used |
| 140 to distinguish the exact return type. In the example above, the |
| 141 [Version](#version) type is returned. |
| 142 |
| 143 Here is an example [streamListen](#streamlisten) request which provides |
| 144 a parameter: |
| 145 |
| 146 ``` |
| 147 { |
| 148 "jsonrpc": "2.0", |
| 149 "method": "streamListen", |
| 150 "params": { |
| 151 "streamId": "GC", |
| 152 }, |
| 153 "id": "2" |
| 154 } |
| 155 ``` |
| 156 |
| 157 <a name="rpc-error"></a> |
| 158 When an RPC encounters an error, it is provided in the _error_ |
| 159 property of the response object. JSON-RPC errors always provide |
| 160 _code_, _message_, and _data_ properties. |
| 161 |
| 162 Here is an example error response for our [streamListen](#streamlisten) |
| 163 request above. This error would be generated if we were attempting to |
| 164 subscribe to the _GC_ stream multiple times from the same client. |
| 165 |
| 166 ``` |
| 167 { |
| 168 "jsonrpc": "2.0", |
| 169 "error": { |
| 170 "code": 103, |
| 171 "message": "Stream already subscribed", |
| 172 "data": { |
| 173 "details": "The stream 'GC' is already subscribed" |
| 174 } |
| 175 } |
| 176 "id": "2" |
| 177 } |
| 178 ``` |
| 179 |
| 180 In addition to the [error codes](http://www.jsonrpc.org/specification#error_obje
ct) specified in the JSON-RPC spec, we use the following application specific er
ror codes: |
| 181 |
| 182 code | message | meaning |
| 183 ---- | ------- | ------- |
| 184 100 | Feature is disabled | The operation is unable to complete because a featur
e is disabled |
| 185 101 | VM must be paused | This operation is only valid when the VM is paused |
| 186 102 | Cannot add breakpoint | The VM is unable to add a breakpoint at the specif
ied line or function |
| 187 103 | Stream already subscribed | The client is already subscribed to the specif
ied _streamId_ |
| 188 104 | Stream not subscribed | The client is not subscribed to the specified _str
eamId_ |
| 189 105 | Isolate must be runnable | This operation cannot happen until the isolate
is runnable |
| 190 106 | Isolate must be paused | This operation is only valid when the isolate is
paused |
| 191 107 | Cannot resume execution | The isolate could not be resumed |
| 192 108 | Isolate is reloading | The isolate is currently processing another reload
request |
| 193 109 | Isolate cannot be reloaded | The isolate has an unhandled exception and ca
n no longer be reloaded |
| 194 |
| 195 |
| 196 |
| 197 ## Events |
| 198 |
| 199 By using the [streamListen](#streamlisten) and [streamCancel](#streamcancel) RPC
s, a client may |
| 200 request to be notified when an _event_ is posted to a specific |
| 201 _stream_ in the VM. Every stream has an associated _stream id_ which |
| 202 is used to name that stream. |
| 203 |
| 204 Each stream provides access to certain kinds of events. For example the _Isolate
_ stream provides |
| 205 access to events pertaining to isolate births, deaths, and name changes. See [st
reamListen](#streamlisten) |
| 206 for a list of the well-known stream ids and their associated events. |
| 207 |
| 208 Stream events arrive asynchronously over the WebSocket. They're structured as |
| 209 JSON-RPC 2.0 requests with no _id_ property. The _method_ property will be |
| 210 _streamNotify_, and the _params_ will have _streamId_ and _event_ properties: |
| 211 |
| 212 ```json |
| 213 { |
| 214 "json-rpc": "2.0", |
| 215 "method": "streamNotify", |
| 216 "params": { |
| 217 "streamId": "Isolate", |
| 218 "event": { |
| 219 "type": "Event", |
| 220 "kind": "IsolateExit", |
| 221 "isolate": { |
| 222 "type": "@Isolate", |
| 223 "id": "isolates/33", |
| 224 "number": "51048743613", |
| 225 "name": "worker-isolate" |
| 226 } |
| 227 } |
| 228 } |
| 229 } |
| 230 ``` |
| 231 |
| 232 It is considered a _backwards compatible_ change to add a new type of event to a
n existing stream. |
| 233 Clients should be written to handle this gracefully. |
| 234 |
| 235 |
| 236 |
| 237 ## Types |
| 238 |
| 239 By convention, every result and event provided by the Service Protocol |
| 240 is a subtype of [Response](#response) and has the _type_ property. |
| 241 This allows the client to distinguish different kinds of responses. For example, |
| 242 information about a Dart function is returned using the [Function](#function) ty
pe. |
| 243 |
| 244 If the type of a response begins with the _@_ character, then that |
| 245 response is a _reference_. If the type name of a response does not |
| 246 begin with the _@_ character, it is the an _object_. A reference is |
| 247 intended to be a subset of an object which provides enough information |
| 248 to generate a reasonable looking reference to the object. |
| 249 |
| 250 For example, an [@Isolate](#isolate) reference has the _type_, _id_, _name_ and |
| 251 _number_ properties: |
| 252 |
| 253 ``` |
| 254 "result": { |
| 255 "type": "@Isolate", |
| 256 "id": "isolates/33", |
| 257 "number": "51048743613" |
| 258 "name": "worker-isolate" |
| 259 } |
| 260 ``` |
| 261 |
| 262 But an [Isolate](#isolate) object has more information: |
| 263 |
| 264 ``` |
| 265 "result": { |
| 266 "type": "Isolate", |
| 267 "id": "isolates/33", |
| 268 "number": "51048743613" |
| 269 "name": "worker-isolate" |
| 270 "rootLib": { ... } |
| 271 "entry": ... |
| 272 "heaps": ... |
| 273 ... |
| 274 } |
| 275 ``` |
| 276 |
| 277 ## IDs and Names |
| 278 |
| 279 Many responses returned by the Service Protocol have an _id_ property. |
| 280 This is an identifier used to request an object from an isolate using |
| 281 the [getObject](#getobject) RPC. If two responses have the same _id_ then they |
| 282 refer to the same object. The converse is not true: the same object |
| 283 may sometimes be returned with two different values for _id_. |
| 284 |
| 285 The _id_ property should be treated as an opaque string by the client: |
| 286 it is not meant to be parsed. |
| 287 |
| 288 An id can be either _temporary_ or _fixed_: |
| 289 |
| 290 * A _temporary_ id can expire over time. The VM allocates certain ids |
| 291 in a ring which evicts old ids over time. |
| 292 |
| 293 * A _fixed_ id will never expire, but the object it refers to may |
| 294 be collected. The VM uses fixed ids for objects like scripts, |
| 295 libraries, and classes. |
| 296 |
| 297 If an id is fixed, the _fixedId_ property will be true. If an id is temporary |
| 298 the _fixedId_ property will be omitted. |
| 299 |
| 300 Sometimes a temporary id may expire. In this case, some RPCs may return |
| 301 an _Expired_ [Sentinel](#sentinel) to indicate this. |
| 302 |
| 303 The object referred to by an id may be collected by the VM's garbage |
| 304 collector. In this case, some RPCs may return a _Collected_ [Sentinel](#sentinel
) |
| 305 to indicate this. |
| 306 |
| 307 Many objects also have a _name_ property. This is provided so that |
| 308 objects can be displayed in a way that a Dart language programmer |
| 309 would find familiar. Names are not unique. |
| 310 |
| 311 ## Versioning |
| 312 |
| 313 The [getVersion](#getversion) RPC can be used to find the version of the protoco
l |
| 314 returned by a VM. The _Version_ response has a major and a minor |
| 315 version number: |
| 316 |
| 317 ``` |
| 318 "result": { |
| 319 "type": "Version", |
| 320 "major": 3, |
| 321 "minor": 5 |
| 322 } |
| 323 ``` |
| 324 |
| 325 The major version number is incremented when the protocol is changed |
| 326 in a potentially _incompatible_ way. An example of an incompatible |
| 327 change is removing a non-optional property from a result. |
| 328 |
| 329 The minor version number is incremented when the protocol is changed |
| 330 in a _backwards compatible_ way. An example of a backwards compatible |
| 331 change is adding a property to a result. |
| 332 |
| 333 Certain changes that would normally not be backwards compatible are |
| 334 considered backwards compatible for the purposes of versioning. |
| 335 Specifically, additions can be made to the [EventKind](#eventkind) and |
| 336 [InstanceKind](#instancekind) enumerated types and the client must |
| 337 handle this gracefully. See the notes on these enumerated types for more |
| 338 information. |
| 339 |
| 340 ## Private RPCs, Types, and Properties |
| 341 |
| 342 Any RPC, type, or property which begins with an underscore is said to |
| 343 be _private_. These RPCs, types, and fields can be changed at any |
| 344 time without changing major or minor version numbers. |
| 345 |
| 346 The intention is that the Service Protocol will evolve by adding |
| 347 private RPCs which may, over time, migrate to the public api as they |
| 348 become stable. Some private types and properties expose VM specific |
| 349 implementation state and will never be appropriate to add to |
| 350 the public api. |
| 351 |
| 352 ## Public RPCs |
| 353 |
| 354 The following is a list of all public RPCs supported by the Service Protocol. |
| 355 |
| 356 An RPC is described using the following format: |
| 357 |
| 358 ``` |
| 359 ReturnType methodName(parameterType1 parameterName1, |
| 360 parameterType2, parameterName2, |
| 361 ...) |
| 362 ``` |
| 363 |
| 364 If an RPC says it returns type _T_ it may actually return _T_ or any |
| 365 [subtype](#public-types) of _T_. For example, an |
| 366 RPC which is declared to return [@Object](#object) may actually |
| 367 return [@Instance](#instance). |
| 368 |
| 369 If an RPC can return one or more independent types, this is indicated |
| 370 with the vertical bar: |
| 371 |
| 372 ``` |
| 373 ReturnType1|ReturnType2 |
| 374 ``` |
| 375 |
| 376 Any RPC may return an _error_ response as [described above](#rpc-error). |
| 377 |
| 378 Some parameters are optional. This is indicated by the text |
| 379 _[optional]_ following the parameter name: |
| 380 |
| 381 ``` |
| 382 ReturnType methodName(parameterType parameterName [optional) |
| 383 ``` |
| 384 |
| 385 A description of the return types and parameter types is provided |
| 386 in the section on [public types](#public-types). |
| 387 |
| 388 ### addBreakpoint |
| 389 |
| 390 ``` |
| 391 Breakpoint addBreakpoint(string isolateId, |
| 392 string scriptId, |
| 393 int line, |
| 394 int column [optional]) |
| 395 ``` |
| 396 |
| 397 The _addBreakpoint_ RPC is used to add a breakpoint at a specific line |
| 398 of some script. |
| 399 |
| 400 The _scriptId_ parameter is used to specify the target script. |
| 401 |
| 402 The _line_ parameter is used to specify the target line for the |
| 403 breakpoint. If there are multiple possible breakpoints on the target |
| 404 line, then the VM will place the breakpoint at the location which |
| 405 would execute soonest. If it is not possible to set a breakpoint at |
| 406 the target line, the breakpoint will be added at the next possible |
| 407 breakpoint location within the same function. |
| 408 |
| 409 The _column_ parameter may be optionally specified. This is useful |
| 410 for targeting a specific breakpoint on a line with multiple possible |
| 411 breakpoints. |
| 412 |
| 413 If no breakpoint is possible at that line, the _102_ (Cannot add |
| 414 breakpoint) error code is returned. |
| 415 |
| 416 Note that breakpoints are added and removed on a per-isolate basis. |
| 417 |
| 418 See [Breakpoint](#breakpoint). |
| 419 |
| 420 ### addBreakpointWithScriptUri |
| 421 |
| 422 ``` |
| 423 Breakpoint addBreakpointWithScriptUri(string isolateId, |
| 424 string scriptUri, |
| 425 int line, |
| 426 int column [optional]) |
| 427 ``` |
| 428 |
| 429 The _addBreakpoint_ RPC is used to add a breakpoint at a specific line |
| 430 of some script. This RPC is useful when a script has not yet been |
| 431 assigned an id, for example, if a script is in a deferred library |
| 432 which has not yet been loaded. |
| 433 |
| 434 The _scriptUri_ parameter is used to specify the target script. |
| 435 |
| 436 The _line_ parameter is used to specify the target line for the |
| 437 breakpoint. If there are multiple possible breakpoints on the target |
| 438 line, then the VM will place the breakpoint at the location which |
| 439 would execute soonest. If it is not possible to set a breakpoint at |
| 440 the target line, the breakpoint will be added at the next possible |
| 441 breakpoint location within the same function. |
| 442 |
| 443 The _column_ parameter may be optionally specified. This is useful |
| 444 for targeting a specific breakpoint on a line with multiple possible |
| 445 breakpoints. |
| 446 |
| 447 If no breakpoint is possible at that line, the _102_ (Cannot add |
| 448 breakpoint) error code is returned. |
| 449 |
| 450 Note that breakpoints are added and removed on a per-isolate basis. |
| 451 |
| 452 See [Breakpoint](#breakpoint). |
| 453 |
| 454 ### addBreakpointAtEntry |
| 455 |
| 456 ``` |
| 457 Breakpoint addBreakpointAtEntry(string isolateId, |
| 458 string functionId) |
| 459 ``` |
| 460 The _addBreakpointAtEntry_ RPC is used to add a breakpoint at the |
| 461 entrypoint of some function. |
| 462 |
| 463 If no breakpoint is possible at the function entry, the _102_ (Cannot add |
| 464 breakpoint) error code is returned. |
| 465 |
| 466 See [Breakpoint](#breakpoint). |
| 467 |
| 468 Note that breakpoints are added and removed on a per-isolate basis. |
| 469 |
| 470 ### evaluate |
| 471 |
| 472 ``` |
| 473 @Instance|@Error|Sentinel evaluate(string isolateId, |
| 474 string targetId, |
| 475 string expression) |
| 476 ``` |
| 477 |
| 478 The _evaluate_ RPC is used to evaluate an expression in the context of |
| 479 some target. |
| 480 |
| 481 _targetId_ may refer to a [Library](#library), [Class](#class), or |
| 482 [Instance](#instance). |
| 483 |
| 484 If _targetId_ is a temporary id which has expired, then the _Expired_ |
| 485 [Sentinel](#sentinel) is returned. |
| 486 |
| 487 If _targetId_ refers to an object which has been collected by the VM's |
| 488 garbage collector, then the _Collected_ [Sentinel](#sentinel) is |
| 489 returned. |
| 490 |
| 491 If an error occurs while evaluating the expression, an [@Error](#error) |
| 492 reference will be returned. |
| 493 |
| 494 If the expression is evaluated successfully, an [@Instance](#instance) |
| 495 reference will be returned. |
| 496 |
| 497 ### evaluateInFrame |
| 498 |
| 499 ``` |
| 500 @Instance|@Error evaluateInFrame(string isolateId, |
| 501 int frameIndex, |
| 502 string expression) |
| 503 ``` |
| 504 |
| 505 The _evaluateInFrame_ RPC is used to evaluate an expression in the |
| 506 context of a particular stack frame. _frameIndex_ is the index of the |
| 507 desired [Frame](#frame), with an index of _0_ indicating the top (most |
| 508 recent) frame. |
| 509 |
| 510 If an error occurs while evaluating the expression, an [@Error](#error) |
| 511 reference will be returned. |
| 512 |
| 513 If the expression is evaluated successfully, an [@Instance](#instance) |
| 514 reference will be returned. |
| 515 |
| 516 ### getFlagList |
| 517 |
| 518 ``` |
| 519 FlagList getFlagList() |
| 520 ``` |
| 521 |
| 522 The _getFlagList_ RPC returns a list of all command line flags in the |
| 523 VM along with their current values. |
| 524 |
| 525 See [FlagList](#flaglist). |
| 526 |
| 527 ### getIsolate |
| 528 |
| 529 ``` |
| 530 Isolate|Sentinel getIsolate(string isolateId) |
| 531 ``` |
| 532 |
| 533 The _getIsolate_ RPC is used to lookup an _Isolate_ object by its _id_. |
| 534 |
| 535 If _isolateId_ refers to an isolate which has exited, then the |
| 536 _Collected_ [Sentinel](#sentinel) is returned. |
| 537 |
| 538 See [Isolate](#isolate). |
| 539 |
| 540 ### getObject |
| 541 |
| 542 ``` |
| 543 Object|Sentinel getObject(string isolateId, |
| 544 string objectId, |
| 545 int offset [optional], |
| 546 int count [optional]) |
| 547 ``` |
| 548 |
| 549 The _getObject_ RPC is used to lookup an _object_ from some isolate by |
| 550 its _id_. |
| 551 |
| 552 If _objectId_ is a temporary id which has expired, then the _Expired_ |
| 553 [Sentinel](#sentinel) is returned. |
| 554 |
| 555 If _objectId_ refers to a heap object which has been collected by the VM's |
| 556 garbage collector, then the _Collected_ [Sentinel](#sentinel) is |
| 557 returned. |
| 558 |
| 559 If _objectId_ refers to a non-heap object which has been deleted, then |
| 560 the _Collected_ [Sentinel](#sentinel) is returned. |
| 561 |
| 562 If the object handle has not expired and the object has not been |
| 563 collected, then an [Object](#object) will be returned. |
| 564 |
| 565 The _offset_ and _count_ parameters are used to request subranges of |
| 566 Instance objects with the kinds: String, List, Map, Uint8ClampedList, |
| 567 Uint8List, Uint16List, Uint32List, Uint64List, Int8List, Int16List, |
| 568 Int32List, Int64List, Flooat32List, Float64List, Inst32x3List, |
| 569 Float32x4List, and Float64x2List. These parameters are otherwise |
| 570 ignored. |
| 571 |
| 572 ### getStack |
| 573 |
| 574 ``` |
| 575 Stack getStack(string isolateId) |
| 576 ``` |
| 577 |
| 578 The _getStack_ RPC is used to retrieve the current execution stack and |
| 579 message queue for an isolate. The isolate does not need to be paused. |
| 580 |
| 581 See [Stack](#stack). |
| 582 |
| 583 ### getSourceReport |
| 584 |
| 585 ``` |
| 586 SourceReport getSourceReport(string isolateId, |
| 587 SourceReportKind[] reports, |
| 588 string scriptId [optional], |
| 589 int tokenPos [optional], |
| 590 int endTokenPos [optional], |
| 591 bool forceCompile [optional]) |
| 592 ``` |
| 593 |
| 594 The _getSourceReport_ RPC is used to generate a set of reports tied to |
| 595 source locations in an isolate. |
| 596 |
| 597 The _reports_ parameter is used to specify which reports should be |
| 598 generated. The _reports_ parameter is a list, which allows multiple |
| 599 reports to be generated simultaneously from a consistent isolate |
| 600 state. The _reports_ parameter is allowed to be empty (this might be |
| 601 used to force compilation of a particular subrange of some script). |
| 602 |
| 603 The available report kinds are: |
| 604 |
| 605 report kind | meaning |
| 606 ----------- | ------- |
| 607 Coverage | Provide code coverage information |
| 608 PossibleBreakpoints | Provide a list of token positions which correspond to poss
ible breakpoints. |
| 609 |
| 610 The _scriptId_ parameter is used to restrict the report to a |
| 611 particular script. When analyzing a particular script, either or both |
| 612 of the _tokenPos_ and _endTokenPos_ parameters may be provided to |
| 613 restrict the analysis to a subrange of a script (for example, these |
| 614 can be used to restrict the report to the range of a particular class |
| 615 or function). |
| 616 |
| 617 If the _scriptId_ parameter is not provided then the reports are |
| 618 generated for all loaded scripts and the _tokenPos_ and _endTokenPos_ |
| 619 parameters are disallowed. |
| 620 |
| 621 The _forceCompilation_ parameter can be used to force compilation of |
| 622 all functions in the range of the report. Forcing compilation can |
| 623 cause a compilation error, which could terminate the running Dart |
| 624 program. If this parameter is not provided, it is considered to have |
| 625 the value _false_. |
| 626 |
| 627 See [SourceReport](#sourcereport). |
| 628 |
| 629 ### getVersion |
| 630 |
| 631 ``` |
| 632 Version getVersion() |
| 633 ``` |
| 634 |
| 635 The _getVersion_ RPC is used to determine what version of the Service Protocol i
s served by a VM. |
| 636 |
| 637 See [Version](#version). |
| 638 |
| 639 ### getVM |
| 640 |
| 641 ``` |
| 642 VM getVM() |
| 643 ``` |
| 644 |
| 645 The _getVM_ RPC returns global information about a Dart virtual machine. |
| 646 |
| 647 See [VM](#vm). |
| 648 |
| 649 ### pause |
| 650 |
| 651 ``` |
| 652 Success pause(string isolateId) |
| 653 ``` |
| 654 |
| 655 The _pause_ RPC is used to interrupt a running isolate. The RPC enqueues the int
errupt request and potentially returns before the isolate is paused. |
| 656 |
| 657 When the isolate is paused an event will be sent on the _Debug_ stream. |
| 658 |
| 659 See [Success](#success). |
| 660 |
| 661 ### reloadSources |
| 662 |
| 663 |
| 664 ``` |
| 665 ReloadReport reloadSources(string isolateId, |
| 666 bool force [optional], |
| 667 bool pause [optional], |
| 668 string rootLibUri [optional], |
| 669 string packagesUri [optional]) |
| 670 ``` |
| 671 |
| 672 The _reloadSources_ RPC is used to perform a hot reload of an Isolate's sources. |
| 673 |
| 674 if the _force_ parameter is provided, it indicates that all of the Isolate's |
| 675 sources should be reloaded regardless of modification time. |
| 676 |
| 677 if the _pause_ parameter is provided, the isolate will pause immediately |
| 678 after the reload. |
| 679 |
| 680 if the _rootLibUri_ parameter is provided, it indicates the new uri to the |
| 681 Isolate's root library. |
| 682 |
| 683 if the _packagesUri_ parameter is provided, it indicates the new uri to the |
| 684 Isolate's package map (.packages) file. |
| 685 |
| 686 ### removeBreakpoint |
| 687 |
| 688 ``` |
| 689 Success removeBreakpoint(string isolateId, |
| 690 string breakpointId) |
| 691 ``` |
| 692 |
| 693 The _removeBreakpoint_ RPC is used to remove a breakpoint by its _id_. |
| 694 |
| 695 Note that breakpoints are added and removed on a per-isolate basis. |
| 696 |
| 697 See [Success](#success). |
| 698 |
| 699 ### resume |
| 700 |
| 701 ``` |
| 702 Success resume(string isolateId, |
| 703 StepOption step [optional], |
| 704 int frameIndex [optional]) |
| 705 ``` |
| 706 |
| 707 The _resume_ RPC is used to resume execution of a paused isolate. |
| 708 |
| 709 If the _step_ parameter is not provided, the program will resume |
| 710 regular execution. |
| 711 |
| 712 If the _step_ parameter is provided, it indicates what form of |
| 713 single-stepping to use. |
| 714 |
| 715 step | meaning |
| 716 ---- | ------- |
| 717 Into | Single step, entering function calls |
| 718 Over | Single step, skipping over function calls |
| 719 Out | Single step until the current function exits |
| 720 Rewind | Immediately exit the top frame(s) without executing any code. Isolate w
ill be paused at the call of the last exited function. |
| 721 |
| 722 The _frameIndex_ parameter is only used when the _step_ parameter is Rewind. It |
| 723 specifies the stack frame to rewind to. Stack frame 0 is the currently executing |
| 724 function, so _frameIndex_ must be at least 1. |
| 725 |
| 726 If the _frameIndex_ parameter is not provided, it defaults to 1. |
| 727 |
| 728 See [Success](#success), [StepOption](#StepOption). |
| 729 |
| 730 ### setExceptionPauseMode |
| 731 |
| 732 ``` |
| 733 Success setExceptionPauseMode(string isolateId, |
| 734 ExceptionPauseMode mode) |
| 735 ``` |
| 736 |
| 737 The _setExceptionPauseMode_ RPC is used to control if an isolate pauses when |
| 738 an exception is thrown. |
| 739 |
| 740 mode | meaning |
| 741 ---- | ------- |
| 742 None | Do not pause isolate on thrown exceptions |
| 743 Unhandled | Pause isolate on unhandled exceptions |
| 744 All | Pause isolate on all thrown exceptions |
| 745 |
| 746 |
| 747 ### setLibraryDebuggable |
| 748 |
| 749 ``` |
| 750 Success setLibraryDebuggable(string isolateId, |
| 751 string libraryId, |
| 752 bool isDebuggable) |
| 753 ``` |
| 754 |
| 755 The _setLibraryDebuggable_ RPC is used to enable or disable whether |
| 756 breakpoints and stepping work for a given library. |
| 757 |
| 758 See [Success](#success). |
| 759 |
| 760 ### setName |
| 761 |
| 762 ``` |
| 763 Success setName(string isolateId, |
| 764 string name) |
| 765 ``` |
| 766 |
| 767 The _setName_ RPC is used to change the debugging name for an isolate. |
| 768 |
| 769 See [Success](#success). |
| 770 |
| 771 ### setVMName |
| 772 |
| 773 ``` |
| 774 Success setVMName(string name) |
| 775 ``` |
| 776 |
| 777 The _setVMName_ RPC is used to change the debugging name for the vm. |
| 778 |
| 779 See [Success](#success). |
| 780 |
| 781 ### streamCancel |
| 782 |
| 783 ``` |
| 784 Success streamCancel(string streamId) |
| 785 ``` |
| 786 |
| 787 The _streamCancel_ RPC cancels a stream subscription in the VM. |
| 788 |
| 789 If the client is not subscribed to the stream, the _104_ (Stream not |
| 790 subscribed) error code is returned. |
| 791 |
| 792 See [Success](#success). |
| 793 |
| 794 ### streamListen |
| 795 |
| 796 ``` |
| 797 Success streamListen(string streamId) |
| 798 ``` |
| 799 |
| 800 The _streamListen_ RPC subscribes to a stream in the VM. Once |
| 801 subscribed, the client will begin receiving events from the stream. |
| 802 |
| 803 If the client is not subscribed to the stream, the _103_ (Stream already |
| 804 subscribed) error code is returned. |
| 805 |
| 806 The _streamId_ parameter may have the following published values: |
| 807 |
| 808 streamId | event types provided |
| 809 -------- | ----------- |
| 810 VM | VMUpdate |
| 811 Isolate | IsolateStart, IsolateRunnable, IsolateExit, IsolateUpdate, IsolateRelo
ad, ServiceExtensionAdded |
| 812 Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException
, PausePostRequest, Resume, BreakpointAdded, BreakpointResolved, BreakpointRemov
ed, Inspect, None |
| 813 GC | GC |
| 814 Extension | Extension |
| 815 Timeline | TimelineEvents |
| 816 |
| 817 Additionally, some embedders provide the _Stdout_ and _Stderr_ |
| 818 streams. These streams allow the client to subscribe to writes to |
| 819 stdout and stderr. |
| 820 |
| 821 streamId | event types provided |
| 822 -------- | ----------- |
| 823 Stdout | WriteEvent |
| 824 Stderr | WriteEvent |
| 825 |
| 826 It is considered a _backwards compatible_ change to add a new type of event to a
n existing stream. |
| 827 Clients should be written to handle this gracefully, perhaps by warning and igno
ring. |
| 828 |
| 829 See [Success](#success). |
| 830 |
| 831 ## Public Types |
| 832 |
| 833 The following is a list of all public types produced by the Service Protocol. |
| 834 |
| 835 We define a small set of primitive types, based on JSON equivalents. |
| 836 |
| 837 type | meaning |
| 838 ---- | ------- |
| 839 string | JSON string values |
| 840 bool | JSON _true_, _false_ |
| 841 int | JSON numbers without fractions or exponents |
| 842 float | any JSON number |
| 843 |
| 844 Note that the Service Protocol does not use JSON _null_. |
| 845 |
| 846 We describe the format of our JSON objects with the following class format: |
| 847 |
| 848 ``` |
| 849 class T { |
| 850 string name; |
| 851 int count; |
| 852 ... |
| 853 } |
| 854 ``` |
| 855 |
| 856 This describes a JSON object type _T_ with some set of expected properties. |
| 857 |
| 858 Types are organized into an inheritance hierarchy. If type _T_ |
| 859 extends type _S_... |
| 860 |
| 861 ``` |
| 862 class S { |
| 863 string a; |
| 864 } |
| 865 |
| 866 class T extends S { |
| 867 string b; |
| 868 } |
| 869 ``` |
| 870 |
| 871 ...then that means that all properties of _S_ are also present in type |
| 872 _T_. In the example above, type _T_ would have the expected |
| 873 properties _a_ and _b_. |
| 874 |
| 875 If a property has an _Array_ type, it is written with brackets: |
| 876 |
| 877 ``` |
| 878 PropertyType[] arrayProperty; |
| 879 ``` |
| 880 |
| 881 If a property is optional, it is suffixed with the text _[optional]_: |
| 882 |
| 883 ``` |
| 884 PropertyType optionalProperty [optional]; |
| 885 ``` |
| 886 |
| 887 If a property can have multiple independent types, we denote this with |
| 888 a vertical bar: |
| 889 |
| 890 ``` |
| 891 PropertyType1|PropertyType2 complexProperty; |
| 892 ``` |
| 893 |
| 894 We also allow parenthesis on type expressions. This is useful when a property |
| 895 is an _Array_ of multiple independent types: |
| 896 |
| 897 ``` |
| 898 (PropertyType1|PropertyType2)[] |
| 899 ``` |
| 900 |
| 901 When a string is only permitted to take one of a certain set of values, |
| 902 we indicate this by the use of the _enum_ format: |
| 903 |
| 904 ``` |
| 905 enum PermittedValues { |
| 906 Value1, |
| 907 Value2 |
| 908 } |
| 909 ``` |
| 910 |
| 911 This means that _PermittedValues_ is a _string_ with two potential values, |
| 912 _Value1_ and _Value2_. |
| 913 |
| 914 ### BoundField |
| 915 |
| 916 ``` |
| 917 class BoundField { |
| 918 @Field decl; |
| 919 @Instance|Sentinel value; |
| 920 } |
| 921 ``` |
| 922 |
| 923 A _BoundField_ represents a field bound to a particular value in an |
| 924 _Instance_. |
| 925 |
| 926 If the field is uninitialized, the _value_ will be the |
| 927 _NotInitialized_ [Sentinel](#sentinel). |
| 928 |
| 929 If the field is being initialized, the _value_ will be the |
| 930 _BeingInitialized_ [Sentinel](#sentinel). |
| 931 |
| 932 ### BoundVariable |
| 933 |
| 934 ``` |
| 935 class BoundVariable { |
| 936 string name; |
| 937 @Instance|Sentinel value; |
| 938 |
| 939 // The token position where this variable was declared. |
| 940 int declarationTokenPos; |
| 941 |
| 942 // The first token position where this variable is visible to the scope. |
| 943 int scopeStartTokenPos; |
| 944 |
| 945 // The last token position where this variable is visible to the scope. |
| 946 int scopeEndTokenPos; |
| 947 } |
| 948 ``` |
| 949 |
| 950 A _BoundVariable_ represents a local variable bound to a particular value |
| 951 in a _Frame_. |
| 952 |
| 953 If the variable is uninitialized, the _value_ will be the |
| 954 _NotInitialized_ [Sentinel](#sentinel). |
| 955 |
| 956 If the variable is being initialized, the _value_ will be the |
| 957 _BeingInitialized_ [Sentinel](#sentinel). |
| 958 |
| 959 If the variable has been optimized out by the compiler, the _value_ |
| 960 will be the _OptimizedOut_ [Sentinel](#sentinel). |
| 961 |
| 962 ### Breakpoint |
| 963 |
| 964 ``` |
| 965 class Breakpoint extends Object { |
| 966 // A number identifying this breakpoint to the user. |
| 967 int breakpointNumber; |
| 968 |
| 969 // Has this breakpoint been assigned to a specific program location? |
| 970 bool resolved; |
| 971 |
| 972 // Is this a breakpoint that was added synthetically as part of a step |
| 973 // OverAsyncSuspension resume command? |
| 974 bool isSyntheticAsyncContinuation [optional]; |
| 975 |
| 976 // SourceLocation when breakpoint is resolved, UnresolvedSourceLocation |
| 977 // when a breakpoint is not resolved. |
| 978 SourceLocation|UnresolvedSourceLocation location; |
| 979 } |
| 980 ``` |
| 981 |
| 982 A _Breakpoint_ describes a debugger breakpoint. |
| 983 |
| 984 A breakpoint is _resolved_ when it has been assigned to a specific |
| 985 program location. A breakpoint my remain unresolved when it is in |
| 986 code which has not yet been compiled or in a library which has not |
| 987 been loaded (i.e. a deferred library). |
| 988 |
| 989 ### Class |
| 990 |
| 991 ``` |
| 992 class @Class extends @Object { |
| 993 // The name of this class. |
| 994 string name; |
| 995 } |
| 996 ``` |
| 997 |
| 998 _@Class_ is a reference to a _Class_. |
| 999 |
| 1000 ``` |
| 1001 class Class extends Object { |
| 1002 // The name of this class. |
| 1003 string name; |
| 1004 |
| 1005 // The error which occurred during class finalization, if it exists. |
| 1006 @Error error [optional]; |
| 1007 |
| 1008 // Is this an abstract class? |
| 1009 bool abstract; |
| 1010 |
| 1011 // Is this a const class? |
| 1012 bool const; |
| 1013 |
| 1014 // The library which contains this class. |
| 1015 @Library library; |
| 1016 |
| 1017 // The location of this class in the source code. |
| 1018 SourceLocation location [optional]; |
| 1019 |
| 1020 // The superclass of this class, if any. |
| 1021 @Class super [optional]; |
| 1022 |
| 1023 // The supertype for this class, if any. |
| 1024 // |
| 1025 // The value will be of the kind: Type. |
| 1026 @Instance superType [optional]; |
| 1027 |
| 1028 // A list of interface types for this class. |
| 1029 // |
| 1030 // The values will be of the kind: Type. |
| 1031 @Instance[] interfaces; |
| 1032 |
| 1033 // The mixin type for this class, if any. |
| 1034 // |
| 1035 // The value will be of the kind: Type. |
| 1036 @Instance mixin [optional]; |
| 1037 |
| 1038 // A list of fields in this class. Does not include fields from |
| 1039 // superclasses. |
| 1040 @Field[] fields; |
| 1041 |
| 1042 // A list of functions in this class. Does not include functions |
| 1043 // from superclasses. |
| 1044 @Function[] functions; |
| 1045 |
| 1046 // A list of subclasses of this class. |
| 1047 @Class[] subclasses; |
| 1048 } |
| 1049 ``` |
| 1050 |
| 1051 A _Class_ provides information about a Dart language class. |
| 1052 |
| 1053 ### ClassList |
| 1054 |
| 1055 ``` |
| 1056 class ClassList extends Response { |
| 1057 @Class[] classes; |
| 1058 } |
| 1059 ``` |
| 1060 |
| 1061 ### Code |
| 1062 |
| 1063 ``` |
| 1064 class @Code extends @Object { |
| 1065 // A name for this code object. |
| 1066 string name; |
| 1067 |
| 1068 // What kind of code object is this? |
| 1069 CodeKind kind; |
| 1070 } |
| 1071 ``` |
| 1072 |
| 1073 _@Code_ is a reference to a _Code_ object. |
| 1074 |
| 1075 ``` |
| 1076 class Code extends @Object { |
| 1077 // A name for this code object. |
| 1078 string name; |
| 1079 |
| 1080 // What kind of code object is this? |
| 1081 CodeKind kind; |
| 1082 } |
| 1083 ``` |
| 1084 |
| 1085 A _Code_ object represents compiled code in the Dart VM. |
| 1086 |
| 1087 ### CodeKind |
| 1088 |
| 1089 ``` |
| 1090 enum CodeKind { |
| 1091 Dart, |
| 1092 Native, |
| 1093 Stub, |
| 1094 Tag, |
| 1095 Collected |
| 1096 } |
| 1097 ``` |
| 1098 |
| 1099 ### Context |
| 1100 |
| 1101 ``` |
| 1102 class @Context extends @Object { |
| 1103 // The number of variables in this context. |
| 1104 int length; |
| 1105 } |
| 1106 ``` |
| 1107 |
| 1108 ``` |
| 1109 class Context extends Object { |
| 1110 // The number of variables in this context. |
| 1111 int length; |
| 1112 |
| 1113 // The enclosing context for this context. |
| 1114 Context parent [optional]; |
| 1115 |
| 1116 // The variables in this context object. |
| 1117 ContextElement[] variables; |
| 1118 } |
| 1119 ``` |
| 1120 |
| 1121 A _Context_ is a data structure which holds the captured variables for |
| 1122 some closure. |
| 1123 |
| 1124 ### ContextElement |
| 1125 |
| 1126 ``` |
| 1127 class ContextElement { |
| 1128 @Instance|Sentinel value; |
| 1129 } |
| 1130 ``` |
| 1131 |
| 1132 ### Error |
| 1133 |
| 1134 ``` |
| 1135 class @Error extends @Object { |
| 1136 // What kind of error is this? |
| 1137 ErrorKind kind; |
| 1138 |
| 1139 // A description of the error. |
| 1140 string message; |
| 1141 } |
| 1142 ``` |
| 1143 |
| 1144 _@Error_ is a reference to an _Error_. |
| 1145 |
| 1146 ``` |
| 1147 class Error extends Object { |
| 1148 // What kind of error is this? |
| 1149 ErrorKind kind; |
| 1150 |
| 1151 // A description of the error. |
| 1152 string message; |
| 1153 |
| 1154 // If this error is due to an unhandled exception, this |
| 1155 // is the exception thrown. |
| 1156 @Instance exception [optional]; |
| 1157 |
| 1158 // If this error is due to an unhandled exception, this |
| 1159 // is the stacktrace object. |
| 1160 @Instance stacktrace [optional]; |
| 1161 } |
| 1162 ``` |
| 1163 |
| 1164 An _Error_ represents a Dart language level error. This is distinct from an |
| 1165 [rpc error](#rpc-error). |
| 1166 |
| 1167 ### ErrorKind |
| 1168 |
| 1169 ``` |
| 1170 enum ErrorKind { |
| 1171 // The isolate has encountered an unhandled Dart exception. |
| 1172 UnhandledException, |
| 1173 |
| 1174 // The isolate has encountered a Dart language error in the program. |
| 1175 LanguageError, |
| 1176 |
| 1177 // The isolate has encounted an internal error. These errors should be |
| 1178 // reported as bugs. |
| 1179 InternalError, |
| 1180 |
| 1181 // The isolate has been terminated by an external source. |
| 1182 TerminationError |
| 1183 } |
| 1184 ``` |
| 1185 |
| 1186 ### Event |
| 1187 |
| 1188 ``` |
| 1189 class Event extends Response { |
| 1190 // What kind of event is this? |
| 1191 EventKind kind; |
| 1192 |
| 1193 // The isolate with which this event is associated. |
| 1194 // |
| 1195 // This is provided for all event kinds except for: |
| 1196 // VMUpdate |
| 1197 @Isolate isolate [optional]; |
| 1198 |
| 1199 // The vm with which this event is associated. |
| 1200 // |
| 1201 // This is provided for the event kind: |
| 1202 // VMUpdate |
| 1203 @VM vm [optional]; |
| 1204 |
| 1205 // The timestamp (in milliseconds since the epoch) associated with this event. |
| 1206 // For some isolate pause events, the timestamp is from when the isolate was |
| 1207 // paused. For other events, the timestamp is from when the event was created. |
| 1208 int timestamp; |
| 1209 |
| 1210 // The breakpoint which was added, removed, or resolved. |
| 1211 // |
| 1212 // This is provided for the event kinds: |
| 1213 // PauseBreakpoint |
| 1214 // BreakpointAdded |
| 1215 // BreakpointRemoved |
| 1216 // BreakpointResolved |
| 1217 Breakpoint breakpoint [optional]; |
| 1218 |
| 1219 // The list of breakpoints at which we are currently paused |
| 1220 // for a PauseBreakpoint event. |
| 1221 // |
| 1222 // This list may be empty. For example, while single-stepping, the |
| 1223 // VM sends a PauseBreakpoint event with no breakpoints. |
| 1224 // |
| 1225 // If there is more than one breakpoint set at the program position, |
| 1226 // then all of them will be provided. |
| 1227 // |
| 1228 // This is provided for the event kinds: |
| 1229 // PauseBreakpoint |
| 1230 Breakpoint[] pauseBreakpoints [optional]; |
| 1231 |
| 1232 // The top stack frame associated with this event, if applicable. |
| 1233 // |
| 1234 // This is provided for the event kinds: |
| 1235 // PauseBreakpoint |
| 1236 // PauseInterrupted |
| 1237 // PauseException |
| 1238 // |
| 1239 // For PauseInterrupted events, there will be no top frame if the |
| 1240 // isolate is idle (waiting in the message loop). |
| 1241 // |
| 1242 // For the Resume event, the top frame is provided at |
| 1243 // all times except for the initial resume event that is delivered |
| 1244 // when an isolate begins execution. |
| 1245 Frame topFrame [optional]; |
| 1246 |
| 1247 // The exception associated with this event, if this is a |
| 1248 // PauseException event. |
| 1249 @Instance exception [optional]; |
| 1250 |
| 1251 // An array of bytes, encoded as a base64 string. |
| 1252 // |
| 1253 // This is provided for the WriteEvent event. |
| 1254 string bytes [optional]; |
| 1255 |
| 1256 // The argument passed to dart:developer.inspect. |
| 1257 // |
| 1258 // This is provided for the Inspect event. |
| 1259 @Instance inspectee [optional]; |
| 1260 |
| 1261 // The RPC name of the extension that was added. |
| 1262 // |
| 1263 // This is provided for the ServiceExtensionAdded event. |
| 1264 string extensionRPC [optional]; |
| 1265 |
| 1266 // The extension event kind. |
| 1267 // |
| 1268 // This is provided for the Extension event. |
| 1269 string extensionKind [optional]; |
| 1270 |
| 1271 // The extension event data. |
| 1272 // |
| 1273 // This is provided for the Extension event. |
| 1274 ExtensionData extensionData [optional]; |
| 1275 |
| 1276 // An array of TimelineEvents |
| 1277 // |
| 1278 // This is provided for the TimelineEvents event. |
| 1279 TimelineEvent[] timelineEvents [optional]; |
| 1280 |
| 1281 // Is the isolate paused at an await, yield, or yield* statement? |
| 1282 // |
| 1283 // This is provided for the event kinds: |
| 1284 // PauseBreakpoint |
| 1285 // PauseInterrupted |
| 1286 bool atAsyncSuspension [optional]; |
| 1287 |
| 1288 // The status (success or failure) related to the event. |
| 1289 // This is provided for the event kinds: |
| 1290 // IsolateReloaded |
| 1291 // IsolateSpawn |
| 1292 string status [optional]; |
| 1293 } |
| 1294 ``` |
| 1295 |
| 1296 An _Event_ is an asynchronous notification from the VM. It is delivered |
| 1297 only when the client has subscribed to an event stream using the |
| 1298 [streamListen](#streamListen) RPC. |
| 1299 |
| 1300 For more information, see [events](#events). |
| 1301 |
| 1302 ### EventKind |
| 1303 |
| 1304 ``` |
| 1305 enum EventKind { |
| 1306 // Notification that VM identifying information has changed. Currently used |
| 1307 // to notify of changes to the VM debugging name via setVMName. |
| 1308 VMUpdate, |
| 1309 |
| 1310 // Notification that a new isolate has started. |
| 1311 IsolateStart, |
| 1312 |
| 1313 // Notification that an isolate is ready to run. |
| 1314 IsolateRunnable, |
| 1315 |
| 1316 // Notification that an isolate has exited. |
| 1317 IsolateExit, |
| 1318 |
| 1319 // Notification that isolate identifying information has changed. |
| 1320 // Currently used to notify of changes to the isolate debugging name |
| 1321 // via setName. |
| 1322 IsolateUpdate, |
| 1323 |
| 1324 // Notification that an isolate has been reloaded. |
| 1325 IsolateReload, |
| 1326 |
| 1327 // Notification that an extension RPC was registered on an isolate. |
| 1328 ServiceExtensionAdded, |
| 1329 |
| 1330 // An isolate has paused at start, before executing code. |
| 1331 PauseStart, |
| 1332 |
| 1333 // An isolate has paused at exit, before terminating. |
| 1334 PauseExit, |
| 1335 |
| 1336 // An isolate has paused at a breakpoint or due to stepping. |
| 1337 PauseBreakpoint, |
| 1338 |
| 1339 // An isolate has paused due to interruption via pause. |
| 1340 PauseInterrupted, |
| 1341 |
| 1342 // An isolate has paused due to an exception. |
| 1343 PauseException, |
| 1344 |
| 1345 // An isolate has paused after a service request. |
| 1346 PausePostRequest, |
| 1347 |
| 1348 // An isolate has started or resumed execution. |
| 1349 Resume, |
| 1350 |
| 1351 // Indicates an isolate is not yet runnable. Only appears in an Isolate's |
| 1352 // pauseEvent. Never sent over a stream. |
| 1353 None, |
| 1354 |
| 1355 // A breakpoint has been added for an isolate. |
| 1356 BreakpointAdded, |
| 1357 |
| 1358 // An unresolved breakpoint has been resolved for an isolate. |
| 1359 BreakpointResolved, |
| 1360 |
| 1361 // A breakpoint has been removed. |
| 1362 BreakpointRemoved, |
| 1363 |
| 1364 // A garbage collection event. |
| 1365 GC, |
| 1366 |
| 1367 // Notification of bytes written, for example, to stdout/stderr. |
| 1368 WriteEvent, |
| 1369 |
| 1370 // Notification from dart:developer.inspect. |
| 1371 Inspect, |
| 1372 |
| 1373 // Event from dart:developer.postEvent. |
| 1374 Extension |
| 1375 } |
| 1376 ``` |
| 1377 |
| 1378 Adding new values to _EventKind_ is considered a backwards compatible |
| 1379 change. Clients should ignore unrecognized events. |
| 1380 |
| 1381 ### ExtensionData |
| 1382 |
| 1383 ``` |
| 1384 class ExtensionData { |
| 1385 } |
| 1386 ``` |
| 1387 |
| 1388 An _ExtensionData_ is an arbitrary map that can have any contents. |
| 1389 |
| 1390 ### Field |
| 1391 |
| 1392 ``` |
| 1393 class @Field extends @Object { |
| 1394 // The name of this field. |
| 1395 string name; |
| 1396 |
| 1397 // The owner of this field, which can be either a Library or a |
| 1398 // Class. |
| 1399 @Object owner; |
| 1400 |
| 1401 // The declared type of this field. |
| 1402 // |
| 1403 // The value will always be of one of the kinds: |
| 1404 // Type, TypeRef, TypeParameter, BoundedType. |
| 1405 @Instance declaredType; |
| 1406 |
| 1407 // Is this field const? |
| 1408 bool const; |
| 1409 |
| 1410 // Is this field final? |
| 1411 bool final; |
| 1412 |
| 1413 // Is this field static? |
| 1414 bool static; |
| 1415 } |
| 1416 ``` |
| 1417 |
| 1418 An _@Field_ is a reference to a _Field_. |
| 1419 |
| 1420 ``` |
| 1421 class Field extends Object { |
| 1422 // The name of this field. |
| 1423 string name; |
| 1424 |
| 1425 // The owner of this field, which can be either a Library or a |
| 1426 // Class. |
| 1427 @Object owner; |
| 1428 |
| 1429 // The declared type of this field. |
| 1430 // |
| 1431 // The value will always be of one of the kinds: |
| 1432 // Type, TypeRef, TypeParameter, BoundedType. |
| 1433 @Instance declaredType; |
| 1434 |
| 1435 // Is this field const? |
| 1436 bool const; |
| 1437 |
| 1438 // Is this field final? |
| 1439 bool final; |
| 1440 |
| 1441 // Is this field static? |
| 1442 bool static; |
| 1443 |
| 1444 // The value of this field, if the field is static. |
| 1445 @Instance staticValue [optional]; |
| 1446 |
| 1447 // The location of this field in the source code. |
| 1448 SourceLocation location [optional]; |
| 1449 } |
| 1450 ``` |
| 1451 |
| 1452 A _Field_ provides information about a Dart language field or |
| 1453 variable. |
| 1454 |
| 1455 |
| 1456 ### Flag |
| 1457 |
| 1458 ``` |
| 1459 class Flag { |
| 1460 // The name of the flag. |
| 1461 string name; |
| 1462 |
| 1463 // A description of the flag. |
| 1464 string comment; |
| 1465 |
| 1466 // Has this flag been modified from its default setting? |
| 1467 bool modified; |
| 1468 |
| 1469 // The value of this flag as a string. |
| 1470 // |
| 1471 // If this property is absent, then the value of the flag was NULL. |
| 1472 string valueAsString [optional]; |
| 1473 } |
| 1474 ``` |
| 1475 |
| 1476 A _Flag_ represents a single VM command line flag. |
| 1477 |
| 1478 ### FlagList |
| 1479 |
| 1480 ``` |
| 1481 class FlagList extends Response { |
| 1482 // A list of all flags in the VM. |
| 1483 Flag[] flags; |
| 1484 } |
| 1485 ``` |
| 1486 |
| 1487 A _FlagList_ represents the complete set of VM command line flags. |
| 1488 |
| 1489 ### Frame |
| 1490 |
| 1491 ``` |
| 1492 class Frame extends Response { |
| 1493 int index; |
| 1494 @Function function; |
| 1495 @Code code; |
| 1496 SourceLocation location [optional]; |
| 1497 BoundVariable[] vars [optional]; |
| 1498 FrameKind kind [optional]; |
| 1499 } |
| 1500 ``` |
| 1501 |
| 1502 ### Function |
| 1503 |
| 1504 ``` |
| 1505 class @Function extends @Object { |
| 1506 // The name of this function. |
| 1507 string name; |
| 1508 |
| 1509 // The owner of this function, which can be a Library, Class, or a Function. |
| 1510 @Library|@Class|@Function owner; |
| 1511 |
| 1512 // Is this function static? |
| 1513 bool static; |
| 1514 |
| 1515 // Is this function const? |
| 1516 bool const; |
| 1517 } |
| 1518 ``` |
| 1519 |
| 1520 An _@Function_ is a reference to a _Function_. |
| 1521 |
| 1522 |
| 1523 ``` |
| 1524 class Function extends Object { |
| 1525 // The name of this function. |
| 1526 string name; |
| 1527 |
| 1528 // The owner of this function, which can be a Library, Class, or a Function. |
| 1529 @Library|@Class|@Function owner; |
| 1530 |
| 1531 // The location of this function in the source code. |
| 1532 SourceLocation location [optional]; |
| 1533 |
| 1534 // The compiled code associated with this function. |
| 1535 @Code code [optional]; |
| 1536 } |
| 1537 ``` |
| 1538 |
| 1539 A _Function_ represents a Dart language function. |
| 1540 |
| 1541 ### Instance |
| 1542 |
| 1543 ``` |
| 1544 class @Instance extends @Object { |
| 1545 // What kind of instance is this? |
| 1546 InstanceKind kind; |
| 1547 |
| 1548 // Instance references always include their class. |
| 1549 @Class class; |
| 1550 |
| 1551 // The value of this instance as a string. |
| 1552 // |
| 1553 // Provided for the instance kinds: |
| 1554 // Null (null) |
| 1555 // Bool (true or false) |
| 1556 // Double (suitable for passing to Double.parse()) |
| 1557 // Int (suitable for passing to int.parse()) |
| 1558 // String (value may be truncated) |
| 1559 // Float32x4 |
| 1560 // Float64x2 |
| 1561 // Int32x4 |
| 1562 // StackTrace |
| 1563 string valueAsString [optional]; |
| 1564 |
| 1565 // The valueAsString for String references may be truncated. If so, |
| 1566 // this property is added with the value 'true'. |
| 1567 // |
| 1568 // New code should use 'length' and 'count' instead. |
| 1569 bool valueAsStringIsTruncated [optional]; |
| 1570 |
| 1571 // The length of a List or the number of associations in a Map or the |
| 1572 // number of codeunits in a String. |
| 1573 // |
| 1574 // Provided for instance kinds: |
| 1575 // String |
| 1576 // List |
| 1577 // Map |
| 1578 // Uint8ClampedList |
| 1579 // Uint8List |
| 1580 // Uint16List |
| 1581 // Uint32List |
| 1582 // Uint64List |
| 1583 // Int8List |
| 1584 // Int16List |
| 1585 // Int32List |
| 1586 // Int64List |
| 1587 // Float32List |
| 1588 // Float64List |
| 1589 // Int32x4List |
| 1590 // Float32x4List |
| 1591 // Float64x2List |
| 1592 int length [optional]; |
| 1593 |
| 1594 // The name of a Type instance. |
| 1595 // |
| 1596 // Provided for instance kinds: |
| 1597 // Type |
| 1598 string name [optional]; |
| 1599 |
| 1600 // The corresponding Class if this Type has a resolved typeClass. |
| 1601 // |
| 1602 // Provided for instance kinds: |
| 1603 // Type |
| 1604 @Class typeClass [optional]; |
| 1605 |
| 1606 // The parameterized class of a type parameter: |
| 1607 // |
| 1608 // Provided for instance kinds: |
| 1609 // TypeParameter |
| 1610 @Class parameterizedClass [optional]; |
| 1611 |
| 1612 |
| 1613 // The pattern of a RegExp instance. |
| 1614 // |
| 1615 // The pattern is always an instance of kind String. |
| 1616 // |
| 1617 // Provided for instance kinds: |
| 1618 // RegExp |
| 1619 @Instance pattern [optional]; |
| 1620 } |
| 1621 ``` |
| 1622 |
| 1623 _@Instance_ is a reference to an _Instance_. |
| 1624 |
| 1625 ``` |
| 1626 class Instance extends Object { |
| 1627 // What kind of instance is this? |
| 1628 InstanceKind kind; |
| 1629 |
| 1630 // Instance references always include their class. |
| 1631 @Class class; |
| 1632 |
| 1633 // The value of this instance as a string. |
| 1634 // |
| 1635 // Provided for the instance kinds: |
| 1636 // Bool (true or false) |
| 1637 // Double (suitable for passing to Double.parse()) |
| 1638 // Int (suitable for passing to int.parse()) |
| 1639 // String (value may be truncated) |
| 1640 string valueAsString [optional]; |
| 1641 |
| 1642 // The valueAsString for String references may be truncated. If so, |
| 1643 // this property is added with the value 'true'. |
| 1644 // |
| 1645 // New code should use 'length' and 'count' instead. |
| 1646 bool valueAsStringIsTruncated [optional]; |
| 1647 |
| 1648 // The length of a List or the number of associations in a Map or the |
| 1649 // number of codeunits in a String. |
| 1650 // |
| 1651 // Provided for instance kinds: |
| 1652 // String |
| 1653 // List |
| 1654 // Map |
| 1655 // Uint8ClampedList |
| 1656 // Uint8List |
| 1657 // Uint16List |
| 1658 // Uint32List |
| 1659 // Uint64List |
| 1660 // Int8List |
| 1661 // Int16List |
| 1662 // Int32List |
| 1663 // Int64List |
| 1664 // Float32List |
| 1665 // Float64List |
| 1666 // Int32x4List |
| 1667 // Float32x4List |
| 1668 // Float64x2List |
| 1669 int length [optional]; |
| 1670 |
| 1671 // The index of the first element or association or codeunit returned. |
| 1672 // This is only provided when it is non-zero. |
| 1673 // |
| 1674 // Provided for instance kinds: |
| 1675 // String |
| 1676 // List |
| 1677 // Map |
| 1678 // Uint8ClampedList |
| 1679 // Uint8List |
| 1680 // Uint16List |
| 1681 // Uint32List |
| 1682 // Uint64List |
| 1683 // Int8List |
| 1684 // Int16List |
| 1685 // Int32List |
| 1686 // Int64List |
| 1687 // Float32List |
| 1688 // Float64List |
| 1689 // Int32x4List |
| 1690 // Float32x4List |
| 1691 // Float64x2List |
| 1692 int offset [optional]; |
| 1693 |
| 1694 // The number of elements or associations or codeunits returned. |
| 1695 // This is only provided when it is less than length. |
| 1696 // |
| 1697 // Provided for instance kinds: |
| 1698 // String |
| 1699 // List |
| 1700 // Map |
| 1701 // Uint8ClampedList |
| 1702 // Uint8List |
| 1703 // Uint16List |
| 1704 // Uint32List |
| 1705 // Uint64List |
| 1706 // Int8List |
| 1707 // Int16List |
| 1708 // Int32List |
| 1709 // Int64List |
| 1710 // Float32List |
| 1711 // Float64List |
| 1712 // Int32x4List |
| 1713 // Float32x4List |
| 1714 // Float64x2List |
| 1715 int count [optional]; |
| 1716 |
| 1717 // The name of a Type instance. |
| 1718 // |
| 1719 // Provided for instance kinds: |
| 1720 // Type |
| 1721 string name [optional]; |
| 1722 |
| 1723 // The corresponding Class if this Type is canonical. |
| 1724 // |
| 1725 // Provided for instance kinds: |
| 1726 // Type |
| 1727 @Class typeClass [optional]; |
| 1728 |
| 1729 // The parameterized class of a type parameter: |
| 1730 // |
| 1731 // Provided for instance kinds: |
| 1732 // TypeParameter |
| 1733 @Class parameterizedClass [optional]; |
| 1734 |
| 1735 // The fields of this Instance. |
| 1736 BoundField[] fields [optional]; |
| 1737 |
| 1738 // The elements of a List instance. |
| 1739 // |
| 1740 // Provided for instance kinds: |
| 1741 // List |
| 1742 (@Instance|Sentinel)[] elements [optional]; |
| 1743 |
| 1744 // The elements of a Map instance. |
| 1745 // |
| 1746 // Provided for instance kinds: |
| 1747 // Map |
| 1748 MapAssociation[] associations [optional]; |
| 1749 |
| 1750 // The bytes of a TypedData instance. |
| 1751 // |
| 1752 // The data is provided as a Base64 encoded string. |
| 1753 // |
| 1754 // Provided for instance kinds: |
| 1755 // Uint8ClampedList |
| 1756 // Uint8List |
| 1757 // Uint16List |
| 1758 // Uint32List |
| 1759 // Uint64List |
| 1760 // Int8List |
| 1761 // Int16List |
| 1762 // Int32List |
| 1763 // Int64List |
| 1764 // Float32List |
| 1765 // Float64List |
| 1766 // Int32x4List |
| 1767 // Float32x4List |
| 1768 // Float64x2List |
| 1769 string bytes [optional]; |
| 1770 |
| 1771 // The function associated with a Closure instance. |
| 1772 // |
| 1773 // Provided for instance kinds: |
| 1774 // Closure |
| 1775 @Function closureFunction [optional]; |
| 1776 |
| 1777 // The context associated with a Closure instance. |
| 1778 // |
| 1779 // Provided for instance kinds: |
| 1780 // Closure |
| 1781 @Context closureContext [optional]; |
| 1782 |
| 1783 // The referent of a MirrorReference instance. |
| 1784 // |
| 1785 // Provided for instance kinds: |
| 1786 // MirrorReference |
| 1787 @Instance mirrorReferent [optional]; |
| 1788 |
| 1789 // The pattern of a RegExp instance. |
| 1790 // |
| 1791 // Provided for instance kinds: |
| 1792 // RegExp |
| 1793 String pattern [optional]; |
| 1794 |
| 1795 // Whether this regular expression is case sensitive. |
| 1796 // |
| 1797 // Provided for instance kinds: |
| 1798 // RegExp |
| 1799 bool isCaseSensitive [optional]; |
| 1800 |
| 1801 // Whether this regular expression matches multiple lines. |
| 1802 // |
| 1803 // Provided for instance kinds: |
| 1804 // RegExp |
| 1805 bool isMultiLine [optional]; |
| 1806 |
| 1807 // The key for a WeakProperty instance. |
| 1808 // |
| 1809 // Provided for instance kinds: |
| 1810 // WeakProperty |
| 1811 @Instance propertyKey [optional]; |
| 1812 |
| 1813 // The key for a WeakProperty instance. |
| 1814 // |
| 1815 // Provided for instance kinds: |
| 1816 // WeakProperty |
| 1817 @Instance propertyValue [optional]; |
| 1818 |
| 1819 // The type arguments for this type. |
| 1820 // |
| 1821 // Provided for instance kinds: |
| 1822 // Type |
| 1823 @TypeArguments typeArguments [optional]; |
| 1824 |
| 1825 // The index of a TypeParameter instance. |
| 1826 // |
| 1827 // Provided for instance kinds: |
| 1828 // TypeParameter |
| 1829 int parameterIndex [optional]; |
| 1830 |
| 1831 // The type bounded by a BoundedType instance |
| 1832 // - or - |
| 1833 // the referent of a TypeRef instance. |
| 1834 // |
| 1835 // The value will always be of one of the kinds: |
| 1836 // Type, TypeRef, TypeParameter, BoundedType. |
| 1837 // |
| 1838 // Provided for instance kinds: |
| 1839 // BoundedType |
| 1840 // TypeRef |
| 1841 @Instance targetType [optional]; |
| 1842 |
| 1843 // The bound of a TypeParameter or BoundedType. |
| 1844 // |
| 1845 // The value will always be of one of the kinds: |
| 1846 // Type, TypeRef, TypeParameter, BoundedType. |
| 1847 // |
| 1848 // Provided for instance kinds: |
| 1849 // BoundedType |
| 1850 // TypeParameter |
| 1851 @Instance bound [optional]; |
| 1852 } |
| 1853 ``` |
| 1854 |
| 1855 An _Instance_ represents an instance of the Dart language class _Object_. |
| 1856 |
| 1857 ### InstanceKind |
| 1858 |
| 1859 ``` |
| 1860 enum InstanceKind { |
| 1861 // A general instance of the Dart class Object. |
| 1862 PlainInstance, |
| 1863 |
| 1864 // null instance. |
| 1865 Null, |
| 1866 |
| 1867 // true or false. |
| 1868 Bool, |
| 1869 |
| 1870 // An instance of the Dart class double. |
| 1871 Double, |
| 1872 |
| 1873 // An instance of the Dart class int. |
| 1874 Int, |
| 1875 |
| 1876 // An instance of the Dart class String. |
| 1877 String, |
| 1878 |
| 1879 // An instance of the built-in VM List implementation. User-defined |
| 1880 // Lists will be PlainInstance. |
| 1881 List, |
| 1882 |
| 1883 // An instance of the built-in VM Map implementation. User-defined |
| 1884 // Maps will be PlainInstance. |
| 1885 Map, |
| 1886 |
| 1887 // Vector instance kinds. |
| 1888 Float32x4, |
| 1889 Float64x2, |
| 1890 Int32x4 |
| 1891 |
| 1892 // An instance of the built-in VM TypedData implementations. User-defined |
| 1893 // TypedDatas will be PlainInstance. |
| 1894 Uint8ClampedList, |
| 1895 Uint8List, |
| 1896 Uint16List, |
| 1897 Uint32List, |
| 1898 Uint64List, |
| 1899 Int8List, |
| 1900 Int16List, |
| 1901 Int32List, |
| 1902 Int64List, |
| 1903 Float32List, |
| 1904 Float64List, |
| 1905 Int32x4List, |
| 1906 Float32x4List, |
| 1907 Float64x2List, |
| 1908 |
| 1909 // An instance of the Dart class StackTrace. |
| 1910 StackTrace, |
| 1911 |
| 1912 // An instance of the built-in VM Closure implementation. User-defined |
| 1913 // Closures will be PlainInstance. |
| 1914 Closure, |
| 1915 |
| 1916 // An instance of the Dart class MirrorReference. |
| 1917 MirrorReference, |
| 1918 |
| 1919 // An instance of the Dart class RegExp. |
| 1920 RegExp, |
| 1921 |
| 1922 // An instance of the Dart class WeakProperty. |
| 1923 WeakProperty, |
| 1924 |
| 1925 // An instance of the Dart class Type. |
| 1926 Type, |
| 1927 |
| 1928 // An instance of the Dart class TypeParameter. |
| 1929 TypeParameter, |
| 1930 |
| 1931 // An instance of the Dart class TypeRef. |
| 1932 TypeRef, |
| 1933 |
| 1934 // An instance of the Dart class BoundedType. |
| 1935 BoundedType, |
| 1936 } |
| 1937 ``` |
| 1938 |
| 1939 Adding new values to _InstanceKind_ is considered a backwards |
| 1940 compatible change. Clients should treat unrecognized instance kinds |
| 1941 as _PlainInstance_. |
| 1942 |
| 1943 ### Isolate |
| 1944 |
| 1945 ``` |
| 1946 class @Isolate extends Response { |
| 1947 // The id which is passed to the getIsolate RPC to load this isolate. |
| 1948 string id; |
| 1949 |
| 1950 // A numeric id for this isolate, represented as a string. Unique. |
| 1951 string number; |
| 1952 |
| 1953 // A name identifying this isolate. Not guaranteed to be unique. |
| 1954 string name; |
| 1955 } |
| 1956 ``` |
| 1957 |
| 1958 _@Isolate_ is a reference to an _Isolate_ object. |
| 1959 |
| 1960 ``` |
| 1961 class Isolate extends Response { |
| 1962 // The id which is passed to the getIsolate RPC to reload this |
| 1963 // isolate. |
| 1964 string id; |
| 1965 |
| 1966 // A numeric id for this isolate, represented as a string. Unique. |
| 1967 string number; |
| 1968 |
| 1969 // A name identifying this isolate. Not guaranteed to be unique. |
| 1970 string name; |
| 1971 |
| 1972 // The time that the VM started in milliseconds since the epoch. |
| 1973 // |
| 1974 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch. |
| 1975 int startTime; |
| 1976 |
| 1977 // Is the isolate in a runnable state? |
| 1978 bool runnable; |
| 1979 |
| 1980 // The number of live ports for this isolate. |
| 1981 int livePorts; |
| 1982 |
| 1983 // Will this isolate pause when exiting? |
| 1984 bool pauseOnExit; |
| 1985 |
| 1986 // The last pause event delivered to the isolate. If the isolate is |
| 1987 // running, this will be a resume event. |
| 1988 Event pauseEvent; |
| 1989 |
| 1990 // The root library for this isolate. |
| 1991 // |
| 1992 // Guaranteed to be initialized when the IsolateRunnable event fires. |
| 1993 @Library rootLib [optional]; |
| 1994 |
| 1995 // A list of all libraries for this isolate. |
| 1996 // |
| 1997 // Guaranteed to be initialized when the IsolateRunnable event fires. |
| 1998 @Library[] libraries; |
| 1999 |
| 2000 // A list of all breakpoints for this isolate. |
| 2001 Breakpoint[] breakpoints; |
| 2002 |
| 2003 // The error that is causing this isolate to exit, if applicable. |
| 2004 Error error [optional]; |
| 2005 |
| 2006 // The current pause on exception mode for this isolate. |
| 2007 ExceptionPauseMode exceptionPauseMode; |
| 2008 |
| 2009 // The list of service extension RPCs that are registered for this isolate, |
| 2010 // if any. |
| 2011 string[] extensionRPCs [optional]; |
| 2012 } |
| 2013 ``` |
| 2014 |
| 2015 An _Isolate_ object provides information about one isolate in the VM. |
| 2016 |
| 2017 ### Library |
| 2018 |
| 2019 ``` |
| 2020 class @Library extends @Object { |
| 2021 // The name of this library. |
| 2022 string name; |
| 2023 |
| 2024 // The uri of this library. |
| 2025 string uri; |
| 2026 } |
| 2027 ``` |
| 2028 |
| 2029 _@Library_ is a reference to a _Library_. |
| 2030 |
| 2031 ``` |
| 2032 class Library extends Object { |
| 2033 // The name of this library. |
| 2034 string name; |
| 2035 |
| 2036 // The uri of this library. |
| 2037 string uri; |
| 2038 |
| 2039 // Is this library debuggable? Default true. |
| 2040 bool debuggable; |
| 2041 |
| 2042 // A list of the imports for this library. |
| 2043 LibraryDependency[] dependencies; |
| 2044 |
| 2045 // A list of the scripts which constitute this library. |
| 2046 @Script[] scripts; |
| 2047 |
| 2048 // A list of the top-level variables in this library. |
| 2049 @Field[] variables; |
| 2050 |
| 2051 // A list of the top-level functions in this library. |
| 2052 @Function[] functions; |
| 2053 |
| 2054 // A list of all classes in this library. |
| 2055 @Class[] classes; |
| 2056 } |
| 2057 ``` |
| 2058 |
| 2059 A _Library_ provides information about a Dart language library. |
| 2060 |
| 2061 See [setLibraryDebuggable](#setlibrarydebuggable). |
| 2062 |
| 2063 ### LibraryDependency |
| 2064 |
| 2065 ``` |
| 2066 class LibraryDependency { |
| 2067 // Is this dependency an import (rather than an export)? |
| 2068 bool isImport; |
| 2069 |
| 2070 // Is this dependency deferred? |
| 2071 bool isDeferred; |
| 2072 |
| 2073 // The prefix of an 'as' import, or null. |
| 2074 String prefix; |
| 2075 |
| 2076 // The library being imported or exported. |
| 2077 @Library target; |
| 2078 } |
| 2079 ``` |
| 2080 |
| 2081 A _LibraryDependency_ provides information about an import or export. |
| 2082 |
| 2083 ### MapAssociation |
| 2084 |
| 2085 ``` |
| 2086 class MapAssociation { |
| 2087 @Instance|Sentinel key; |
| 2088 @Instance|Sentinel value; |
| 2089 } |
| 2090 ``` |
| 2091 |
| 2092 ### Message |
| 2093 |
| 2094 ``` |
| 2095 class Message extends Response { |
| 2096 // The index in the isolate's message queue. The 0th message being the next |
| 2097 // message to be processed. |
| 2098 int index; |
| 2099 |
| 2100 // An advisory name describing this message. |
| 2101 string name; |
| 2102 |
| 2103 // An instance id for the decoded message. This id can be passed to other |
| 2104 // RPCs, for example, getObject or evaluate. |
| 2105 string messageObjectId; |
| 2106 |
| 2107 // The size (bytes) of the encoded message. |
| 2108 int size; |
| 2109 |
| 2110 // A reference to the function that will be invoked to handle this message. |
| 2111 @Function handler [optional]; |
| 2112 |
| 2113 // The source location of handler. |
| 2114 SourceLocation location [optional]; |
| 2115 } |
| 2116 ``` |
| 2117 |
| 2118 A _Message_ provides information about a pending isolate message and the |
| 2119 function that will be invoked to handle it. |
| 2120 |
| 2121 |
| 2122 ### Null |
| 2123 |
| 2124 ``` |
| 2125 class @Null extends @Instance { |
| 2126 // Always 'null'. |
| 2127 string valueAsString; |
| 2128 } |
| 2129 ``` |
| 2130 |
| 2131 _@Null_ is a reference to an a _Null_. |
| 2132 |
| 2133 ``` |
| 2134 class Null extends Instance { |
| 2135 // Always 'null'. |
| 2136 string valueAsString; |
| 2137 } |
| 2138 ``` |
| 2139 |
| 2140 A _Null_ object represents the Dart language value null. |
| 2141 |
| 2142 ### Object |
| 2143 |
| 2144 ``` |
| 2145 class @Object extends Response { |
| 2146 // A unique identifier for an Object. Passed to the |
| 2147 // getObject RPC to load this Object. |
| 2148 string id; |
| 2149 } |
| 2150 ``` |
| 2151 |
| 2152 _@Object_ is a reference to a _Object_. |
| 2153 |
| 2154 ``` |
| 2155 class Object extends Response { |
| 2156 // A unique identifier for an Object. Passed to the |
| 2157 // getObject RPC to reload this Object. |
| 2158 // |
| 2159 // Some objects may get a new id when they are reloaded. |
| 2160 string id; |
| 2161 |
| 2162 // If an object is allocated in the Dart heap, it will have |
| 2163 // a corresponding class object. |
| 2164 // |
| 2165 // The class of a non-instance is not a Dart class, but is instead |
| 2166 // an internal vm object. |
| 2167 // |
| 2168 // Moving an Object into or out of the heap is considered a |
| 2169 // backwards compatible change for types other than Instance. |
| 2170 @Class class [optional]; |
| 2171 |
| 2172 // The size of this object in the heap. |
| 2173 // |
| 2174 // If an object is not heap-allocated, then this field is omitted. |
| 2175 // |
| 2176 // Note that the size can be zero for some objects. In the current |
| 2177 // VM implementation, this occurs for small integers, which are |
| 2178 // stored entirely within their object pointers. |
| 2179 int size [optional]; |
| 2180 } |
| 2181 ``` |
| 2182 |
| 2183 An _Object_ is a persistent object that is owned by some isolate. |
| 2184 |
| 2185 ### ReloadReport |
| 2186 |
| 2187 ``` |
| 2188 class ReloadReport extends Response { |
| 2189 // Did the reload succeed or fail? |
| 2190 bool success; |
| 2191 } |
| 2192 ``` |
| 2193 |
| 2194 ### Response |
| 2195 |
| 2196 ``` |
| 2197 class Response { |
| 2198 // Every response returned by the VM Service has the |
| 2199 // type property. This allows the client distinguish |
| 2200 // between different kinds of responses. |
| 2201 string type; |
| 2202 } |
| 2203 ``` |
| 2204 |
| 2205 Every non-error response returned by the Service Protocol extends _Response_. |
| 2206 By using the _type_ property, the client can determine which [type](#types) |
| 2207 of response has been provided. |
| 2208 |
| 2209 ### Sentinel |
| 2210 |
| 2211 ``` |
| 2212 class Sentinel extends Response { |
| 2213 // What kind of sentinel is this? |
| 2214 SentinelKind kind; |
| 2215 |
| 2216 // A reasonable string representation of this sentinel. |
| 2217 string valueAsString; |
| 2218 } |
| 2219 ``` |
| 2220 |
| 2221 A _Sentinel_ is used to indicate that the normal response is not available. |
| 2222 |
| 2223 We use a _Sentinel_ instead of an [error](#errors) for these cases because |
| 2224 they do not represent a problematic condition. They are normal. |
| 2225 |
| 2226 ### SentinelKind |
| 2227 |
| 2228 ``` |
| 2229 enum SentinelKind { |
| 2230 // Indicates that the object referred to has been collected by the GC. |
| 2231 Collected, |
| 2232 |
| 2233 // Indicates that an object id has expired. |
| 2234 Expired, |
| 2235 |
| 2236 // Indicates that a variable or field has not been initialized. |
| 2237 NotInitialized, |
| 2238 |
| 2239 // Indicates that a variable or field is in the process of being initialized. |
| 2240 BeingInitialized, |
| 2241 |
| 2242 // Indicates that a variable has been eliminated by the optimizing compiler. |
| 2243 OptimizedOut, |
| 2244 |
| 2245 // Reserved for future use. |
| 2246 Free, |
| 2247 } |
| 2248 ``` |
| 2249 |
| 2250 A _SentinelKind_ is used to distinguish different kinds of _Sentinel_ objects. |
| 2251 |
| 2252 Adding new values to _SentinelKind_ is considered a backwards |
| 2253 compatible change. Clients must handle this gracefully. |
| 2254 |
| 2255 |
| 2256 ### FrameKind |
| 2257 ``` |
| 2258 enum FrameKind { |
| 2259 Regular, |
| 2260 AsyncCausal, |
| 2261 AsyncSuspensionMarker, |
| 2262 } |
| 2263 ``` |
| 2264 |
| 2265 A _FrameKind_ is used to distinguish different kinds of _Frame_ objects. |
| 2266 |
| 2267 ### Script |
| 2268 |
| 2269 ``` |
| 2270 class @Script extends @Object { |
| 2271 // The uri from which this script was loaded. |
| 2272 string uri; |
| 2273 } |
| 2274 ``` |
| 2275 |
| 2276 _@Script_ is a reference to a _Script_. |
| 2277 |
| 2278 ``` |
| 2279 class Script extends Object { |
| 2280 // The uri from which this script was loaded. |
| 2281 string uri; |
| 2282 |
| 2283 // The library which owns this script. |
| 2284 @Library library; |
| 2285 |
| 2286 // The source code for this script. For certain built-in scripts, |
| 2287 // this may be reconstructed without source comments. |
| 2288 string source; |
| 2289 |
| 2290 // A table encoding a mapping from token position to line and column. |
| 2291 int[][] tokenPosTable; |
| 2292 } |
| 2293 ``` |
| 2294 |
| 2295 A _Script_ provides information about a Dart language script. |
| 2296 |
| 2297 The _tokenPosTable_ is an array of int arrays. Each subarray |
| 2298 consists of a line number followed by _(tokenPos, columnNumber)_ pairs: |
| 2299 |
| 2300 > [lineNumber, (tokenPos, columnNumber)*] |
| 2301 |
| 2302 The _tokenPos_ is an arbitrary integer value that is used to represent |
| 2303 a location in the source code. A _tokenPos_ value is not meaningful |
| 2304 in itself and code should not rely on the exact values returned. |
| 2305 |
| 2306 For example, a _tokenPosTable_ with the value... |
| 2307 |
| 2308 > [[1, 100, 5, 101, 8],[2, 102, 7]] |
| 2309 |
| 2310 ...encodes the mapping: |
| 2311 |
| 2312 tokenPos | line | column |
| 2313 -------- | ---- | ------ |
| 2314 100 | 1 | 5 |
| 2315 101 | 1 | 8 |
| 2316 102 | 2 | 7 |
| 2317 |
| 2318 ### SourceLocation |
| 2319 |
| 2320 ``` |
| 2321 class SourceLocation extends Response { |
| 2322 // The script containing the source location. |
| 2323 @Script script; |
| 2324 |
| 2325 // The first token of the location. |
| 2326 int tokenPos; |
| 2327 |
| 2328 // The last token of the location if this is a range. |
| 2329 int endTokenPos [optional]; |
| 2330 } |
| 2331 ``` |
| 2332 |
| 2333 The _SourceLocation_ class is used to designate a position or range in |
| 2334 some script. |
| 2335 |
| 2336 ### SourceReport |
| 2337 |
| 2338 ``` |
| 2339 class SourceReport extends Response { |
| 2340 // A list of ranges in the program source. These ranges correspond |
| 2341 // to ranges of executable code in the user's program (functions, |
| 2342 // methods, constructors, etc.) |
| 2343 // |
| 2344 // Note that ranges may nest in other ranges, in the case of nested |
| 2345 // functions. |
| 2346 // |
| 2347 // Note that ranges may be duplicated, in the case of mixins. |
| 2348 SourceReportRange[] ranges; |
| 2349 |
| 2350 // A list of scripts, referenced by index in the report's ranges. |
| 2351 ScriptRef[] scripts; |
| 2352 } |
| 2353 ``` |
| 2354 |
| 2355 The _SourceReport_ class represents a set of reports tied to source |
| 2356 locations in an isolate. |
| 2357 |
| 2358 ### SourceReportCoverage |
| 2359 |
| 2360 ``` |
| 2361 class SourceReportCoverage { |
| 2362 // A list of token positions in a SourceReportRange which have been |
| 2363 // executed. The list is sorted. |
| 2364 int[] hits; |
| 2365 |
| 2366 // A list of token positions in a SourceReportRange which have not been |
| 2367 // executed. The list is sorted. |
| 2368 int[] misses; |
| 2369 } |
| 2370 ``` |
| 2371 |
| 2372 The _SourceReportCoverage_ class represents coverage information for |
| 2373 one [SourceReportRange](#sourcereportrange). |
| 2374 |
| 2375 Note that _SourceReportCoverage_ does not extend [Response](#response) |
| 2376 and therefore will not contain a _type_ property. |
| 2377 |
| 2378 ### SourceReportKind |
| 2379 |
| 2380 ``` |
| 2381 enum SourceReportKind { |
| 2382 // Used to request a code coverage information. |
| 2383 Coverage, |
| 2384 |
| 2385 // Used to request a list of token positions of possible breakpoints. |
| 2386 PossibleBreakpoints |
| 2387 } |
| 2388 ``` |
| 2389 |
| 2390 ### SourceReportRange |
| 2391 |
| 2392 ``` |
| 2393 class SourceReportRange { |
| 2394 // An index into the script table of the SourceReport, indicating |
| 2395 // which script contains this range of code. |
| 2396 int scriptIndex; |
| 2397 |
| 2398 // The token position at which this range begins. |
| 2399 int startPos; |
| 2400 |
| 2401 // The token position at which this range ends. Inclusive. |
| 2402 int endPos; |
| 2403 |
| 2404 // Has this range been compiled by the Dart VM? |
| 2405 bool compiled; |
| 2406 |
| 2407 // The error while attempting to compile this range, if this |
| 2408 // report was generated with forceCompile=true. |
| 2409 @Error error [optional]; |
| 2410 |
| 2411 // Code coverage information for this range. Provided only when the |
| 2412 // Coverage report has been requested and the range has been |
| 2413 // compiled. |
| 2414 SourceReportCoverage coverage [optional]; |
| 2415 |
| 2416 // Possible breakpoint information for this range, represented as a |
| 2417 // sorted list of token positions. Provided only when the when the |
| 2418 // PossibleBreakpoint report has been requested and the range has been |
| 2419 // compiled. |
| 2420 int[] possibleBreakpoints [optional]; |
| 2421 } |
| 2422 ``` |
| 2423 |
| 2424 The _SourceReportRange_ class represents a range of executable code |
| 2425 (function, method, constructor, etc) in the running program. It is |
| 2426 part of a [SourceReport](#sourcereport). |
| 2427 |
| 2428 Note that _SourceReportRange_ does not extend [Response](#response) |
| 2429 and therefore will not contain a _type_ property. |
| 2430 |
| 2431 ### Stack |
| 2432 |
| 2433 ``` |
| 2434 class Stack extends Response { |
| 2435 Frame[] frames; |
| 2436 Frame[] asyncCausalFrames [optional]; |
| 2437 Message[] messages; |
| 2438 } |
| 2439 ``` |
| 2440 |
| 2441 ### ExceptionPauseMode |
| 2442 |
| 2443 ``` |
| 2444 enum ExceptionPauseMode { |
| 2445 None, |
| 2446 Unhandled, |
| 2447 All, |
| 2448 } |
| 2449 ``` |
| 2450 |
| 2451 An _ExceptionPauseMode_ indicates how the isolate pauses when an exception |
| 2452 is thrown. |
| 2453 |
| 2454 ### StepOption |
| 2455 |
| 2456 ``` |
| 2457 enum StepOption { |
| 2458 Into, |
| 2459 Over, |
| 2460 OverAsyncSuspension, |
| 2461 Out, |
| 2462 Rewind |
| 2463 } |
| 2464 ``` |
| 2465 |
| 2466 A _StepOption_ indicates which form of stepping is requested in a [resume](#resu
me) RPC. |
| 2467 |
| 2468 ### Success |
| 2469 |
| 2470 ``` |
| 2471 class Success extends Response { |
| 2472 } |
| 2473 ``` |
| 2474 |
| 2475 The _Success_ type is used to indicate that an operation completed successfully. |
| 2476 |
| 2477 ### TimelineEvent |
| 2478 |
| 2479 ``` |
| 2480 class TimelineEvent { |
| 2481 } |
| 2482 ``` |
| 2483 |
| 2484 An _TimelineEvent_ is an arbitrary map that contains a [Trace Event Format](http
s://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/prev
iew) event. |
| 2485 |
| 2486 ### TypeArguments |
| 2487 |
| 2488 ``` |
| 2489 class @TypeArguments extends @Object { |
| 2490 // A name for this type argument list. |
| 2491 string name; |
| 2492 } |
| 2493 ``` |
| 2494 |
| 2495 _@TypeArguments_ is a reference to a _TypeArguments_ object. |
| 2496 |
| 2497 ``` |
| 2498 class TypeArguments extends Object { |
| 2499 // A name for this type argument list. |
| 2500 string name; |
| 2501 |
| 2502 // A list of types. |
| 2503 // |
| 2504 // The value will always be one of the kinds: |
| 2505 // Type, TypeRef, TypeParameter, BoundedType. |
| 2506 @Instance[] types; |
| 2507 } |
| 2508 ``` |
| 2509 |
| 2510 A _TypeArguments_ object represents the type argument vector for some |
| 2511 instantiated generic type. |
| 2512 |
| 2513 ### UnresolvedSourceLocation |
| 2514 |
| 2515 ``` |
| 2516 class UnresolvedSourceLocation extends Response { |
| 2517 // The script containing the source location if the script has been loaded. |
| 2518 @Script script [optional]; |
| 2519 |
| 2520 // The uri of the script containing the source location if the script |
| 2521 // has yet to be loaded. |
| 2522 string scriptUri [optional]; |
| 2523 |
| 2524 // An approximate token position for the source location. This may |
| 2525 // change when the location is resolved. |
| 2526 int tokenPos [optional]; |
| 2527 |
| 2528 // An approximate line number for the source location. This may |
| 2529 // change when the location is resolved. |
| 2530 int line [optional]; |
| 2531 |
| 2532 // An approximate column number for the source location. This may |
| 2533 // change when the location is resolved. |
| 2534 int column [optional]; |
| 2535 |
| 2536 } |
| 2537 ``` |
| 2538 |
| 2539 The _UnresolvedSourceLocation_ class is used to refer to an unresolved |
| 2540 breakpoint location. As such, it is meant to approximate the final |
| 2541 location of the breakpoint but it is not exact. |
| 2542 |
| 2543 Either the _script_ or the _scriptUri_ field will be present. |
| 2544 |
| 2545 Either the _tokenPos_ or the _line_ field will be present. |
| 2546 |
| 2547 The _column_ field will only be present when the breakpoint was |
| 2548 specified with a specific column number. |
| 2549 |
| 2550 ### Version |
| 2551 |
| 2552 ``` |
| 2553 class Version extends Response { |
| 2554 // The major version number is incremented when the protocol is changed |
| 2555 // in a potentially incompatible way. |
| 2556 int major; |
| 2557 |
| 2558 // The minor version number is incremented when the protocol is changed |
| 2559 // in a backwards compatible way. |
| 2560 int minor; |
| 2561 } |
| 2562 ``` |
| 2563 |
| 2564 See [Versioning](#versioning). |
| 2565 |
| 2566 ### VM |
| 2567 |
| 2568 ``` |
| 2569 class @VM extends Response { |
| 2570 // A name identifying this vm. Not guaranteed to be unique. |
| 2571 string name; |
| 2572 } |
| 2573 ``` |
| 2574 |
| 2575 _@VM_ is a reference to a _VM_ object. |
| 2576 |
| 2577 ``` |
| 2578 class VM extends Response { |
| 2579 // Word length on target architecture (e.g. 32, 64). |
| 2580 int architectureBits; |
| 2581 |
| 2582 // The CPU we are generating code for. |
| 2583 string targetCPU; |
| 2584 |
| 2585 // The CPU we are actually running on. |
| 2586 string hostCPU; |
| 2587 |
| 2588 // The Dart VM version string. |
| 2589 string version; |
| 2590 |
| 2591 // The process id for the VM. |
| 2592 int pid; |
| 2593 |
| 2594 // The time that the VM started in milliseconds since the epoch. |
| 2595 // |
| 2596 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch. |
| 2597 int startTime; |
| 2598 |
| 2599 // A list of isolates running in the VM. |
| 2600 @Isolate[] isolates; |
| 2601 } |
| 2602 ``` |
| 2603 |
| 2604 ## Revision History |
| 2605 |
| 2606 version | comments |
| 2607 ------- | -------- |
| 2608 1.0 | initial revision |
| 2609 2.0 | Describe protocol version 2.0. |
| 2610 3.0 | Describe protocol version 3.0. Added UnresolvedSourceLocation. Added Sen
tinel return to getIsolate. Add AddedBreakpointWithScriptUri. Removed Isolate.
entry. The type of VM.pid was changed from string to int. Added VMUpdate events
. Add offset and count parameters to getObject() and offset and count fields to
Instance. Added ServiceExtensionAdded event. |
| 2611 3.1 | Add the getSourceReport RPC. The getObject RPC now accepts offset and cou
nt for string objects. String objects now contain length, offset, and count pro
perties. |
| 2612 3.2 | Isolate objects now include the runnable bit and many debugger related RPC
s will return an error if executed on an isolate before it is runnable. |
| 2613 3.3 | Pause event now indicates if the isolate is paused at an await, yield, or
yield* suspension point via the 'atAsyncSuspension' field. Resume command now su
pports the step parameter 'OverAsyncSuspension'. A Breakpoint added syntheticall
y by an 'OverAsyncSuspension' resume command identifies itself as such via the '
isSyntheticAsyncContinuation' field. |
| 2614 3.4 | Add the superType and mixin fields to Class. Added new pause event 'None'. |
| 2615 3.5 | Add the error field to SourceReportRange. Clarify definition of token pos
ition. Add "Isolate must be paused" error code. |
| 2616 3.6 (unreleased) | Add 'scopeStartTokenPos', 'scopeEndTokenPos', and 'declaratio
nTokenPos' to BoundVariable. Add 'PausePostRequest' event kind. Add 'Rewind' Ste
pOption. Add error code 107 (isolate cannot resume). Add 'reloadSources' RPC and
related error codes. |
| 2617 |
| 2618 [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observato
ry-discuss |
| OLD | NEW |