Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Dart VM Service Protocol | 1 # Dart VM Service Protocol |
| 2 | 2 |
| 3 NOTE: The service api is still changing rapidly. If you use the | |
| 4 service api, expect to encounter non-compatible changes. | |
| 5 | |
| 3 Description | 6 Description |
| 4 How to start | 7 How to start |
| 5 JSON | 8 JSON |
| 6 Websocket | 9 Websocket |
| 7 | 10 |
| 8 ## Types | 11 ## Types |
| 9 | 12 |
| 10 Every response returned by the VM Service has the <code>type</code> property. T his allows the client distinguish between different kinds of responses. For exa mple, global information about the VM is encoded in an response of type [VM](#VM ) and information about an isolate is encoded in an response of type [Isolate](# Isolate). | 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). | |
| 11 | 18 |
| 12 If the type name of a response begins with an <code>@</code> character then that response is a _reference_. If the type name of a response does not begin with an <code>@</code> character then that response is an _object_ (or sometimes _ful l object_). A reference is meant to be a subset of a full object with just enou gh information for the client to generate a reasonable-looking link. | 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. | |
| 13 | 25 |
| 14 For example, an isolate reference may look like this... | 26 For example, an isolate reference may look like this... |
| 15 | 27 |
| 16 { | 28 { |
| 17 type: "@Isolate", | 29 type: "@Isolate", |
| 18 id: "isolates/123", | 30 id: "isolates/123", |
| 19 name: "worker" | 31 name: "worker" |
| 20 } | 32 } |
| 21 | 33 |
| 22 ... and a full isolate object would have additional properties: | 34 ... and a full isolate object would have additional properties: |
| 23 | 35 |
| 24 { | 36 { |
| 25 type: "@Isolate", | 37 type: "Isolate", |
| 26 id: "isolates/123", | 38 id: "isolates/123", |
| 27 name: "worker" | 39 name: "worker" |
| 28 entry: ... | 40 entry: ... |
| 29 heaps: ... | 41 heaps: ... |
| 30 topFrame: ... | 42 topFrame: ... |
| 31 ... | 43 ... |
| 32 } | 44 } |
| 33 | 45 |
| 34 ## IDs | 46 ## IDs |
| 35 | 47 |
| 36 Most responses returned by the VM Service have an <code>id</code> property. An id is used to request an object from the VM. | 48 Most responses returned by the VM Service have an <code>id</code> |
| 49 property. An id is used to request an object from the VM. Each id is | |
| 50 unique; that is to say, If two responses have the same id, they refer | |
| 51 to the same object. The converse is not true: the same object may | |
| 52 occasionally be returned with two different ids. | |
| 37 | 53 |
| 38 An id is either _global_ or _relative_. Global ids can be requested from the VM directly by requesting the uri <code>/{global id}</code>. | 54 An id is either _global_ or _relative_. Global ids can be requested |
| 55 from the VM directly by requesting the uri <code>/{global id}</code>. | |
| 39 | 56 |
| 40 The following is a list of known, fixed global ids: | 57 The following is a list of known, fixed global ids: |
| 41 | 58 |
| 42 | id | uri | type | 59 | id | uri | type |
| 43 | --- | --- | --- | 60 | --- | --- | --- |
| 44 | vm | /vm | [VM](#VM) | 61 | vm | /vm | [VM](#VM) |
| 45 | flags | /flags | [FlagList](#FlagList) | 62 | flags | /flags | [FlagList](#FlagList) |
| 46 | 63 |
| 47 In addition, all isolates have global ids, but these ids are dynamically generat ed. An isolate with an id like <code>isolates/123</code> would be available at the uri <code>/isolates/123</code>. | 64 In addition, all isolates have global ids, but these ids are |
| 65 dynamically generated. An isolate with an id like | |
| 66 <code>isolates/123</code> would be available at the uri | |
| 67 <code>/isolates/123</code>. | |
| 48 | 68 |
| 49 Relative ids are used to refer to objects that are owned by an isolate. Relativ e ids can be requested from the VM directly by requesting the uri <code>/{isolat e id}/{relative id}</code>. | 69 Relative ids are used to refer to objects that are owned by an |
| 70 isolate. Relative ids can be requested from the VM directly by | |
| 71 requesting the uri <code>/{isolate id}/{relative id}</code>. | |
| 50 | 72 |
| 51 For example, we can get information about a class with id <code>classes/Foo</cod e> from isolate <code>isolates/123</code> by requesting the uri <code>/isolates/ 123/classes/Foo</code> from the VM. | 73 For example, we can get information about a class with id |
| 74 <code>classes/Foo</code> from isolate <code>isolates/123</code> by | |
| 75 requesting the uri <code>/isolates/123/classes/Foo</code> from the VM. | |
| 52 | 76 |
| 53 The client must not parse ids -- they must be treated as opaque strings. We res erve the right to change the ids of objects. | 77 The client must not parse ids -- they must be treated as opaque |
| 78 strings. We reserve the right to change the ids of objects. | |
| 79 | |
| 80 ## Names | |
| 81 | |
| 82 Many responses have the <code>name</code> property. Names are | |
| 83 provided so that objects can be displayed in a way that a Dart | |
| 84 language programmer would find sensible. | |
| 85 | |
| 86 Note that names are not in any way unique. Many objects will have the | |
| 87 same name. | |
| 88 | |
| 89 Occasionally responses will have the <code>vmName</code> property. | |
| 90 This represents the internal names used to refer to an object inside | |
| 91 the VM itself. The <code>vmName</code> of an object is only provided | |
| 92 when it differs from the <code>name</code> property; when | |
| 93 <code>vmName</code> is not present, the client may assume the | |
| 94 <code>name</code> and <code>vmName</code> are the same. | |
| 54 | 95 |
| 55 ## Events | 96 ## Events |
| 56 | 97 |
| 57 TODO | 98 TODO |
| 58 | 99 |
| 59 ## Catalog of Types | 100 ## Catalog of Types |
| 101 | |
| 102 ### <a name="Breakpoint"></a>Breakpoint | |
| 103 | |
| 104 TODO: Get rid of Location or else use it more generally. | |
| 105 | |
| 106 | keys | values | comments | |
| 107 | --- | --- | --- | |
| 108 | type | "Breakpoint" | | |
| 109 | id | String | | |
| 110 | breakpointNumber | int | | |
| 111 | enabled | bool | | |
| 112 | resolved | bool | | |
| 113 | location | [Location](#Location) | | |
| 114 | |
| 115 ### <a name="DebuggerEvent"></a>DebuggerEvent | |
| 116 | |
| 117 | keys | values | comments | |
| 118 | --- | --- | --- | |
| 119 | type | "DebuggerEvent" | | |
| 120 | id | String | TODO: Remove | | |
| 121 | eventType | String | One of "BreakpointReached", "BreakpointResolved", "Except ionThrown", "IsolateCreated", "IsolateShutdown", or "IsolateInterrupted" | | |
|
Cutch
2014/08/26 20:38:43
Do we need "One of"?
| |
| 122 | isolate | [@Isolate](#atIsolate) | | |
| 123 | breakpoint? | [Breakpoint](#atBreakpoint) | for eventTypes "BreakpointResolved " and "BreakpointReached<br><br>TODO: Maybe make this @Breakpoint? | |
| 124 | exception? | [@Instance](#atInstance) | for eventType "ExceptionThrown" | |
| 125 | |
| 126 ### <a name="Frame"></a>Frame | |
| 127 | |
| 128 TODO: Add type and id?<br> | |
| 129 | |
| 130 | keys | values | comments | |
| 131 | --- | --- | --- | |
| 132 | script | [@Script](#atScript) | | |
| 133 | tokenPos | int | | |
| 134 | function | [@Function](#atFunction) | | |
| 135 | code | [@Code](#atCode) | | |
| 136 | vars | List of [FrameVar](#FrameVar) | | |
| 137 | |
| 138 ### <a name="FrameVar"></a>FrameVar | |
|
Cutch
2014/08/26 20:38:43
Document this as a 'format' instead of a type.
| |
| 139 | |
| 140 | keys | values | comments | |
| 141 | --- | --- | --- | |
| 142 | name | String | | |
| 143 | value | [@Instance](#atInstance) | | |
| 144 | |
| 145 ### <a name="Location"></a>Location | |
| 146 | |
| 147 | keys | values | comments | |
| 148 | --- | --- | --- | |
| 149 | type | "Location" | | |
| 150 | script | [@Script](#atScript) | | |
| 151 | tokenPos | int | | |
| 152 | |
| 153 ### <a name="@Null"></a>@Null | |
| 154 | |
| 155 TODO: Split Null from the other Sentinel types. | |
| 156 | |
| 157 | keys | values | comments | |
| 158 | --- | --- | --- | |
| 159 | type | "@Null" | | |
| 160 | id | String | | | |
| 161 | valueAsString | String | | |
| 162 | |
| 60 ### <a name="VM"></a>VM | 163 ### <a name="VM"></a>VM |
| 61 | 164 |
| 62 | keys | values | comments | 165 | keys | values | comments |
| 63 | --- | --- | --- | 166 | --- | --- | --- |
| 64 | type | "VM" | | 167 | type | "VM" | |
| 65 | id | String | | 168 | id | String | |
| 66 | targetCPU | String | | 169 | targetCPU | String | |
| 67 | hostCPU | String | | 170 | hostCPU | String | |
| 68 | date | String | kill? | | 171 | date | String | kill? | |
| 69 | version | String | | 172 | version | String | |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 | 255 |
| 153 ### <a name="TokenLine"></a>TokenLine | 256 ### <a name="TokenLine"></a>TokenLine |
| 154 | index | value | comments | 257 | index | value | comments |
| 155 | --- | --- | --- | 258 | --- | --- | --- |
| 156 | 0 | integer | line number | 259 | 0 | integer | line number |
| 157 | 1 | integer | first token position | 260 | 1 | integer | first token position |
| 158 | 2 | integer | first column number | 261 | 2 | integer | first column number |
| 159 | ... | ... | ... | 262 | ... | ... | ... |
| 160 | 1 + (2 * k) | integer | kth token position | 263 | 1 + (2 * k) | integer | kth token position |
| 161 | 2 + (2 * k) | integer | kth column number | 264 | 2 + (2 * k) | integer | kth column number |
| OLD | NEW |