| OLD | NEW |
| (Empty) | |
| 1 # Dart VM Service Protocol 0.0 |
| 2 |
| 3 This document describes _version 0.0_ of the Dart VM Service Protocol. |
| 4 This protocol is used to communicate with a running Dart Virtual |
| 5 Machine. |
| 6 |
| 7 To use the Service Protocol, start the VM with the *--observe* flag. |
| 8 The VM will start a webserver which services protocol requests via WebSocket. |
| 9 It is possible to make HTTP (non-WebSocket) requests, |
| 10 but this does not allow access to VM _events_ and is not documented |
| 11 here. |
| 12 |
| 13 The Service Protocol is based on JSON-RPC 2.0 |
| 14 (http://www.jsonrpc.org/specification). The Service Protocol has been |
| 15 extended to support pushing _events_ to the client, which is |
| 16 apparently outside the scope of the JSON-RPC specification. |
| 17 |
| 18 **Table of Contents** |
| 19 |
| 20 - [RPCs, Requests, and Responses](#rpcs-requests-and-responses) |
| 21 - [Events](#events) |
| 22 - [Types](#types) |
| 23 - [IDs and Names](#ids-and-names) |
| 24 - [Versioning](#versioning) |
| 25 - [Private RPCs, Types, and Properties](#private-rpcs-types-and-properties) |
| 26 - [Public RPCs](#public-rpcs) |
| 27 - [addBreakpoint](#addbreakpoint) |
| 28 - [addBreakpointAtEntry](#addbreakpointatentry) |
| 29 - [evaluate](#evaluate) |
| 30 - [evaluateInFrame](#evaluateinframe) |
| 31 - [getCoverage](#getcoverage) |
| 32 - [getFlagList](#getflaglist) |
| 33 - [getIsolate](#getisolate) |
| 34 - [getObject](#getobject) |
| 35 - [getStack](#getstack) |
| 36 - [getVersion](#getversion) |
| 37 - [getVM](#getvm) |
| 38 - [pause](#pause) |
| 39 - [removeBreakpoint](#removebreakpoint) |
| 40 - [resume](#resume) |
| 41 - [setName](#setname) |
| 42 - [streamCancel](#streamcancel) |
| 43 - [streamListen](#streamlisten) |
| 44 - [Public Types](#public-types) |
| 45 - [Bool](#bool) |
| 46 - [BoundField](#boundfield) |
| 47 - [BoundVariable](#boundvariable) |
| 48 - [Breakpoint](#breakpoint) |
| 49 - [Class](#class) |
| 50 - [ClassList](#classlist) |
| 51 - [Code](#code) |
| 52 - [CodeCoverage](#codecoverage) |
| 53 - [CodeKind](#codekind) |
| 54 - [Double](#double) |
| 55 - [Error](#error) |
| 56 - [Event](#event) |
| 57 - [EventType](#eventtype) |
| 58 - [Field](#field) |
| 59 - [Flag](#flag) |
| 60 - [FlagList](#flaglist) |
| 61 - [FlagType](#flagtype) |
| 62 - [Frame](#frame) |
| 63 - [Function](#function) |
| 64 - [FunctionKind](#functionkind) |
| 65 - [Instance](#instance) |
| 66 - [Int](#int) |
| 67 - [Isolate](#isolate) |
| 68 - [Library](#library) |
| 69 - [List](#list) |
| 70 - [ListElement](#listelement) |
| 71 - [Message](#message) |
| 72 - [Null](#null) |
| 73 - [Object](#object) |
| 74 - [Sentinel](#sentinel) |
| 75 - [SentinelType](#sentineltype) |
| 76 - [Script](#script) |
| 77 - [ScriptKind](#scriptkind) |
| 78 - [Stack](#stack) |
| 79 - [StepOption](#stepoption) |
| 80 - [String](#string) |
| 81 - [Success](#success) |
| 82 - [Type](#type) |
| 83 - [TypeArguments](#typearguments) |
| 84 - [Response](#response) |
| 85 - [Version](#version) |
| 86 - [VM](#vm) |
| 87 - [Revision History](#revision-history) |
| 88 |
| 89 ## RPCs, Requests, and Responses |
| 90 |
| 91 An RPC request is a JSON object sent to the server. Here is an |
| 92 example [getVersion](#getversion) request: |
| 93 |
| 94 ``` |
| 95 { |
| 96 "jsonrpc": "2.0", |
| 97 "method": "getVersion", |
| 98 "params": {}, |
| 99 "id": "1" |
| 100 } |
| 101 ``` |
| 102 |
| 103 Currently the _id_ property must be a string. The Service Protocol |
| 104 optionally accepts requests without the _jsonprc_ property. |
| 105 |
| 106 An RPC response is a JSON object (http://json.org/). The response always specif
ies an |
| 107 _id_ property to pair it with the corresponding request. If the RPC |
| 108 was successful, the _result_ property provides the result. |
| 109 |
| 110 Here is an example response for our [getVersion](#getversion) request above: |
| 111 |
| 112 ``` |
| 113 { |
| 114 "json-rpc": "2.0", |
| 115 "result": { |
| 116 "type": "Version", |
| 117 "major": 0, |
| 118 "minor": 0 |
| 119 } |
| 120 "id": "1" |
| 121 } |
| 122 ``` |
| 123 |
| 124 Parameters for RPC requests are always provided as _named_ parameters. |
| 125 The JSON-RPC spec provides for _positional_ parameters as well, but they |
| 126 are not supported by the Dart VM. |
| 127 |
| 128 By convention, every response returned by the Service Protocol is a subtype |
| 129 of [Response](#response) and provides a _type_ paramters which can be used |
| 130 to distinguish the exact return type. In the example above, the |
| 131 [Version](#version) type is returned. |
| 132 |
| 133 Here is an example [streamListen](#streamlisten) request which provides |
| 134 a parameter: |
| 135 |
| 136 ``` |
| 137 { |
| 138 "jsonrpc": "2.0", |
| 139 "method": "streamListen", |
| 140 "params": { |
| 141 "streamId": "GC", |
| 142 }, |
| 143 "id": "2" |
| 144 } |
| 145 ``` |
| 146 |
| 147 <a name="rpc-error"></a> |
| 148 When an RPC encounters an error, it is provided in the _error_ |
| 149 property of the response object. JSON-RPC errors always provide |
| 150 _code_, _message_, and _data_ properties. |
| 151 |
| 152 Here is an example error response for our [streamListen](#streamlisten) |
| 153 request above. This error would be generated if we were attempting to |
| 154 subscribe to the _GC_ stream multiple times from the same client. |
| 155 |
| 156 ``` |
| 157 { |
| 158 "json-rpc": "2.0", |
| 159 "error": { |
| 160 "code": 101, |
| 161 "message": "Stream already subscribed", |
| 162 "data": { |
| 163 "details": "The stream 'GC' is already subscribed" |
| 164 } |
| 165 } |
| 166 "id": "2" |
| 167 } |
| 168 ``` |
| 169 |
| 170 In addition the the [error codes](http://www.jsonrpc.org/specification#error_obj
ect) |
| 171 specified in the JSON-RPC spec, we use the following application specific error
codes: |
| 172 |
| 173 code | message | meaning |
| 174 ---- | ------- | ------- |
| 175 100 | Invalid stream | An invalid _streamId_ parameter was provided |
| 176 101 | Stream already subscribed | The client is already subscribed to the specif
ied _streamId_ |
| 177 102 | Stream not subscribed | The client is not subscribed to the specified _str
eamId_ |
| 178 200 | VM must be paused | This operation is only valid when the VM is paused |
| 179 201 | Cannot set breakpoint | The VM is unable to set a breakpoint at the specif
ied line or function |
| 180 300 | Profiling is disabled | The operation is unable to complete because profil
ing is disabled |
| 181 |
| 182 ## Events |
| 183 |
| 184 By using the [streamListen](#streamlisten) and [streamCancel](#streamcancel) RPC
s, a client may |
| 185 request to be notified when an _event_ is posted to a specific |
| 186 _stream_ in the VM. Every stream has an associated _stream id_ which |
| 187 is used to name that stream. |
| 188 |
| 189 Each stream provides access to certain kinds of events. For example the _Isolat
e_ stream provides |
| 190 access to events pertaining to isolate births, deaths, and name changes. See [s
treamListen](#streamlisten) |
| 191 for a list of the well-known stream ids and their associated events. |
| 192 |
| 193 Events arrive asynchronously over the WebSocket and always have the |
| 194 _streamId_ and _event_ properties: |
| 195 |
| 196 ``` |
| 197 { |
| 198 "event": { |
| 199 "type": "Event", |
| 200 "eventType": "IsolateExit", |
| 201 "isolate": { |
| 202 "type": "@Isolate", |
| 203 "id": "isolates/33", |
| 204 "number": "51048743613", |
| 205 "name": "worker-isolate" |
| 206 } |
| 207 } |
| 208 "streamId": "Isolate" |
| 209 } |
| 210 ``` |
| 211 |
| 212 It is considered a _backwards compatible_ change to add a new type of event to a
n existing stream. |
| 213 Clients should be written to handle this gracefully. |
| 214 |
| 215 |
| 216 ## Types |
| 217 |
| 218 By convention, every result and event provided by the Service Protocol |
| 219 is a subtype of [Response](#response) and has the _type_ property. |
| 220 This allows the client to distinguish different kinds of responses. For example
, |
| 221 information about a Dart function is returned using the [Function](#function) ty
pe. |
| 222 |
| 223 If the type of a response begins with the _@_ character, then that |
| 224 response is a _reference_. If the type name of a response does not |
| 225 begin with the _@_ character, it is the an _object_. A reference is |
| 226 intended to be a subset of an object which provides enough information |
| 227 to generate a reasonable looking reference to the object. |
| 228 |
| 229 For example, an [@Isolate](#isolate) reference has the _type_, _id_, _name_ and |
| 230 _number_ properties: |
| 231 |
| 232 ``` |
| 233 "result": { |
| 234 "type": "@Isolate", |
| 235 "id": "isolates/33", |
| 236 "number": "51048743613" |
| 237 "name": "worker-isolate" |
| 238 } |
| 239 ``` |
| 240 |
| 241 But an [Isolate](#isolate) object has more information: |
| 242 |
| 243 ``` |
| 244 "result": { |
| 245 "type": "Isolate", |
| 246 "id": "isolates/33", |
| 247 "number": "51048743613" |
| 248 "name": "worker-isolate" |
| 249 "rootLib": { ... } |
| 250 "entry": ... |
| 251 "heaps": ... |
| 252 ... |
| 253 } |
| 254 ``` |
| 255 |
| 256 ## IDs and Names |
| 257 |
| 258 Many responses returned by the Service Protocol have an _id_ property. |
| 259 This is an identifier used to request an object from an isolate using |
| 260 the [getObject](#getobject) RPC. If two responses have the same _id_ then they |
| 261 refer to the same object. The converse is not true: the same object |
| 262 may sometimes be returned with two different values for _id_. |
| 263 |
| 264 The _id_ property should be treated as an opaque string by the client: |
| 265 it is not meant to be parsed. |
| 266 |
| 267 An id can be either _temporary_ or _permanent_: |
| 268 |
| 269 * A _temporary_ id can expire over time. The VM allocates certain ids |
| 270 in a ring which evicts old ids over time. |
| 271 |
| 272 * A _permanent_ id will never expire, but the object it refers to may |
| 273 be collected. The VM uses permanent ids for objects like scripts, |
| 274 libraries, and classes. |
| 275 |
| 276 TODO: Describe how to distinguish temporary/permanent |
| 277 |
| 278 Sometimes a temporary id may expire. In this case, some RPCs may return |
| 279 an _Expired_ [Sentinel](#sentinel) to indicate this. |
| 280 |
| 281 The object referred to by an id may be collected by the VM's garbage |
| 282 collector. In this case, some RPCs may return a _Collected_ [Sentinel](#sentine
l) |
| 283 to indicate this. |
| 284 |
| 285 Many objects also have a _name_ property. This is provided so that |
| 286 objects can be displayed in a way that a Dart language programmer |
| 287 would find familiar. Names are not unique. |
| 288 |
| 289 ## Versioning |
| 290 |
| 291 The [getVersion](#getversion) RPC can be used to find the version of the protoco
l |
| 292 returned by a VM. The _Version_ response has a major and a minor |
| 293 version number: |
| 294 |
| 295 ``` |
| 296 "result": { |
| 297 "type": "Version", |
| 298 "major": 0, |
| 299 "minor": 0 |
| 300 } |
| 301 ``` |
| 302 |
| 303 The major version number is incremented when the protocol is changed |
| 304 in a potentially _incompatible_ way. An example of an incompatible |
| 305 change is removing a non-optional property from a result. |
| 306 |
| 307 The minor version number is incremented when the protocol is changed |
| 308 in a _backwards compatible_ way. An example of a backwards compatible |
| 309 change is adding a property to a result. |
| 310 |
| 311 ## Private RPCs, Types, and Properties |
| 312 |
| 313 Any RPC, type, or property which begins with an underscore is said to |
| 314 be _private_. These RPCs, types, and fields can be changed at any |
| 315 time without changing major or minor version numbers. |
| 316 |
| 317 The intention is that the Service Protocol will evolve by adding |
| 318 private RPCs which may, over time, migrate to the public api as they |
| 319 become stable. Some private types and properties expose VM specific |
| 320 implementation state and will never be appropriate to add to |
| 321 the public api. |
| 322 |
| 323 ## Public RPCs |
| 324 |
| 325 The following is a list of all public RPCs supported by the Service Protocol. |
| 326 |
| 327 An RPC is described using the following format: |
| 328 |
| 329 ``` |
| 330 ReturnType methodName(parameterType1 parameterName1, |
| 331 parameterType2, parameterName2, |
| 332 ...) |
| 333 ``` |
| 334 |
| 335 If an RPC says it returns type _T_ it may actually return _T_ or any |
| 336 [subtype](#public-types) of _T_. For example, an |
| 337 RPC which is declared to return [@Instance](#instance) may actually |
| 338 return [@Int](#int). |
| 339 |
| 340 If an RPC can return one or more independent types, this is indicated |
| 341 with the vertical bar: |
| 342 |
| 343 ``` |
| 344 ReturnType1|ReturnType2 |
| 345 ``` |
| 346 |
| 347 Any RPC may return an _error_ response as [described above](#rpc-error). |
| 348 |
| 349 Some parameters are optional. This is indicated by the text |
| 350 _[optional]_ following the parameter name: |
| 351 |
| 352 ``` |
| 353 ReturnType methodName(parameterType parameterName [optional) |
| 354 ``` |
| 355 |
| 356 A description of the return types and parameter types is provided |
| 357 in the section on [public types](#public-types). |
| 358 |
| 359 ### addBreakpoint |
| 360 |
| 361 ``` |
| 362 Breakpoint addBreakpoint(string isolateId, |
| 363 string scriptId, |
| 364 int line) |
| 365 ``` |
| 366 |
| 367 The _addBreakpoint_ RPC is used to add a breakpoint at a specific line |
| 368 of some script. |
| 369 |
| 370 If no breakpoint is possible at that line, the _201_ (Cannot set |
| 371 breakpoint) error code is returned. |
| 372 |
| 373 Note that breakpoints are added and removed on a per-isolate basis. |
| 374 |
| 375 See [Breakpoint](#breakpoint). |
| 376 |
| 377 ### addBreakpointAtEntry |
| 378 |
| 379 ``` |
| 380 Breakpoint addBreakpointAtEntry(string isolateId, |
| 381 string functionId) |
| 382 ``` |
| 383 The _addBreakpointAtEntry_ RPC is used to add a breakpoint at the |
| 384 entrypoint of some function. |
| 385 |
| 386 If no breakpoint is possible at the function entry, the _201_ (Cannot set |
| 387 breakpoint) error code is returned. |
| 388 |
| 389 See [Breakpoint](#breakpoint). |
| 390 |
| 391 Note that breakpoints are added and removed on a per-isolate basis. |
| 392 |
| 393 ### evaluate |
| 394 |
| 395 ``` |
| 396 @Instance|@Error|Sentinel evaluate(string isolateId, |
| 397 string targetId, |
| 398 string expression) |
| 399 ``` |
| 400 |
| 401 The _evaluate_ RPC is used to evaluate an expression in the context of |
| 402 some target. |
| 403 |
| 404 _targetId_ may refer to a [Library](#library), [Class](#class), or |
| 405 [Instance](#instance). |
| 406 |
| 407 If _targetId_ is a temporary id which has expired, then then _Expired_ |
| 408 [Sentinel](#sentinel) is returned. |
| 409 |
| 410 If _targetId_ refers to an object which has been collected by the VM's |
| 411 garbage collector, then the _Collected_ [Sentinel](#sentinel) is |
| 412 returned. |
| 413 |
| 414 If an error occurs while evaluating the expression, an [@Error](#error) |
| 415 reference will be returned. |
| 416 |
| 417 If the expression is evaluated successfully, an [@Instance](#instance) |
| 418 reference will be returned. |
| 419 |
| 420 ### evaluateInFrame |
| 421 |
| 422 ``` |
| 423 @Instance|@Error evaluateInFrame(string isolateId, |
| 424 int frame, |
| 425 string expression) |
| 426 ``` |
| 427 |
| 428 The _evaluateInFrame_ RPC is used to evaluate an expression in the context of |
| 429 a particular stack frame. _frame_ is the index of the desired [Frame](#frame), |
| 430 with an index of _0_ indicating the top (most recent) frame. |
| 431 |
| 432 If an error occurs while evaluating the expression, an [@Error](#error) |
| 433 reference will be returned. |
| 434 |
| 435 If the expression is evaluated successfully, an [@Instance](#instance) |
| 436 reference will be returned. |
| 437 |
| 438 ### getCoverage |
| 439 |
| 440 ``` |
| 441 CodeCoverage getCoverage(string isolateId, |
| 442 string targetId) |
| 443 ``` |
| 444 |
| 445 The _getCoverage_ RPC is used to retrieve current code coverage |
| 446 information for some target. |
| 447 |
| 448 _targetId_ may refer to a [Script](#script), [Library](#library), |
| 449 [Class](#class), or [Function](#function). |
| 450 |
| 451 See [Coverage](#coverage). |
| 452 |
| 453 ### getFlagList |
| 454 |
| 455 ``` |
| 456 FlagList getFlagList() |
| 457 ``` |
| 458 |
| 459 The _getFlagList RPC returns a list of all command line flags in the |
| 460 VM along with their current values. |
| 461 |
| 462 See [FlagList](#flaglist). |
| 463 |
| 464 ### getIsolate |
| 465 |
| 466 ``` |
| 467 Isolate getIsolate(string isolateId) |
| 468 ``` |
| 469 |
| 470 The _getIsolate_ RPC is used to lookup an _Isolate_ object by its _id_. |
| 471 |
| 472 See [Isolate](#isolate). |
| 473 |
| 474 ### getObject |
| 475 |
| 476 ``` |
| 477 Object|Sentinel getObject(string isolateId, |
| 478 string objectId) |
| 479 ``` |
| 480 |
| 481 The _getObject_ RPC is used to lookup an _object_ from some isolate by |
| 482 its _id_. |
| 483 |
| 484 If _objectId_ is a temporary id which has expired, then then _Expired_ |
| 485 [Sentinel](#sentinel) is returned. |
| 486 |
| 487 If _objectId_ 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 the object handle has not expired and the object has not been |
| 492 collected, then an [Object](#object) will be returned. |
| 493 |
| 494 ### getStack |
| 495 |
| 496 ``` |
| 497 Stack getStack(string isolateId) |
| 498 ``` |
| 499 |
| 500 The _getStack_ RPC is used to retrieve the current execution stack and |
| 501 message queue for an isolate. The isolate does not need to be paused. |
| 502 |
| 503 See [Stack](#stack). |
| 504 |
| 505 ### getVersion |
| 506 |
| 507 ``` |
| 508 Version getVersion() |
| 509 ``` |
| 510 |
| 511 The _getVersion_ RPC is used to determine what version of the Service Protocol i
s served by a VM. |
| 512 |
| 513 See [Version](#version). |
| 514 |
| 515 ### getVM |
| 516 |
| 517 ``` |
| 518 VM getVM() |
| 519 ``` |
| 520 |
| 521 The _getVM_ RPC returns global information about a Dart virtual machine. |
| 522 |
| 523 See [VM](#vm). |
| 524 |
| 525 ### pause |
| 526 |
| 527 ``` |
| 528 Success pause(string isolateId) |
| 529 ``` |
| 530 |
| 531 The _pause_ RPC is used to interrupt a running isolate. The RPC enqueues the in
terrupt request and potentially returns before the isolate is paused. |
| 532 |
| 533 When the isolate is paused an event will be sent on the _Debug_ stream. |
| 534 |
| 535 See [Success](#success). |
| 536 |
| 537 ### removeBreakpoint |
| 538 |
| 539 ``` |
| 540 Success removeBreakpoint(string isolateId, |
| 541 string breakpointId) |
| 542 ``` |
| 543 |
| 544 The _removeBreakpoint_ RPC is used to remove a breakpoint by its _id_. |
| 545 |
| 546 Note that breakpoints are added and removed on a per-isolate basis. |
| 547 |
| 548 See [Success](#success). |
| 549 |
| 550 ### resume |
| 551 |
| 552 ``` |
| 553 Success resume(string isolateId, |
| 554 StepOption step [optional]) |
| 555 ``` |
| 556 |
| 557 The _resume_ RPC is used to resume execution of a paused isolate. |
| 558 |
| 559 If the _step_ parameter is not provided, the program will resume |
| 560 regular execution. |
| 561 |
| 562 If the _step_ parameter is provided, it indicates what form of |
| 563 single-stepping to use. |
| 564 |
| 565 step | meaning |
| 566 ---- | ------- |
| 567 into | Single step, entering function calls |
| 568 over | Single step, skipping over function calls |
| 569 out | Single step until the current function exits |
| 570 |
| 571 See [Success](#success), [StepOption](#StepOption). |
| 572 |
| 573 ### setName |
| 574 |
| 575 ``` |
| 576 Success setName(string isolateId, |
| 577 string name) |
| 578 ``` |
| 579 |
| 580 The _setName_ RPC is used to change the debugging name for an isolate. |
| 581 |
| 582 See [Success](#success). |
| 583 |
| 584 ### streamCancel |
| 585 |
| 586 ``` |
| 587 Success streamCancel(string streamId) |
| 588 ``` |
| 589 |
| 590 The _streamCancel_ RPC cancels a stream subscription in the VM. |
| 591 |
| 592 If the client is not subscribed to the stream, the _102_ (Stream not |
| 593 subscribed) error code is returned. |
| 594 |
| 595 See [Success](#success). |
| 596 |
| 597 ### streamListen |
| 598 |
| 599 ``` |
| 600 Success streamListen(string streamId) |
| 601 ``` |
| 602 |
| 603 The _streamListen_ RPC subscribes to a stream in the VM. Once |
| 604 subscribed, the client will begin receiving events from the stream. |
| 605 |
| 606 If the client is not subscribed to the stream, the _101_ (Stream already |
| 607 subscribed) error code is returned. |
| 608 |
| 609 The _streamId_ parameter may have the following published values: |
| 610 |
| 611 streamId | event types provided |
| 612 -------- | ----------- |
| 613 Isolate | IsolateStart, IsolateExit, IsolateUpdate |
| 614 Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException
, Resume, BreakpointAdded, BreakpointResolved, BreakpointRemoved, Inspect |
| 615 GC | GC |
| 616 |
| 617 It is considered a _backwards compatible_ change to add a new type of event to a
n existing stream. |
| 618 Clients should be written to handle this gracefully, perhaps by warning and igno
ring. |
| 619 |
| 620 See [Success](#success). |
| 621 |
| 622 ## Public Types |
| 623 |
| 624 The following is a list of all public types produced by the Service Protocol. |
| 625 |
| 626 We define a small set of primitive types, based on JSON equivalents. |
| 627 |
| 628 type | meaning |
| 629 ---- | ------- |
| 630 string | JSON string values |
| 631 bool | JSON _true_, _false_ |
| 632 int | JSON numbers without fractions or exponents |
| 633 float | any JSON number |
| 634 |
| 635 Note that the Service Protocol does not use JSON _null_. |
| 636 |
| 637 We describe the format of our JSON objects with the following class format: |
| 638 |
| 639 ``` |
| 640 class T { |
| 641 string name; |
| 642 int count; |
| 643 ... |
| 644 } |
| 645 ``` |
| 646 |
| 647 This describes a JSON object type _T_ with some set of expected properties. |
| 648 |
| 649 Types are organized into an inheritance hierarchy. If type _T_ |
| 650 extends type _S_... |
| 651 |
| 652 ``` |
| 653 class S { |
| 654 string a; |
| 655 } |
| 656 |
| 657 class T extends S { |
| 658 string b; |
| 659 } |
| 660 ``` |
| 661 |
| 662 ...then that means that all properties of _S_ are also present in type |
| 663 _T_. In the example above, type _T_ would have the expected |
| 664 properties _a_ and _b_. |
| 665 |
| 666 If a property has an _Array_ type, it is written with brackets: |
| 667 |
| 668 ``` |
| 669 PropertyType[] arrayProperty; |
| 670 ``` |
| 671 |
| 672 If a property is optional, it is suffixed with the text _[optional]_: |
| 673 |
| 674 ``` |
| 675 PropertyType optionalProperty [optional]; |
| 676 ``` |
| 677 |
| 678 If a property can have multiple independent types, we denote this with |
| 679 a vertical bar: |
| 680 |
| 681 ``` |
| 682 PropertyType1|PropertyType2 complexProperty; |
| 683 ``` |
| 684 |
| 685 When a string is only permitted to take one of a certain set of values, |
| 686 we indicate this by the use of the _enum_ format: |
| 687 |
| 688 ``` |
| 689 enum PermittedValues { |
| 690 Value1, |
| 691 Value2 |
| 692 } |
| 693 ``` |
| 694 |
| 695 This means that _PermittedValues_ is a _string_ with two potential values, |
| 696 _Value1_ and _Value2_. |
| 697 |
| 698 ### Bool |
| 699 |
| 700 ``` |
| 701 class @Bool extends @Instance { |
| 702 // The value of this bool as a string, either 'true' or 'false'. |
| 703 string valueAsString; |
| 704 } |
| 705 ``` |
| 706 |
| 707 _@Bool_ is a reference to a _Bool_. |
| 708 |
| 709 ``` |
| 710 class Bool extends Instance { |
| 711 // The value of this bool as a string, either 'true' or 'false'. |
| 712 string valueAsString; |
| 713 } |
| 714 ``` |
| 715 |
| 716 An _Bool_ represents an instance of the Dart language class _bool_. |
| 717 |
| 718 ### BoundField |
| 719 |
| 720 ``` |
| 721 class BoundField { |
| 722 @Field decl; |
| 723 @Instance|Sentinel value; |
| 724 } |
| 725 ``` |
| 726 |
| 727 A _BoundField_ represents a field bound to a particular value in an |
| 728 _Instance_. |
| 729 |
| 730 If the field is uninitialized, the _value_ will be the |
| 731 _NotInitialized_ [Sentinel](#sentinel). |
| 732 |
| 733 If the field is being initialized, the _value_ will be the |
| 734 _BeingInitialized_ [Sentinel](#sentinel). |
| 735 |
| 736 ### BoundVariable |
| 737 |
| 738 ``` |
| 739 class BoundVariable { |
| 740 string name; |
| 741 @Instance|Sentinel value; |
| 742 } |
| 743 ``` |
| 744 |
| 745 A _BoundVariable_ represents a local variable bound to a particular value |
| 746 in a _Frame_. |
| 747 |
| 748 If the variable is uninitialized, the _value_ will be the |
| 749 _NotInitialized_ [Sentinel](#sentinel). |
| 750 |
| 751 If the variable is being initialized, the _value_ will be the |
| 752 _BeingInitialized_ [Sentinel](#sentinel). |
| 753 |
| 754 If the variable has been optimized out by the compiler, the _value_ |
| 755 will be the _OptimizedOut_ [Sentinel](#sentinel). |
| 756 |
| 757 ### Breakpoint |
| 758 |
| 759 ``` |
| 760 class Breakpoint extends Response { |
| 761 int breakpointNumber; |
| 762 bool resolved; |
| 763 @Script script; |
| 764 int tokenPos; |
| 765 } |
| 766 ``` |
| 767 |
| 768 A _Breakpoint_ describes a debugger breakpoint. |
| 769 |
| 770 ### Class |
| 771 |
| 772 ``` |
| 773 class @Class extends @Object { |
| 774 // The name of this class. |
| 775 string name; |
| 776 } |
| 777 ``` |
| 778 |
| 779 _@Class_ is a reference to a _Class_. |
| 780 |
| 781 ``` |
| 782 class Class extends Object { |
| 783 // The name of this class. |
| 784 string name; |
| 785 |
| 786 // The error which occurred during class finalization, if it exists. |
| 787 @Instance error [optional]; |
| 788 |
| 789 // Is this an abstract class? |
| 790 bool abstract; |
| 791 |
| 792 // Is this a const class? |
| 793 bool const; |
| 794 |
| 795 // Has this class been finalized? |
| 796 bool finalized; |
| 797 |
| 798 // Is this class implemented? |
| 799 bool implemented; |
| 800 |
| 801 // Is this a vm patch class? |
| 802 bool patch; |
| 803 |
| 804 // The library which contains this class. |
| 805 @Library library; |
| 806 |
| 807 // The script which defines this class. May be missing for some |
| 808 // classes. |
| 809 @Script script; |
| 810 |
| 811 // The superclass of this class, if any. |
| 812 @Class super [optional]; |
| 813 |
| 814 // A list of interface types for this class. |
| 815 @Type[] interfaces; |
| 816 |
| 817 // A list of fields in this class. Does not include fields from |
| 818 // superclasses. |
| 819 @Field[] fields; |
| 820 |
| 821 // A list of functions in this class. Does not include functions |
| 822 // from superclasses. |
| 823 @Function[] functions; |
| 824 |
| 825 // A list of subclasses of this class. |
| 826 @Class[] subclasses; |
| 827 } |
| 828 ``` |
| 829 |
| 830 A _Class_ provides information about a Dart language class. |
| 831 |
| 832 ### ClassList |
| 833 |
| 834 ``` |
| 835 class ClassList extends Response { |
| 836 @Class[] classes; |
| 837 } |
| 838 ``` |
| 839 |
| 840 ### Code |
| 841 |
| 842 ``` |
| 843 class @Code extends @Object { |
| 844 // A name for this code object. |
| 845 string name; |
| 846 |
| 847 // What kind of code object is this? |
| 848 CodeKind kind; |
| 849 } |
| 850 ``` |
| 851 |
| 852 _@Code_ is a reference to a _Code_ object. |
| 853 |
| 854 ``` |
| 855 class @Code extends @Object { |
| 856 // A name for this code object. |
| 857 string name; |
| 858 |
| 859 // What kind of code object is this? |
| 860 CodeKind kind; |
| 861 } |
| 862 ``` |
| 863 |
| 864 A _Code_ object represents compiled code in the Dart VM. |
| 865 |
| 866 ### CodeCoverage |
| 867 |
| 868 TODO |
| 869 |
| 870 ### CodeKind |
| 871 |
| 872 ``` |
| 873 enum CodeKind { |
| 874 Dart, |
| 875 Native, |
| 876 Stub, |
| 877 Tag, |
| 878 Collected |
| 879 } |
| 880 ``` |
| 881 |
| 882 ### Double |
| 883 |
| 884 ``` |
| 885 class @Double extends @Instance { |
| 886 // The value of this double as a string. |
| 887 // |
| 888 // Suitable for passing to double.parse(). |
| 889 string valueAsString; |
| 890 } |
| 891 ``` |
| 892 |
| 893 _@Double_ is a reference to a _Double_. |
| 894 |
| 895 ``` |
| 896 class Double extends Instance { |
| 897 // The value of this double as a string. |
| 898 // |
| 899 // Suitable for passing to double.parse(). |
| 900 string valueAsString; |
| 901 } |
| 902 ``` |
| 903 |
| 904 A _Double_ represents an instance of the Dart language class _double_. |
| 905 |
| 906 ### Error |
| 907 |
| 908 ``` |
| 909 class @Error extends @Object { |
| 910 // A description of the error. |
| 911 string message; |
| 912 } |
| 913 ``` |
| 914 |
| 915 _@Error_ is a reference to an _Error_. |
| 916 |
| 917 ``` |
| 918 class Error extends Object { |
| 919 // A description of the error. |
| 920 string message; |
| 921 |
| 922 // If this error is due to an unhandled exception, this |
| 923 // is the exception thrown. |
| 924 @Instance exception [optional]; |
| 925 |
| 926 // If this error is due to an unhandled exception, this |
| 927 // is the stacktrace object. |
| 928 @Instance stacktrace [optional]; |
| 929 } |
| 930 ``` |
| 931 |
| 932 An _Error_ represents a Dart language level error. This is distinct from an |
| 933 [rpc error](#rpc-error). |
| 934 |
| 935 An error may occur when: |
| 936 |
| 937 - The program has encountered an unhandled exception |
| 938 - The program has encountered a syntax error (or another Dart language error) |
| 939 - The program has encountered an unhandled erroneous condition in native code |
| 940 - The program has been terminated |
| 941 |
| 942 ### Event |
| 943 |
| 944 ``` |
| 945 class Event extends Response { |
| 946 // What kind of event is this? |
| 947 EventType eventType; |
| 948 |
| 949 // The isolate with which this event is associated. |
| 950 @Isolate isolate; |
| 951 |
| 952 // The breakpoint associated with this event, if applicable. |
| 953 // |
| 954 // This is provided for the events: |
| 955 // PauseBreakpoint |
| 956 // BreakpointAdded |
| 957 // BreakpointRemoved |
| 958 // BreakpointResolved |
| 959 Breakpoint breakpoint [optional]; |
| 960 |
| 961 // The top stack frame associated with this event, if applicable. |
| 962 // |
| 963 // This is provided for the events: |
| 964 // PauseBreakpoint |
| 965 // PauseInterrupted |
| 966 // PauseException |
| 967 // |
| 968 // For the Resume event, the top frame is provided at |
| 969 // all times except for the initial resume event that is delivered |
| 970 // when an isolate begins execution. |
| 971 Frame topFrame [optional]; |
| 972 |
| 973 // The exception associated with this event, if this is a |
| 974 // PauseException event. |
| 975 @Instance exception [optional]; |
| 976 } |
| 977 ``` |
| 978 |
| 979 An _Event_ is an asynchronous notification from the VM. It is delivered |
| 980 only when the client has subscribed to an event stream using the |
| 981 [streamListen](#streamListen) RPC. |
| 982 |
| 983 For more information, see [events](#events). |
| 984 |
| 985 ### EventType |
| 986 |
| 987 ``` |
| 988 enum EventType { |
| 989 // Notification that a new isolate has started. |
| 990 IsolateStart, |
| 991 |
| 992 // Notification that an isolate has exited. |
| 993 IsolateExit, |
| 994 |
| 995 // Notification that isolate identifying information has changed. |
| 996 // Currently used to notify of changes to the isolate debugging name |
| 997 // via <code>setName</code>. |
| 998 IsolateUpdate, |
| 999 |
| 1000 // An isolate has paused at start, before executing code. |
| 1001 PauseStart, |
| 1002 |
| 1003 // An isolate has paused at exit, before terminating. |
| 1004 PauseExit, |
| 1005 |
| 1006 // An isolate has paused at a breakpoint or due to stepping. |
| 1007 PauseBreakpoint, |
| 1008 |
| 1009 // An isolate has paused due to interruption via <code>pause</code>. |
| 1010 PauseInterrupted, |
| 1011 |
| 1012 // An isolate has paused due to an exception. |
| 1013 PauseException, |
| 1014 |
| 1015 // An isolate has started or resumed execution. |
| 1016 Resume, |
| 1017 |
| 1018 // A breakpoint has been added for an isolate. |
| 1019 BreakpointAdded, |
| 1020 |
| 1021 // An unresolved breakpoint has been resolved for an isolate. |
| 1022 BreakpointResolved, |
| 1023 |
| 1024 // A breakpoint has been removed. |
| 1025 BreakpointRemoved, |
| 1026 |
| 1027 // A garbage collection event. |
| 1028 GC |
| 1029 } |
| 1030 ``` |
| 1031 |
| 1032 ### Field |
| 1033 |
| 1034 ``` |
| 1035 class @Field extends @Object { |
| 1036 // The name of this field. |
| 1037 string name; |
| 1038 |
| 1039 // The owner of this field, which can be either a Library or a |
| 1040 // Class. |
| 1041 @Object owner; |
| 1042 |
| 1043 // The declared type of this field. |
| 1044 @Type declaredType; |
| 1045 |
| 1046 // Is this field const? |
| 1047 bool const; |
| 1048 |
| 1049 // Is this field final? |
| 1050 bool final; |
| 1051 |
| 1052 // Is this field static? |
| 1053 bool static; |
| 1054 |
| 1055 // The value of this field, if the field is static. |
| 1056 @Instance value [optional]; |
| 1057 } |
| 1058 ``` |
| 1059 |
| 1060 An _@Field_ is a reference to a _Field_. |
| 1061 |
| 1062 ``` |
| 1063 class Field extends Object { |
| 1064 // The name of this field. |
| 1065 string name; |
| 1066 |
| 1067 // The owner of this field, which can be either a Library or a |
| 1068 // Class. |
| 1069 @Object owner; |
| 1070 |
| 1071 // The declared type of this field. |
| 1072 @Type declaredType; |
| 1073 |
| 1074 // Is this field const? |
| 1075 bool const; |
| 1076 |
| 1077 // Is this field final? |
| 1078 bool final; |
| 1079 |
| 1080 // Is this field static? |
| 1081 bool static; |
| 1082 |
| 1083 // The value of this field, if the field is static. |
| 1084 @Instance value [optional]; |
| 1085 |
| 1086 // The script containing this feild. |
| 1087 @Script script [optional]; |
| 1088 |
| 1089 // The token position of this field. |
| 1090 int tokenPos [optional]; |
| 1091 } |
| 1092 ``` |
| 1093 |
| 1094 A _Field_ provides information about a Dart language field or |
| 1095 variable. |
| 1096 |
| 1097 |
| 1098 ### Flag |
| 1099 |
| 1100 ``` |
| 1101 class Flag { |
| 1102 // The name of the flag. |
| 1103 string name; |
| 1104 |
| 1105 // A description of the flag. |
| 1106 string comment; |
| 1107 |
| 1108 // The type of the flag. |
| 1109 FlagType flagType; |
| 1110 |
| 1111 // The value of this flag as a string. |
| 1112 // |
| 1113 // If this property is absent, then the value of the flag was NULL. |
| 1114 string valueAsString [optional]; |
| 1115 } |
| 1116 ``` |
| 1117 |
| 1118 A _Flag_ represents a single VM command line flag. |
| 1119 |
| 1120 ### FlagList |
| 1121 |
| 1122 ``` |
| 1123 class FlagList extends Response { |
| 1124 // A list of all flags which are set to default values. |
| 1125 unmodifiedFlags []Flag |
| 1126 |
| 1127 // A list of all flags which have been modified by the user. |
| 1128 modifiedFlags []Flag |
| 1129 } |
| 1130 ``` |
| 1131 |
| 1132 A _FlagList_ represents the complete set of VM command line flags. |
| 1133 |
| 1134 ### FlagType |
| 1135 |
| 1136 ``` |
| 1137 enum FlagType { |
| 1138 bool, |
| 1139 int, |
| 1140 uint64_t, |
| 1141 string |
| 1142 } |
| 1143 ``` |
| 1144 |
| 1145 A _FlagType_ indicates the type of a VM command line flag. |
| 1146 |
| 1147 ### Frame |
| 1148 |
| 1149 ``` |
| 1150 class Frame { |
| 1151 int index; |
| 1152 @Function function; |
| 1153 @Code code; |
| 1154 @Script script; |
| 1155 int tokenPos; |
| 1156 BoundVariable[] vars; |
| 1157 } |
| 1158 ``` |
| 1159 |
| 1160 ### Function |
| 1161 |
| 1162 ``` |
| 1163 class @Function extends @Object { |
| 1164 // The name of this function. |
| 1165 string name; |
| 1166 |
| 1167 // The owner of this field, which can be a Library, Class, or a |
| 1168 // Function. |
| 1169 @Library|@Class|@Function owner; |
| 1170 |
| 1171 // What kind of function is this? |
| 1172 FunctionKind kind; |
| 1173 } |
| 1174 ``` |
| 1175 |
| 1176 An _@Function_ is a reference to a _Function_. |
| 1177 |
| 1178 |
| 1179 ``` |
| 1180 // A Dart language function. |
| 1181 class Function extends Object { |
| 1182 // The name of this function. |
| 1183 string name; |
| 1184 |
| 1185 // The owner of this field, which can be a Library, Class, or a |
| 1186 // Function. |
| 1187 @Library|@Class|@Function owner; |
| 1188 |
| 1189 // What kind of function is this? |
| 1190 FunctionKind kind; |
| 1191 |
| 1192 // Is this function static? |
| 1193 bool static |
| 1194 |
| 1195 // Is this function const? |
| 1196 bool const; |
| 1197 |
| 1198 // The script containing this function. |
| 1199 @Script script [optional]; |
| 1200 |
| 1201 // The first token position of this function. |
| 1202 int tokenPos [optional]; |
| 1203 |
| 1204 // The last token position of this function. |
| 1205 int endTokenPos [optional]; |
| 1206 |
| 1207 // The compiled code associated with this function. |
| 1208 @Code code [optional]; |
| 1209 } |
| 1210 ``` |
| 1211 |
| 1212 A _Function_ represents a Dart language function. |
| 1213 |
| 1214 ### FunctionKind |
| 1215 |
| 1216 ``` |
| 1217 enum FunctionKind { |
| 1218 RegularFunction, |
| 1219 ClosureFunction, |
| 1220 GetterFunction, |
| 1221 SetterFunction, |
| 1222 Constructor, |
| 1223 ImplicitGetter, |
| 1224 ImplicitSetter, |
| 1225 ImplicitStaticFinalGetter, |
| 1226 IrregexpFunction, |
| 1227 StaticInitializer, |
| 1228 MethodExtractor, |
| 1229 NoSuchMethodDispatcher, |
| 1230 InvokeFieldDispatcher, |
| 1231 Collected, |
| 1232 Native, |
| 1233 Stub, |
| 1234 Tag |
| 1235 } |
| 1236 ``` |
| 1237 |
| 1238 TODO: Do we need to expose all of this? |
| 1239 |
| 1240 ### Instance |
| 1241 |
| 1242 ``` |
| 1243 class @Instance extends @Object { |
| 1244 // Instance references include their class. |
| 1245 @Class class; |
| 1246 } |
| 1247 ``` |
| 1248 |
| 1249 _@Instance_ is a reference to an _Instance_. |
| 1250 |
| 1251 ``` |
| 1252 class Instance extends Object { |
| 1253 BoundField fields [optional]; |
| 1254 } |
| 1255 ``` |
| 1256 |
| 1257 An _Instance_ represents an instance of the Dart language class _Object_. |
| 1258 |
| 1259 ### Int |
| 1260 |
| 1261 ``` |
| 1262 class @Int extends @Instance { |
| 1263 // The value of this int as a string. |
| 1264 // |
| 1265 // Suitable for passing to int.parse(). |
| 1266 string valueAsString; |
| 1267 } |
| 1268 ``` |
| 1269 |
| 1270 _@Int_ is a reference to an _Int_. |
| 1271 |
| 1272 ``` |
| 1273 class Int extends Instance { |
| 1274 // The value of this int as a string. |
| 1275 // |
| 1276 // Suitable for passing to int.parse(). |
| 1277 string valueAsString; |
| 1278 } |
| 1279 ``` |
| 1280 |
| 1281 An _Int_ represents an instance of the Dart language class _int_. |
| 1282 |
| 1283 ### Isolate |
| 1284 |
| 1285 ``` |
| 1286 class @Isolate extends Response { |
| 1287 // The id which is passed to the getIsolate RPC to load this isolate. |
| 1288 string id; |
| 1289 |
| 1290 // A numeric id for this isolate, represented as a string. Unique. |
| 1291 string number; |
| 1292 |
| 1293 // A name identifying this isolate. Not guaranteed to be unique. |
| 1294 string name; |
| 1295 } |
| 1296 ``` |
| 1297 |
| 1298 _@Isolate_ is a reference to an _Isolate_ object. |
| 1299 |
| 1300 ``` |
| 1301 class Isolate extends Response { |
| 1302 // The id which is passed to the getIsolate RPC to reload this |
| 1303 // isolate. |
| 1304 string id; |
| 1305 |
| 1306 // A numeric id for this isolate, represented as a string. Unique. |
| 1307 string number; |
| 1308 |
| 1309 // A name identifying this isolate. Not guaranteed to be unique. |
| 1310 string name; |
| 1311 |
| 1312 // The time that the VM started in milliseconds since the epoch. |
| 1313 // |
| 1314 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch. |
| 1315 int startTime; |
| 1316 |
| 1317 // The entry function for this isolate. |
| 1318 @Function entry [optional]; |
| 1319 |
| 1320 // The number of live ports for this isolate. |
| 1321 int livePorts; |
| 1322 |
| 1323 // Will this isolate pause when exiting? |
| 1324 bool pauseOnExit; |
| 1325 |
| 1326 // The last pause event delivered to the isolate. If the isolate is |
| 1327 // running, this will be a resume event. |
| 1328 Event pauseEvent; |
| 1329 |
| 1330 // The error that is causing this isolate to exit, if applicable. |
| 1331 Error error [optional]; |
| 1332 |
| 1333 // The root library for this isolate. |
| 1334 @Library rootLib; |
| 1335 |
| 1336 // A list of all libraries for this isolate. |
| 1337 @Library[] libraries; |
| 1338 |
| 1339 // A list of all breakpoints for this isolate. |
| 1340 Breakpoint[] breakpoints; |
| 1341 } |
| 1342 ``` |
| 1343 |
| 1344 An _Isolate_ object provides information about one isolate in the VM. |
| 1345 |
| 1346 ### Library |
| 1347 |
| 1348 ``` |
| 1349 class @Library extends @Object { |
| 1350 // The name of this library. |
| 1351 string name; |
| 1352 |
| 1353 // The url of this library. |
| 1354 string url; |
| 1355 } |
| 1356 ``` |
| 1357 |
| 1358 _@Library_ is a reference to a _Library_. |
| 1359 |
| 1360 ``` |
| 1361 class Library extends Object { |
| 1362 // The name of this library. |
| 1363 string name; |
| 1364 |
| 1365 // The url of this library. |
| 1366 string url; |
| 1367 |
| 1368 // A list of the imports for this library. |
| 1369 @Library[] imports; |
| 1370 |
| 1371 // A list of the scripts which constitute this library. |
| 1372 @Script[] scripts; |
| 1373 |
| 1374 // A list of the top-level variables in this library. |
| 1375 @Field[] variables; |
| 1376 |
| 1377 // A list of the top-level functions in this library. |
| 1378 @Function[] functions; |
| 1379 |
| 1380 // A list of all classes in this library. |
| 1381 @Class[] classes; |
| 1382 } |
| 1383 ``` |
| 1384 |
| 1385 A _Library_ provides information about a Dart language library. |
| 1386 |
| 1387 ### List |
| 1388 |
| 1389 ``` |
| 1390 class @List extends @Instance { |
| 1391 // The length of this list. |
| 1392 int length; |
| 1393 } |
| 1394 ``` |
| 1395 |
| 1396 _@List_ is a reference to a _List_. |
| 1397 |
| 1398 ``` |
| 1399 class List extends Instance { |
| 1400 // The length of this list. |
| 1401 int length; |
| 1402 |
| 1403 // The elements of this list. |
| 1404 ListElement[] elements; |
| 1405 } |
| 1406 ``` |
| 1407 |
| 1408 A _List_ represents an built-in instance of the Dart class _List_. |
| 1409 User-defined lists will be represented as _Instance_. |
| 1410 |
| 1411 ### ListElement |
| 1412 |
| 1413 ``` |
| 1414 class ListElement { |
| 1415 int index; |
| 1416 @Instance|Sentinel value; |
| 1417 } |
| 1418 ``` |
| 1419 |
| 1420 ### Message |
| 1421 |
| 1422 ``` |
| 1423 class Message { |
| 1424 int index; |
| 1425 string name; |
| 1426 string messageObjectId; |
| 1427 int size; |
| 1428 int priority; |
| 1429 @Function handlerFunction [optional]; |
| 1430 @Script handleScript [optional]; |
| 1431 int handlerTokenPos [optional]; |
| 1432 } |
| 1433 ``` |
| 1434 |
| 1435 ### Null |
| 1436 |
| 1437 ``` |
| 1438 class @Null extends @Instance { |
| 1439 // Always 'null'. |
| 1440 string valueAsString; |
| 1441 } |
| 1442 ``` |
| 1443 |
| 1444 _@Null_ is a reference to an a _Null_. |
| 1445 |
| 1446 ``` |
| 1447 class Null extends Instance { |
| 1448 // Always 'null'. |
| 1449 string valueAsString; |
| 1450 } |
| 1451 ``` |
| 1452 |
| 1453 A _Null_ object represents the Dart language value null. |
| 1454 |
| 1455 ### Object |
| 1456 |
| 1457 ``` |
| 1458 class @Object extends Response { |
| 1459 // A unique identifier for an Object. Passed to the |
| 1460 // getObject RPC to load this Object. |
| 1461 string id |
| 1462 } |
| 1463 ``` |
| 1464 |
| 1465 _@Object_ is a reference to a _Object_. |
| 1466 |
| 1467 ``` |
| 1468 class Object extends Response { |
| 1469 // A unique identifier for an Object. Passed to the |
| 1470 // getObject RPC to reload this Object. |
| 1471 // |
| 1472 // Some objects may get a new id when they are reloaded. |
| 1473 string id; |
| 1474 |
| 1475 // Every object has a corresponding Class in the VM. |
| 1476 @Class class; |
| 1477 |
| 1478 // The size of this object in the heap. |
| 1479 // |
| 1480 // Note that the size can be zero for some objects. |
| 1481 int size; |
| 1482 } |
| 1483 ``` |
| 1484 |
| 1485 An _Object_ is a persistent object that is owned by some isolate. |
| 1486 |
| 1487 ### Sentinel |
| 1488 |
| 1489 ``` |
| 1490 class Sentinel extends Response { |
| 1491 // What kind of sentinel is this? |
| 1492 SentinelType sentinelType; |
| 1493 |
| 1494 // A reasonable string representation of this sentinel. |
| 1495 string valueAsString; |
| 1496 } |
| 1497 ``` |
| 1498 |
| 1499 A _Sentinel_ is used to indicate that the normal response is not available. |
| 1500 |
| 1501 We use a _Sentinel_ instead of an [error](#errors) for these cases because |
| 1502 they do not represent a problematic condition. They are normal. |
| 1503 |
| 1504 ### SentinelType |
| 1505 |
| 1506 ``` |
| 1507 enum SentinelType { |
| 1508 // Indicates that the object referred to has been collected by the GC. |
| 1509 Collected, |
| 1510 |
| 1511 // Indicates that an object id has expired. |
| 1512 Expired, |
| 1513 |
| 1514 // Indicates that a variable or field has not been initialized. |
| 1515 NotInitialized, |
| 1516 |
| 1517 // Indicates that a variable or field is in the process of being initialized. |
| 1518 BeingInitialized, |
| 1519 |
| 1520 // Indicates that a variable has been eliminated by the optimizing compiler. |
| 1521 OptimizedOut |
| 1522 } |
| 1523 ``` |
| 1524 |
| 1525 A _SentinelType_ is used to distinguish different kinds of _Sentinel_ objects. |
| 1526 |
| 1527 ### Script |
| 1528 |
| 1529 ``` |
| 1530 class @Script extends @Object { |
| 1531 // A name for this script. |
| 1532 string name; |
| 1533 |
| 1534 // What kind of script is this? |
| 1535 string kind; |
| 1536 } |
| 1537 ``` |
| 1538 |
| 1539 _@Script_ is a reference to a _Script_. |
| 1540 |
| 1541 ``` |
| 1542 class Script extends Object { |
| 1543 // A name for this script. |
| 1544 string name; |
| 1545 |
| 1546 // What kind of script is this? |
| 1547 ScriptKind kind; |
| 1548 |
| 1549 // The library which owns this script. |
| 1550 @Library library; |
| 1551 |
| 1552 // The source code for this script. For certain built-in scripts, |
| 1553 // this may be reconstructed without source comments. |
| 1554 string source; |
| 1555 |
| 1556 // A table encoding a mapping from token position to line and column. |
| 1557 int[][] tokenPosTable; |
| 1558 } |
| 1559 ``` |
| 1560 |
| 1561 A _Script_ provides information about a Dart language script. |
| 1562 |
| 1563 The _tokenPosTable_ is an array of int arrays. Each subarray |
| 1564 consists of a line number followed by _(tokenPos, columnNumber)_ pairs: |
| 1565 |
| 1566 > [lineNumber, (tokenPos, columnNumber)*] |
| 1567 |
| 1568 For example, a _tokenPosTable_ with the value... |
| 1569 |
| 1570 > [[1, 100, 5, 101, 8],[2, 102, 7]] |
| 1571 |
| 1572 ...encodes the mapping: |
| 1573 |
| 1574 tokenPos | line | column |
| 1575 -------- | ---- | ------ |
| 1576 100 | 1 | 5 |
| 1577 101 | 1 | 8 |
| 1578 102 | 2 | 7 |
| 1579 |
| 1580 ### ScriptKind |
| 1581 |
| 1582 ``` |
| 1583 enum ScriptKind { |
| 1584 script, |
| 1585 library, |
| 1586 source, |
| 1587 patch |
| 1588 } |
| 1589 ``` |
| 1590 |
| 1591 A _ScriptKind_ is used to classify a _Script_. |
| 1592 |
| 1593 TODO: We need to explain what this is about or find a way to hide it. |
| 1594 |
| 1595 ### Stack |
| 1596 |
| 1597 ``` |
| 1598 class Stack { |
| 1599 Frame[] frames; |
| 1600 Message[] messages; |
| 1601 } |
| 1602 ``` |
| 1603 |
| 1604 ### StepOption |
| 1605 |
| 1606 ``` |
| 1607 enum StepOption { |
| 1608 into, |
| 1609 over, |
| 1610 out |
| 1611 } |
| 1612 ``` |
| 1613 |
| 1614 A _StepOption_ indicates which form of stepping is requested in a [resume](#resu
me) RPC. |
| 1615 |
| 1616 ### String |
| 1617 |
| 1618 ``` |
| 1619 class @String extends @Instance { |
| 1620 // The value of this double as a string. |
| 1621 // |
| 1622 // Note that this may be truncated. |
| 1623 // |
| 1624 // Suitable for passing to double.parse(). |
| 1625 string valueAsString; |
| 1626 |
| 1627 // The valueAsString for String references may be truncated. If so, |
| 1628 // this property is added with the value 'true'. |
| 1629 bool valueAsStringIsTruncated [optional]; |
| 1630 } |
| 1631 ``` |
| 1632 |
| 1633 _@String_ is a reference to a _String_. |
| 1634 |
| 1635 ``` |
| 1636 class String extends Instance { |
| 1637 // The value of this double as a string. |
| 1638 // |
| 1639 // Note that this will never be truncated. |
| 1640 // |
| 1641 // Suitable for passing to double.parse(). |
| 1642 string valueAsString; |
| 1643 } |
| 1644 ``` |
| 1645 |
| 1646 An _String_ represents an instance of the Dart language class _String_. |
| 1647 |
| 1648 The _valueAsString_ property for an _@String_ may be truncated. To get |
| 1649 the untruncated _valueAsString_, call the [getObject](#getobject) RPC |
| 1650 on the String's _id_. A _String_ object never truncates the |
| 1651 _valueAsString_. |
| 1652 |
| 1653 ### Success |
| 1654 |
| 1655 ``` |
| 1656 class Success extends Response { |
| 1657 } |
| 1658 ``` |
| 1659 |
| 1660 The _Success_ type is used to indicate that an operation completed successfully. |
| 1661 |
| 1662 ### Type |
| 1663 |
| 1664 ``` |
| 1665 class @Type extends @Instance { |
| 1666 // The name of this type. |
| 1667 string name; |
| 1668 |
| 1669 // The corresponding Class if this Type is canonical. |
| 1670 @Class typeClass [optional]; |
| 1671 } |
| 1672 ``` |
| 1673 |
| 1674 _@Type_ is a reference to a _Type_. |
| 1675 |
| 1676 ``` |
| 1677 class Type extends Instance { |
| 1678 // The name of this type. |
| 1679 string name; |
| 1680 |
| 1681 // The corresponding Class if this Type is canonical. |
| 1682 @Class typeClass [optional]; |
| 1683 |
| 1684 // The type arguments for this type. |
| 1685 @TypeArguments typeArgs [optional]; |
| 1686 } |
| 1687 ``` |
| 1688 |
| 1689 An _Type_ represents an instance of the Dart language class _Type_. |
| 1690 |
| 1691 ### TypeArguments |
| 1692 |
| 1693 ``` |
| 1694 class @TypeArguments extends @Object { |
| 1695 // A name for this type argument list. |
| 1696 string name; |
| 1697 } |
| 1698 ``` |
| 1699 |
| 1700 _@TypeArguments_ is a reference to a _TypeArguments_ object. |
| 1701 |
| 1702 ``` |
| 1703 class TypeArguments extends Object { |
| 1704 // A name for this type argument list. |
| 1705 string name; |
| 1706 |
| 1707 // A list of types. |
| 1708 @Type[] types; |
| 1709 } |
| 1710 ``` |
| 1711 |
| 1712 A _TypeArguments_ object represents the type argument vector for some |
| 1713 instantiated generic type. |
| 1714 |
| 1715 ### Response |
| 1716 |
| 1717 ``` |
| 1718 class Response { |
| 1719 // Every response returned by the VM Service has the |
| 1720 // type property. This allows the client distinguish |
| 1721 // between different kinds of responses. |
| 1722 string type; |
| 1723 } |
| 1724 ``` |
| 1725 |
| 1726 Every non-error response returned by the Service Protocol extends _Response_. |
| 1727 By using the _type_ property, the client can determine which [type](#types) |
| 1728 of response has been provided. |
| 1729 |
| 1730 ### Version |
| 1731 |
| 1732 ``` |
| 1733 class Version extends Response { |
| 1734 // The major version number is incremented when the protocol is changed |
| 1735 // in a potentially incompatible way. |
| 1736 int major; |
| 1737 |
| 1738 // The minor version number is incremented when the protocol is changed |
| 1739 // in a backwards compatible way. |
| 1740 int minor; |
| 1741 } |
| 1742 ``` |
| 1743 |
| 1744 See [Versioning](#versioning). |
| 1745 |
| 1746 ### VM |
| 1747 |
| 1748 ``` |
| 1749 class VM extends Response { |
| 1750 // Word length on target architecture (e.g. 32, 64). |
| 1751 int architectureBits; |
| 1752 |
| 1753 // The CPU we are generating code for. |
| 1754 string targetCPU; |
| 1755 |
| 1756 // The CPU we are actually running on. |
| 1757 string hostCPU; |
| 1758 |
| 1759 // The Dart VM version string. |
| 1760 string version; |
| 1761 |
| 1762 // The process id for the VM. |
| 1763 string pid; |
| 1764 |
| 1765 // The time that the VM started in milliseconds since the epoch. |
| 1766 // |
| 1767 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch. |
| 1768 int startTime |
| 1769 |
| 1770 // A list of isolates running in the VM. |
| 1771 @Isolate[] isolates |
| 1772 } |
| 1773 ``` |
| 1774 |
| 1775 ## Revision History |
| 1776 |
| 1777 version | comments |
| 1778 ------- | -------- |
| 1779 0.0 | draft |
| OLD | NEW |