| OLD | NEW |
| (Empty) |
| 1 # Dart VM Service Protocol | |
| 2 | |
| 3 NOTE: The service api is still changing rapidly. If you use the | |
| 4 service api, expect to encounter non-compatible changes. | |
| 5 | |
| 6 Description | |
| 7 How to start | |
| 8 JSON | |
| 9 Websocket | |
| 10 | |
| 11 ## Types | |
| 12 | |
| 13 Every response returned by the VM Service has the <code>type</code> | |
| 14 property. This allows the client distinguish between different kinds | |
| 15 of responses. For example, global information about the VM is encoded | |
| 16 in an response of type [VM](#VM) and information about an isolate is | |
| 17 encoded in an response of type [Isolate](#Isolate). | |
| 18 | |
| 19 If the type name of a response begins with an <code>@</code> character | |
| 20 then that response is a _reference_. If the type name of a response | |
| 21 does not begin with an <code>@</code> character then that response is | |
| 22 an _object_ (or sometimes _full object_). A reference is meant to be | |
| 23 a subset of a full object with just enough information for the client | |
| 24 to generate a reasonable-looking link. | |
| 25 | |
| 26 For example, an isolate reference may look like this... | |
| 27 | |
| 28 { | |
| 29 type: "@Isolate", | |
| 30 id: "isolates/123", | |
| 31 name: "worker" | |
| 32 } | |
| 33 | |
| 34 ... and a full isolate object would have additional properties: | |
| 35 | |
| 36 { | |
| 37 type: "Isolate", | |
| 38 id: "isolates/123", | |
| 39 name: "worker" | |
| 40 entry: ... | |
| 41 heaps: ... | |
| 42 topFrame: ... | |
| 43 ... | |
| 44 } | |
| 45 | |
| 46 ## Type Hierarchy | |
| 47 | |
| 48 The types returned by the VM Service fit into a type hierarchy, with a | |
| 49 subtyping relationship as indicated by the following indented list: | |
| 50 | |
| 51 <pre> | |
| 52 Object | |
| 53 ClassHeapStats | |
| 54 Class | |
| 55 Code | |
| 56 Context | |
| 57 Counter | |
| 58 Error | |
| 59 Field | |
| 60 FrameVar | |
| 61 Frame | |
| 62 Function | |
| 63 Gauge | |
| 64 Instance | |
| 65 AbstractType | |
| 66 BoundedType | |
| 67 TypeParameter | |
| 68 TypeRef | |
| 69 Type | |
| 70 List | |
| 71 Sentinel // TODO - subtype of Instance or not? | |
| 72 String | |
| 73 bool | |
| 74 double | |
| 75 int | |
| 76 null | |
| 77 Isolate | |
| 78 Library | |
| 79 Location | |
| 80 Script | |
| 81 ServiceError | |
| 82 ServiceEvent | |
| 83 Socket | |
| 84 TypeArguments // TODO - expose? | |
| 85 VM | |
| 86 </pre> | |
| 87 | |
| 88 TODO: How to put links in a pre in markdown? | |
| 89 | |
| 90 A subtype is guaranteed to provide all of the properties of its | |
| 91 parent type. For example, an [int](#int) can be used as an | |
| 92 [Instance](#Instance). | |
| 93 | |
| 94 The subtyping relationship also holds for reference types. For | |
| 95 example, [@int](#int) can be used as an [@Instance](#Instance). | |
| 96 | |
| 97 ## IDs | |
| 98 | |
| 99 Most responses returned by the VM Service have an <code>id</code> | |
| 100 property. An id is used to request an object from the VM. Each id is | |
| 101 unique; that is to say, If two responses have the same id, they refer | |
| 102 to the same object. The converse is not true: the same object may | |
| 103 occasionally be returned with two different ids. | |
| 104 | |
| 105 An id is either _global_ or _relative_. Global ids can be requested | |
| 106 from the VM directly by requesting the uri <code>/{global id}</code>. | |
| 107 | |
| 108 The following is a list of known, fixed global ids: | |
| 109 | |
| 110 | id | uri | type | |
| 111 | --- | --- | --- | |
| 112 | vm | /vm | [VM](#VM) | |
| 113 | flags | /flags | [FlagList](#FlagList) | |
| 114 | |
| 115 In addition, all isolates have global ids, but these ids are | |
| 116 dynamically generated. An isolate with an id like | |
| 117 <code>isolates/123</code> would be available at the uri | |
| 118 <code>/isolates/123</code>. | |
| 119 | |
| 120 Relative ids are used to refer to objects that are owned by an | |
| 121 isolate. Relative ids can be requested from the VM directly by | |
| 122 requesting the uri <code>/{isolate id}/{relative id}</code>. | |
| 123 | |
| 124 For example, we can get information about a class with id | |
| 125 <code>classes/Foo</code> from isolate <code>isolates/123</code> by | |
| 126 requesting the uri <code>/isolates/123/classes/Foo</code> from the VM. | |
| 127 | |
| 128 The client must not parse ids -- they must be treated as opaque | |
| 129 strings. We reserve the right to change the ids of objects. | |
| 130 | |
| 131 ## Names | |
| 132 | |
| 133 Many responses have the <code>name</code> property. Names are | |
| 134 provided so that objects can be displayed in a way that a Dart | |
| 135 language programmer would find sensible. | |
| 136 | |
| 137 Note that names are not in any way unique. Many objects will have the | |
| 138 same name. | |
| 139 | |
| 140 ## Private Properties | |
| 141 | |
| 142 Some properties returned by the VM Service begin with an underscore | |
| 143 (<code>_</code>) character. These properties are called _private | |
| 144 properties_. Private properties provide private information about the | |
| 145 VM's implementation. Private properties may be added, removed, or | |
| 146 changed at any time with any release of the VM. They are provided for | |
| 147 those tools that need this level of internal access, such as the | |
| 148 Observatory. | |
| 149 | |
| 150 For example, some responses will have the <code>_vmType</code> | |
| 151 property. This provides the VM-internal type name of an object, and | |
| 152 is provided only when this type name differs from the | |
| 153 <code>type</code> property. | |
| 154 | |
| 155 ## Events | |
| 156 | |
| 157 TODO | |
| 158 | |
| 159 ## Catalog of Types | |
| 160 | |
| 161 ### <a name="AbstractType"></a>AbstractType | |
| 162 | |
| 163 ### <a name="Breakpoint"></a>Breakpoint | |
| 164 | |
| 165 TODO: Get rid of Location or else use it more generally. | |
| 166 | |
| 167 Object properties: | |
| 168 | |
| 169 | keys | values | comments | |
| 170 | --- | --- | --- | |
| 171 | type | "Breakpoint" | | |
| 172 | id | String | | |
| 173 | breakpointNumber | int | | |
| 174 | enabled | bool | | |
| 175 | resolved | bool | | |
| 176 | location | [Location](#Location) | | |
| 177 | |
| 178 ### <a name="Class"></a>Class | |
| 179 | |
| 180 Reference properties: | |
| 181 | |
| 182 | keys | values | comments | |
| 183 | --- | --- | --- | |
| 184 | type | "@Class", "Class" | | |
| 185 | id | String | | |
| 186 | name | String | | |
| 187 | _vmName? | String | | |
| 188 | |
| 189 Object properties: | |
| 190 | |
| 191 | keys | values | comments | |
| 192 | --- | --- | --- | |
| 193 | error? | [Error](#Error) | Error encountered during class finalization | |
| 194 | implemented | bool | | |
| 195 | abstract | bool | | |
| 196 | patch | bool | | |
| 197 | finalized | bool | | |
| 198 | const | bool | | |
| 199 | super? | [@Class](#Class) | Super class | |
| 200 | library | [@Library](#Library) | Owning library | |
| 201 | script? | [@Script](#Script) | Script containing class source | |
| 202 | tokenPos? | int | starting token position of class source in script | |
| 203 | endTokenPos? | int | end token position of class source in script | |
| 204 | interfaces | List of [@Class](#Class) | interfaces this class has implemented | |
| 205 | fields | List of [@Field](#Field) | | |
| 206 | functions | List of [@Function](#Function) | | |
| 207 | subclasses | List of [@Class](#Class) | classes which extend this class. | |
| 208 | canonicalTypes | [@TypeList] | kill? | |
| 209 | allocationStats | ClassHeapStats | | |
| 210 | |
| 211 ### <a name="ClassHeapStats"></a>ClassHeapStats | |
| 212 | |
| 213 Object properties: | |
| 214 | |
| 215 | keys | values | comments | |
| 216 | --- | --- | --- | |
| 217 | type | "ClassHeapStats" | | |
| 218 | id | String | | |
| 219 | class | [@Class](#Class) | | |
| 220 | new | List of int | Allocation statistics for new space. See note below on all
ocation statistics list format. | |
| 221 | old | List of int | Allocation statistics for old space. See note below on all
ocation statistics list format. | |
| 222 | promotedInstances | int | number of instances promoted at last new-space GC. | |
| 223 | promotedBytes | int | number of bytes promoted at last new-space GC. | |
| 224 | |
| 225 *Allocation statistics list format* | |
| 226 | |
| 227 | index | value | description | |
| 228 | --- | --- | --- | | |
| 229 | 0 | int | Instances allocated before last GC | | |
| 230 | 1 | int | Bytes allocated before last GC | | |
| 231 | 2 | int | Instances alive after last GC | | |
| 232 | 3 | int | Bytes alive after last GC | | |
| 233 | 4 | int | Instances allocated since last GC | | |
| 234 | 5 | int | Bytes allocated since last GC | | |
| 235 | 6 | int | Instances allocated since last accumulator reset | | |
| 236 | 7 | int | Bytes allocated since last accumulator reset | | |
| 237 | |
| 238 ### <a name="Code"></a>Code | |
| 239 | |
| 240 Reference properties: | |
| 241 | |
| 242 | keys | values | comments | |
| 243 | --- | --- | --- | |
| 244 | type | "@Code", "Code"| | |
| 245 | id | String | | |
| 246 | name | String | | |
| 247 | _vmName? | String | | |
| 248 | start | String | starting address of code | |
| 249 | end | String | ending address of code | |
| 250 | isOptimized | bool | | |
| 251 | isAlive | bool | | |
| 252 | kind | String | |
| 253 | function | [@Function](#Function) | | |
| 254 | |
| 255 Object properties: | |
| 256 | |
| 257 | keys | values | comments | |
| 258 | --- | --- | --- | |
| 259 | start | String | starting address of code | |
| 260 | end | String | ending address of code | |
| 261 | isOptimized | bool | | |
| 262 | isAlive | bool | | |
| 263 | kind | String | |
| 264 | function | [@Function](#Function) | | |
| 265 | object_pool | List of [@Object](#Object) | | |
| 266 | disassembly | List of String | See note below on disassembly list format | |
| 267 | |
| 268 *Disassembly list format* | |
| 269 | |
| 270 | index | value | description | |
| 271 | --- | --- | --- | | |
| 272 | 0 | String | Address of instruction | |
| 273 | 1 | String | Hex encoding of instruction | |
| 274 | 2 | String | Human encoding of instruction | |
| 275 | 0 + (3 * K) | String | Address of Kth instruction | |
| 276 | 1 + (3 * K) | String | Hex encoding of instruction of Kth instruction | |
| 277 | 2 + (3 * K) | String | Human encoding of instruction of Kth instruction | |
| 278 | |
| 279 ### <a name="Error"></a>Error | |
| 280 | |
| 281 TODO: Drop id from Error.<br> | |
| 282 | |
| 283 Object properties: | |
| 284 | |
| 285 | keys | values | comments | |
| 286 | --- | --- | --- | |
| 287 | type | "Error" | | |
| 288 | _vmType? | String | VM internal name for this type. Provided only when differ
ent from 'type' | |
| 289 | id | String | always empty | |
| 290 | kind | String | | |
| 291 | message | String | | |
| 292 | |
| 293 ### <a name="Field"></a>Field | |
| 294 | |
| 295 Reference properties: | |
| 296 | |
| 297 | keys | values | comments | |
| 298 | --- | --- | --- | |
| 299 | type | "@Field", "Field" | | |
| 300 | id | String | | |
| 301 | name | String | | |
| 302 | _vmName? | String | | |
| 303 | value? | Instance | value associated with static field <-- do we want to inclu
de this in a field reference? | |
| 304 | owner | [@Library](#Library),[@Class](#Class) | Owning library or class <-- ha
ndling of owner is inconsistent with Function | |
| 305 | declared_type | [@AbstractType](#AbstractType) | | |
| 306 | static | bool | | |
| 307 | final | bool | | |
| 308 | const | bool | | |
| 309 | |
| 310 Object properties: | |
| 311 | |
| 312 | keys | values | comments | |
| 313 | --- | --- | --- | |
| 314 | guard_nullable | bool | can this field hold a null? | |
| 315 | guard_class | String OR [@Class](#Class) | "unknown", "dynamic", or a class | |
| 316 | guard_length | String OR int | "unknown", "variable", or length of array | |
| 317 | script? | [@Script](#Script) | Script containing field source | |
| 318 | tokenPos? | int | starting token position of field source in script | |
| 319 | |
| 320 ### <a name="Frame"></a>Frame | |
| 321 | |
| 322 TODO: Add type and id?<br> | |
| 323 | |
| 324 Object properties: | |
| 325 | |
| 326 | keys | values | comments | |
| 327 | --- | --- | --- | |
| 328 | script | [@Script](#Script) | | |
| 329 | tokenPos | int | | |
| 330 | function | [@Function](#Function) | | |
| 331 | code | [@Code](#Code) | | |
| 332 | vars | List of [FrameVar](#FrameVar) | | |
| 333 | |
| 334 ### <a name="FrameVar"></a>FrameVar | |
| 335 | |
| 336 Object properties: | |
| 337 | |
| 338 | keys | values | comments | |
| 339 | --- | --- | --- | |
| 340 | name | String | | |
| 341 | value | [@Instance](#Instance) | | |
| 342 | |
| 343 ### <a name="Function"></a>Function | |
| 344 | |
| 345 Reference properties: | |
| 346 | |
| 347 | keys | values | comments | |
| 348 | --- | --- | --- | |
| 349 | type | "@Function", "Function" | | |
| 350 | id | String | | |
| 351 | name | String | | |
| 352 | _vmName? | String | | |
| 353 | owningLibrary? | [@Library](#Library) | Set for non-top level functions | |
| 354 | owningClass? | [@Class](#Class) | Set for non-top level functions | |
| 355 | parent? | [@Function](#Function) | Parent function | |
| 356 | kind | String | | |
| 357 | |
| 358 Object properties: | |
| 359 | |
| 360 | keys | values | comments | |
| 361 | --- | --- | --- | |
| 362 | static | bool | TODO: not consistent with Field | |
| 363 | const | bool | | |
| 364 | optimizable | bool | | |
| 365 | inlinable | bool | | |
| 366 | usage_counter | int | | |
| 367 | optimized_call_site_count | int | | |
| 368 | deoptimizations | int | | |
| 369 | script? | [@Script](#Script) | Script containing function source | |
| 370 | tokenPos? | int | starting token position of function source in script | |
| 371 | endTokenPos? | int | end token position of function source in script | |
| 372 | unoptimized_code | [@Code](#Code) | | |
| 373 | code | [@Code](#Code) | Current code | |
| 374 | |
| 375 ### <a name="Isolate"></a>Isolate | |
| 376 | |
| 377 Reference properties: | |
| 378 | |
| 379 | keys | values | comments | |
| 380 | --- | --- | --- | |
| 381 | type | "@Isolate", "Isolate" | | |
| 382 | id | String | | |
| 383 | mainPort | String | kill? | | |
| 384 | name | String | | |
| 385 | |
| 386 Object properties: | |
| 387 | |
| 388 | keys | values | comments | |
| 389 | --- | --- | --- | |
| 390 | entry? | [@Function](#Function) | | |
| 391 | heaps | ??? | | |
| 392 | topFrame? | [Frame](#Frame) | | |
| 393 | livePorts | int | | |
| 394 | pauseOnExit | bool | | |
| 395 | pauseEvent? | [DebuggerEvent](#DebuggerEvent) | | |
| 396 | rootLib | [@Library](#Library) | | |
| 397 | timers | ??? | | |
| 398 | tagCounters | ??? | | |
| 399 | error? | [Error](#Error) | | |
| 400 | canonicalTypeArguments | | kill? | | |
| 401 | libs | List of [@Library](#Library) | | |
| 402 | features | List of String | | |
| 403 | |
| 404 ### <a name="Library"></a>Library | |
| 405 | |
| 406 Reference properties: | |
| 407 | |
| 408 | keys | values | comments | |
| 409 | --- | --- | --- | |
| 410 | type | "@Library", "Library" | | |
| 411 | id | String | | |
| 412 | name | String | | |
| 413 | _vmName? | String | VM-internal name. Provided only when different from 'name
'. | |
| 414 | url | String | |
| 415 | |
| 416 Object properties: | |
| 417 | |
| 418 | keys | values | comments | |
| 419 | --- | --- | --- | |
| 420 | classes | List of [@Class](#Class) | | |
| 421 | imports | List of [@Library](#Library) | | |
| 422 | variables | List of ... | | |
| 423 | functions | List of [@Function](#Function) | | |
| 424 | scripts | List of [@Script](#Script) | | |
| 425 | |
| 426 ### <a name="Location"></a>Location | |
| 427 | |
| 428 Object properties: | |
| 429 | |
| 430 | keys | values | comments | |
| 431 | --- | --- | --- | |
| 432 | type | "Location" | | |
| 433 | script | [@Script](#Script) | | |
| 434 | tokenPos | int | | |
| 435 | |
| 436 ### <a name="null"></a>null | |
| 437 | |
| 438 Reference properties: | |
| 439 | |
| 440 | keys | values | comments | |
| 441 | --- | --- | --- | |
| 442 | type | "@null", "null" | | |
| 443 | id | String | | | |
| 444 | valueAsString | String | | |
| 445 | |
| 446 Object properties:<br> | |
| 447 | |
| 448 TODO. | |
| 449 | |
| 450 ### <a name="Object"></a>Object | |
| 451 | |
| 452 [Object](#Object) is the supertype of all responses returned by the VM | |
| 453 Service. It does not necessarily refer to an Object at the Dart | |
| 454 language level (see [Instance](#Instance)). | |
| 455 | |
| 456 Reference properties: | |
| 457 | |
| 458 | keys | values | comments | |
| 459 | --- | --- | --- | |
| 460 | type | "@Object", "Object" or subtype | | |
| 461 | _vmType? | String | VM internal name for this type. Provided only when differ
ent from 'type' | |
| 462 | id | String | | |
| 463 | |
| 464 Object properties: none<br> | |
| 465 | |
| 466 ### <a name="PcDescriptor"></a>PcDescriptor | |
| 467 | |
| 468 ### <a name="Script"></a>Script | |
| 469 | |
| 470 Reference properties: | |
| 471 | |
| 472 | keys | values | comments | example | | |
| 473 | --- | --- | --- | |
| 474 | type | "@Script", "Script" | | |
| 475 | id | String | |
| 476 | name | String | |
| 477 | _vmName? | String | VM-internal name. Provided only when different from 'name
'. | |
| 478 | kind | String | |
| 479 | |
| 480 Object properties: | |
| 481 | |
| 482 | keys | values | comments | |
| 483 | --- | --- | --- | |
| 484 | owningLibrary | [@Library](#Library) | |
| 485 | source | String | |
| 486 | tokenPosTable | List of list of int. See note below about token line format. | |
| 487 | |
| 488 *Token line format* | |
| 489 | |
| 490 | index | value | comments | |
| 491 | --- | --- | --- | |
| 492 | 0 | int | line number | |
| 493 | 1 | int | first token position | |
| 494 | 2 | int | first column number | |
| 495 | ... | ... | ... | |
| 496 | 1 + (2 * k) | int | kth token position | |
| 497 | 2 + (2 * k) | int | kth column number | |
| 498 | |
| 499 ### <a name="Sentinel"></a>Sentinel | |
| 500 | |
| 501 TODO: Enumerate known Sentinels<br> | |
| 502 TODO: Should this even have an id? Maybe a *kind* instead.<br><br> | |
| 503 | |
| 504 Object properties: | |
| 505 | |
| 506 | keys | values | comments | |
| 507 | --- | --- | --- | |
| 508 | type | "Sentinel" | | |
| 509 | id | String | | | |
| 510 | valueAsString | String | | |
| 511 | |
| 512 ### <a name="ServiceEvent"></a>ServiceEvent | |
| 513 | |
| 514 Object properties: | |
| 515 | |
| 516 | keys | values | comments | |
| 517 | --- | --- | --- | |
| 518 | type | "ServiceEvent" | | |
| 519 | id | String | TODO: Remove | | |
| 520 | eventType | String | "BreakpointReached", "BreakpointResolved", "ExceptionThro
wn", "IsolateCreated", "IsolateShutdown", "IsolateInterrupted" | | |
| 521 | isolate | [@Isolate](#Isolate) | | |
| 522 | breakpoint? | [Breakpoint](#Breakpoint) | for eventTypes "BreakpointResolved"
and "BreakpointReached<br><br>TODO: Maybe make this @Breakpoint? | |
| 523 | exception? | [@Instance](#Instance) | for eventType "ExceptionThrown" | |
| 524 | |
| 525 ### <a name="VM"></a>VM | |
| 526 | |
| 527 Object properties: | |
| 528 | |
| 529 | keys | values | comments | |
| 530 | --- | --- | --- | |
| 531 | type | "VM" | | |
| 532 | id | String | | |
| 533 | targetCPU | String | | |
| 534 | hostCPU | String | | |
| 535 | date | String | kill? | | |
| 536 | version | String | | |
| 537 | pid | int | | |
| 538 | assertsEnabled | bool | TODO: move to features? | | |
| 539 | typeChecksEnabled | bool | TODO: move to features? | | |
| 540 | uptime | double | seconds since vm started | | |
| 541 | "isolates" | List of [@Isolate](#Isolate) | | |
| 542 | |
| OLD | NEW |