Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: runtime/vm/service/service.md

Issue 1152753005: Service cleanups... (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update docs. Tweak TypeRef and BoundedType. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Dart VM Service Protocol 0.0 1 # Dart VM Service Protocol 1.0 (Draft 1)
2 2
3 This document describes _version 0.0_ of the Dart VM Service Protocol. 3 This document describes _draft 1_ of _version 1.0_ of the Dart VM
4 This protocol is used to communicate with a running Dart Virtual 4 Service Protocol. This protocol is used to communicate with a running
5 Machine. 5 Dart Virtual Machine.
6 6
7 To use the Service Protocol, start the VM with the *--observe* flag. 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. 8 The VM will start a webserver which services protocol requests via WebSocket.
9 It is possible to make HTTP (non-WebSocket) requests, 9 It is possible to make HTTP (non-WebSocket) requests,
10 but this does not allow access to VM _events_ and is not documented 10 but this does not allow access to VM _events_ and is not documented
11 here. 11 here.
12 12
13 The Service Protocol is based on JSON-RPC 2.0 13 The Service Protocol is based on JSON-RPC 2.0
14 (http://www.jsonrpc.org/specification). The Service Protocol has been 14 (http://www.jsonrpc.org/specification). The Service Protocol has been
15 extended to support pushing _events_ to the client, which is 15 extended to support pushing _events_ to the client, which is
16 apparently outside the scope of the JSON-RPC specification. 16 apparently outside the scope of the JSON-RPC specification.
17 17
18 **Table of Contents** 18 **Table of Contents**
19 19
20 - [RPCs, Requests, and Responses](#rpcs-requests-and-responses) 20 - [RPCs, Requests, and Responses](#rpcs-requests-and-responses)
21 - [Events](#events) 21 - [Events](#events)
22 - [Types](#types) 22 - [Types](#types)
23 - [IDs and Names](#ids-and-names) 23 - [IDs and Names](#ids-and-names)
24 - [Versioning](#versioning) 24 - [Versioning](#versioning)
(...skipping 17 matching lines...) Expand all
42 - [streamCancel](#streamcancel) 42 - [streamCancel](#streamcancel)
43 - [streamListen](#streamlisten) 43 - [streamListen](#streamlisten)
44 - [Public Types](#public-types) 44 - [Public Types](#public-types)
45 - [BoundField](#boundfield) 45 - [BoundField](#boundfield)
46 - [BoundVariable](#boundvariable) 46 - [BoundVariable](#boundvariable)
47 - [Breakpoint](#breakpoint) 47 - [Breakpoint](#breakpoint)
48 - [Class](#class) 48 - [Class](#class)
49 - [ClassList](#classlist) 49 - [ClassList](#classlist)
50 - [Code](#code) 50 - [Code](#code)
51 - [CodeKind](#codekind) 51 - [CodeKind](#codekind)
52 - [Context](#context)
53 - [ContextElement](#contextelement)
52 - [Error](#error) 54 - [Error](#error)
55 - [ErrorKind](#errorkind)
53 - [Event](#event) 56 - [Event](#event)
54 - [EventKind](#eventkind) 57 - [EventKind](#eventkind)
55 - [Field](#field) 58 - [Field](#field)
56 - [Flag](#flag) 59 - [Flag](#flag)
57 - [FlagList](#flaglist) 60 - [FlagList](#flaglist)
58 - [Frame](#frame) 61 - [Frame](#frame)
59 - [Function](#function) 62 - [Function](#function)
60 - [Instance](#instance) 63 - [Instance](#instance)
61 - [Isolate](#isolate) 64 - [Isolate](#isolate)
62 - [Library](#library) 65 - [Library](#library)
63 - [LibraryDependency](#librarydependency) 66 - [LibraryDependency](#librarydependency)
64 » - [ListElement](#listelement) 67 » - [MapAssociation](#mapassociation)
65 - [Message](#message) 68 - [Message](#message)
66 - [Null](#null) 69 - [Null](#null)
67 - [Object](#object) 70 - [Object](#object)
68 - [Sentinel](#sentinel) 71 - [Sentinel](#sentinel)
69 - [SentinelKind](#sentinelkind) 72 - [SentinelKind](#sentinelkind)
70 - [Script](#script) 73 - [Script](#script)
71 - [SourceLocation](#sourcelocation) 74 - [SourceLocation](#sourcelocation)
72 - [Stack](#stack) 75 - [Stack](#stack)
73 - [StepOption](#stepoption) 76 - [StepOption](#stepoption)
74 - [Success](#success) 77 - [Success](#success)
75 - [TypeArguments](#typearguments) 78 - [TypeArguments](#typearguments)
76 - [Response](#response) 79 - [Response](#response)
77 - [Version](#version) 80 - [Version](#version)
78 - [VM](#vm) 81 - [VM](#vm)
79 - [Revision History](#revision-history) 82 - [Revision History](#revision-history)
80 83
81 ## RPCs, Requests, and Responses 84 ## RPCs, Requests, and Responses
82 85
83 An RPC request is a JSON object sent to the server. Here is an 86 An RPC request is a JSON object sent to the server. Here is an
84 example [getVersion](#getversion) request: 87 example [getVersion](#getversion) request:
85 88
86 ``` 89 ```
87 { 90 {
88 "jsonrpc": "2.0", 91 "jsonrpc": "2.0",
89 "method": "getVersion", 92 "method": "getVersion",
90 "params": {}, 93 "params": {},
91 "id": "1" 94 "id": "1"
92 } 95 }
93 ``` 96 ```
94 97
95 Currently the _id_ property must be a string. The Service Protocol 98 Currently the _id_ property must be a string. The Service Protocol
96 optionally accepts requests without the _jsonprc_ property. 99 optionally accepts requests without the _jsonprc_ property.
97 100
98 An RPC response is a JSON object (http://json.org/). The response always specif ies an 101 An RPC response is a JSON object (http://json.org/). The response always specifi es an
99 _id_ property to pair it with the corresponding request. If the RPC 102 _id_ property to pair it with the corresponding request. If the RPC
100 was successful, the _result_ property provides the result. 103 was successful, the _result_ property provides the result.
101 104
102 Here is an example response for our [getVersion](#getversion) request above: 105 Here is an example response for our [getVersion](#getversion) request above:
103 106
104 ``` 107 ```
105 { 108 {
106 "json-rpc": "2.0", 109 "json-rpc": "2.0",
107 "result": { 110 "result": {
108 "type": "Version", 111 "type": "Version",
109 "major": 0, 112 "major": 1,
110 "minor": 0 113 "minor": 0
111 } 114 }
112 "id": "1" 115 "id": "1"
113 } 116 }
114 ``` 117 ```
115 118
116 Parameters for RPC requests are always provided as _named_ parameters. 119 Parameters for RPC requests are always provided as _named_ parameters.
117 The JSON-RPC spec provides for _positional_ parameters as well, but they 120 The JSON-RPC spec provides for _positional_ parameters as well, but they
118 are not supported by the Dart VM. 121 are not supported by the Dart VM.
119 122
120 By convention, every response returned by the Service Protocol is a subtype 123 By convention, every response returned by the Service Protocol is a subtype
121 of [Response](#response) and provides a _type_ paramters which can be used 124 of [Response](#response) and provides a _type_ paramters which can be used
122 to distinguish the exact return type. In the example above, the 125 to distinguish the exact return type. In the example above, the
123 [Version](#version) type is returned. 126 [Version](#version) type is returned.
124 127
125 Here is an example [streamListen](#streamlisten) request which provides 128 Here is an example [streamListen](#streamlisten) request which provides
126 a parameter: 129 a parameter:
127 130
128 ``` 131 ```
129 { 132 {
130 "jsonrpc": "2.0", 133 "jsonrpc": "2.0",
131 "method": "streamListen", 134 "method": "streamListen",
132 "params": { 135 "params": {
133 "streamId": "GC", 136 "streamId": "GC",
134 }, 137 },
135 "id": "2" 138 "id": "2"
136 } 139 }
137 ``` 140 ```
138 141
139 <a name="rpc-error"></a> 142 <a name="rpc-error"></a>
140 When an RPC encounters an error, it is provided in the _error_ 143 When an RPC encounters an error, it is provided in the _error_
141 property of the response object. JSON-RPC errors always provide 144 property of the response object. JSON-RPC errors always provide
142 _code_, _message_, and _data_ properties. 145 _code_, _message_, and _data_ properties.
143 146
144 Here is an example error response for our [streamListen](#streamlisten) 147 Here is an example error response for our [streamListen](#streamlisten)
145 request above. This error would be generated if we were attempting to 148 request above. This error would be generated if we were attempting to
146 subscribe to the _GC_ stream multiple times from the same client. 149 subscribe to the _GC_ stream multiple times from the same client.
147 150
148 ``` 151 ```
149 { 152 {
150 "json-rpc": "2.0", 153 "json-rpc": "2.0",
151 "error": { 154 "error": {
152 "code": 103, 155 "code": 103,
153 "message": "Stream already subscribed", 156 "message": "Stream already subscribed",
154 "data": { 157 "data": {
155 "details": "The stream 'GC' is already subscribed" 158 "details": "The stream 'GC' is already subscribed"
(...skipping 14 matching lines...) Expand all
170 103 | Stream already subscribed | The client is already subscribed to the specif ied _streamId_ 173 103 | Stream already subscribed | The client is already subscribed to the specif ied _streamId_
171 104 | Stream not subscribed | The client is not subscribed to the specified _str eamId_ 174 104 | Stream not subscribed | The client is not subscribed to the specified _str eamId_
172 175
173 176
174 177
175 178
176 ## Events 179 ## Events
177 180
178 By using the [streamListen](#streamlisten) and [streamCancel](#streamcancel) RPC s, a client may 181 By using the [streamListen](#streamlisten) and [streamCancel](#streamcancel) RPC s, a client may
179 request to be notified when an _event_ is posted to a specific 182 request to be notified when an _event_ is posted to a specific
180 _stream_ in the VM. Every stream has an associated _stream id_ which 183 _stream_ in the VM. Every stream has an associated _stream id_ which
181 is used to name that stream. 184 is used to name that stream.
182 185
183 Each stream provides access to certain kinds of events. For example the _Isolat e_ stream provides 186 Each stream provides access to certain kinds of events. For example the _Isolate _ stream provides
184 access to events pertaining to isolate births, deaths, and name changes. See [s treamListen](#streamlisten) 187 access to events pertaining to isolate births, deaths, and name changes. See [st reamListen](#streamlisten)
185 for a list of the well-known stream ids and their associated events. 188 for a list of the well-known stream ids and their associated events.
186 189
187 Events arrive asynchronously over the WebSocket and always have the 190 Events arrive asynchronously over the WebSocket and always have the
188 _streamId_ and _event_ properties: 191 _streamId_ and _event_ properties:
189 192
190 ``` 193 ```
191 { 194 {
192 "event": { 195 "event": {
193 "type": "Event", 196 "type": "Event",
194 "kind": "IsolateExit", 197 "kind": "IsolateExit",
195 "isolate": { 198 "isolate": {
196 "type": "@Isolate", 199 "type": "@Isolate",
197 "id": "isolates/33", 200 "id": "isolates/33",
198 "number": "51048743613", 201 "number": "51048743613",
199 "name": "worker-isolate" 202 "name": "worker-isolate"
200 } 203 }
201 } 204 }
202 "streamId": "Isolate" 205 "streamId": "Isolate"
203 } 206 }
204 ``` 207 ```
205 208
206 It is considered a _backwards compatible_ change to add a new type of event to a n existing stream. 209 It is considered a _backwards compatible_ change to add a new type of event to a n existing stream.
207 Clients should be written to handle this gracefully. 210 Clients should be written to handle this gracefully.
208 211
209 212
210 ## Types 213 ## Types
211 214
212 By convention, every result and event provided by the Service Protocol 215 By convention, every result and event provided by the Service Protocol
213 is a subtype of [Response](#response) and has the _type_ property. 216 is a subtype of [Response](#response) and has the _type_ property.
214 This allows the client to distinguish different kinds of responses. For example , 217 This allows the client to distinguish different kinds of responses. For example,
215 information about a Dart function is returned using the [Function](#function) ty pe. 218 information about a Dart function is returned using the [Function](#function) ty pe.
216 219
217 If the type of a response begins with the _@_ character, then that 220 If the type of a response begins with the _@_ character, then that
218 response is a _reference_. If the type name of a response does not 221 response is a _reference_. If the type name of a response does not
219 begin with the _@_ character, it is the an _object_. A reference is 222 begin with the _@_ character, it is the an _object_. A reference is
220 intended to be a subset of an object which provides enough information 223 intended to be a subset of an object which provides enough information
221 to generate a reasonable looking reference to the object. 224 to generate a reasonable looking reference to the object.
222 225
223 For example, an [@Isolate](#isolate) reference has the _type_, _id_, _name_ and 226 For example, an [@Isolate](#isolate) reference has the _type_, _id_, _name_ and
224 _number_ properties: 227 _number_ properties:
225 228
226 ``` 229 ```
227 "result": { 230 "result": {
228 "type": "@Isolate", 231 "type": "@Isolate",
229 "id": "isolates/33", 232 "id": "isolates/33",
(...skipping 14 matching lines...) Expand all
244 "entry": ... 247 "entry": ...
245 "heaps": ... 248 "heaps": ...
246 ... 249 ...
247 } 250 }
248 ``` 251 ```
249 252
250 ## IDs and Names 253 ## IDs and Names
251 254
252 Many responses returned by the Service Protocol have an _id_ property. 255 Many responses returned by the Service Protocol have an _id_ property.
253 This is an identifier used to request an object from an isolate using 256 This is an identifier used to request an object from an isolate using
254 the [getObject](#getobject) RPC. If two responses have the same _id_ then they 257 the [getObject](#getobject) RPC. If two responses have the same _id_ then they
255 refer to the same object. The converse is not true: the same object 258 refer to the same object. The converse is not true: the same object
256 may sometimes be returned with two different values for _id_. 259 may sometimes be returned with two different values for _id_.
257 260
258 The _id_ property should be treated as an opaque string by the client: 261 The _id_ property should be treated as an opaque string by the client:
259 it is not meant to be parsed. 262 it is not meant to be parsed.
260 263
261 An id can be either _temporary_ or _fixed_: 264 An id can be either _temporary_ or _fixed_:
262 265
263 * A _temporary_ id can expire over time. The VM allocates certain ids 266 * A _temporary_ id can expire over time. The VM allocates certain ids
264 in a ring which evicts old ids over time. 267 in a ring which evicts old ids over time.
265 268
266 * A _fixed_ id will never expire, but the object it refers to may 269 * A _fixed_ id will never expire, but the object it refers to may
267 be collected. The VM uses fixed ids for objects like scripts, 270 be collected. The VM uses fixed ids for objects like scripts,
268 libraries, and classes. 271 libraries, and classes.
269 272
270 If an id is fixed, the _fixedId_ property will be true. If an id is temporary 273 If an id is fixed, the _fixedId_ property will be true. If an id is temporary
271 the _fixedId_ property will be omitted. 274 the _fixedId_ property will be omitted.
272 275
273 Sometimes a temporary id may expire. In this case, some RPCs may return 276 Sometimes a temporary id may expire. In this case, some RPCs may return
274 an _Expired_ [Sentinel](#sentinel) to indicate this. 277 an _Expired_ [Sentinel](#sentinel) to indicate this.
275 278
276 The object referred to by an id may be collected by the VM's garbage 279 The object referred to by an id may be collected by the VM's garbage
277 collector. In this case, some RPCs may return a _Collected_ [Sentinel](#sentine l) 280 collector. In this case, some RPCs may return a _Collected_ [Sentinel](#sentinel )
278 to indicate this. 281 to indicate this.
279 282
280 Many objects also have a _name_ property. This is provided so that 283 Many objects also have a _name_ property. This is provided so that
281 objects can be displayed in a way that a Dart language programmer 284 objects can be displayed in a way that a Dart language programmer
282 would find familiar. Names are not unique. 285 would find familiar. Names are not unique.
283 286
284 ## Versioning 287 ## Versioning
285 288
286 The [getVersion](#getversion) RPC can be used to find the version of the protoco l 289 The [getVersion](#getversion) RPC can be used to find the version of the protoco l
287 returned by a VM. The _Version_ response has a major and a minor 290 returned by a VM. The _Version_ response has a major and a minor
288 version number: 291 version number:
289 292
290 ``` 293 ```
291 "result": { 294 "result": {
292 "type": "Version", 295 "type": "Version",
293 "major": 0, 296 "major": 1,
294 "minor": 0 297 "minor": 0
295 } 298 }
296 ``` 299 ```
297 300
298 The major version number is incremented when the protocol is changed 301 The major version number is incremented when the protocol is changed
299 in a potentially _incompatible_ way. An example of an incompatible 302 in a potentially _incompatible_ way. An example of an incompatible
300 change is removing a non-optional property from a result. 303 change is removing a non-optional property from a result.
301 304
302 The minor version number is incremented when the protocol is changed 305 The minor version number is incremented when the protocol is changed
303 in a _backwards compatible_ way. An example of a backwards compatible 306 in a _backwards compatible_ way. An example of a backwards compatible
304 change is adding a property to a result. 307 change is adding a property to a result.
305 308
306 Certain changes that would normally not be backwards compatible are 309 Certain changes that would normally not be backwards compatible are
307 considered backwards compatible for the purposes of versioning. 310 considered backwards compatible for the purposes of versioning.
308 Specifically, additions can be made to the [EventKind](#eventkind) and 311 Specifically, additions can be made to the [EventKind](#eventkind) and
309 [InstanceKind](#instancekind) enumerated types and the client must 312 [InstanceKind](#instancekind) enumerated types and the client must
310 handle this gracefully. See the notes on these enumerated types for more 313 handle this gracefully. See the notes on these enumerated types for more
311 information. 314 information.
312 315
313 ## Private RPCs, Types, and Properties 316 ## Private RPCs, Types, and Properties
314 317
315 Any RPC, type, or property which begins with an underscore is said to 318 Any RPC, type, or property which begins with an underscore is said to
316 be _private_. These RPCs, types, and fields can be changed at any 319 be _private_. These RPCs, types, and fields can be changed at any
317 time without changing major or minor version numbers. 320 time without changing major or minor version numbers.
318 321
319 The intention is that the Service Protocol will evolve by adding 322 The intention is that the Service Protocol will evolve by adding
320 private RPCs which may, over time, migrate to the public api as they 323 private RPCs which may, over time, migrate to the public api as they
321 become stable. Some private types and properties expose VM specific 324 become stable. Some private types and properties expose VM specific
322 implementation state and will never be appropriate to add to 325 implementation state and will never be appropriate to add to
323 the public api. 326 the public api.
324 327
325 ## Public RPCs 328 ## Public RPCs
326 329
327 The following is a list of all public RPCs supported by the Service Protocol. 330 The following is a list of all public RPCs supported by the Service Protocol.
328 331
329 An RPC is described using the following format: 332 An RPC is described using the following format:
330 333
331 ``` 334 ```
332 ReturnType methodName(parameterType1 parameterName1, 335 ReturnType methodName(parameterType1 parameterName1,
333 parameterType2, parameterName2, 336 parameterType2, parameterName2,
334 ...) 337 ...)
335 ``` 338 ```
336 339
337 If an RPC says it returns type _T_ it may actually return _T_ or any 340 If an RPC says it returns type _T_ it may actually return _T_ or any
338 [subtype](#public-types) of _T_. For example, an 341 [subtype](#public-types) of _T_. For example, an
339 RPC which is declared to return [@Instance](#instance) may actually 342 RPC which is declared to return [@Instance](#instance) may actually
340 return [@Int](#int). 343 return [@Int](#int).
341 344
342 If an RPC can return one or more independent types, this is indicated 345 If an RPC can return one or more independent types, this is indicated
343 with the vertical bar: 346 with the vertical bar:
344 347
345 ``` 348 ```
346 ReturnType1|ReturnType2 349 ReturnType1|ReturnType2
347 ``` 350 ```
348 351
349 Any RPC may return an _error_ response as [described above](#rpc-error). 352 Any RPC may return an _error_ response as [described above](#rpc-error).
350 353
351 Some parameters are optional. This is indicated by the text 354 Some parameters are optional. This is indicated by the text
352 _[optional]_ following the parameter name: 355 _[optional]_ following the parameter name:
353 356
354 ``` 357 ```
355 ReturnType methodName(parameterType parameterName [optional) 358 ReturnType methodName(parameterType parameterName [optional)
356 ``` 359 ```
357 360
358 A description of the return types and parameter types is provided 361 A description of the return types and parameter types is provided
359 in the section on [public types](#public-types). 362 in the section on [public types](#public-types).
360 363
361 ### addBreakpoint 364 ### addBreakpoint
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 424
422 ### evaluateInFrame 425 ### evaluateInFrame
423 426
424 ``` 427 ```
425 @Instance|@Error evaluateInFrame(string isolateId, 428 @Instance|@Error evaluateInFrame(string isolateId,
426 int frameIndex, 429 int frameIndex,
427 string expression) 430 string expression)
428 ``` 431 ```
429 432
430 The _evaluateInFrame_ RPC is used to evaluate an expression in the 433 The _evaluateInFrame_ RPC is used to evaluate an expression in the
431 context of a particular stack frame. _frameIndex_ is the index of the 434 context of a particular stack frame. _frameIndex_ is the index of the
432 desired [Frame](#frame), with an index of _0_ indicating the top (most 435 desired [Frame](#frame), with an index of _0_ indicating the top (most
433 recent) frame. 436 recent) frame.
434 437
435 If an error occurs while evaluating the expression, an [@Error](#error) 438 If an error occurs while evaluating the expression, an [@Error](#error)
436 reference will be returned. 439 reference will be returned.
437 440
438 If the expression is evaluated successfully, an [@Instance](#instance) 441 If the expression is evaluated successfully, an [@Instance](#instance)
439 reference will be returned. 442 reference will be returned.
440 443
441 ### getFlagList 444 ### getFlagList
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 If the object handle has not expired and the object has not been 482 If the object handle has not expired and the object has not been
480 collected, then an [Object](#object) will be returned. 483 collected, then an [Object](#object) will be returned.
481 484
482 ### getStack 485 ### getStack
483 486
484 ``` 487 ```
485 Stack getStack(string isolateId) 488 Stack getStack(string isolateId)
486 ``` 489 ```
487 490
488 The _getStack_ RPC is used to retrieve the current execution stack and 491 The _getStack_ RPC is used to retrieve the current execution stack and
489 message queue for an isolate. The isolate does not need to be paused. 492 message queue for an isolate. The isolate does not need to be paused.
490 493
491 See [Stack](#stack). 494 See [Stack](#stack).
492 495
493 ### getVersion 496 ### getVersion
494 497
495 ``` 498 ```
496 Version getVersion() 499 Version getVersion()
497 ``` 500 ```
498 501
499 The _getVersion_ RPC is used to determine what version of the Service Protocol i s served by a VM. 502 The _getVersion_ RPC is used to determine what version of the Service Protocol i s served by a VM.
500 503
501 See [Version](#version). 504 See [Version](#version).
502 505
503 ### getVM 506 ### getVM
504 507
505 ``` 508 ```
506 VM getVM() 509 VM getVM()
507 ``` 510 ```
508 511
509 The _getVM_ RPC returns global information about a Dart virtual machine. 512 The _getVM_ RPC returns global information about a Dart virtual machine.
510 513
511 See [VM](#vm). 514 See [VM](#vm).
512 515
513 ### pause 516 ### pause
514 517
515 ``` 518 ```
516 Success pause(string isolateId) 519 Success pause(string isolateId)
517 ``` 520 ```
518 521
519 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. 522 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.
520 523
521 When the isolate is paused an event will be sent on the _Debug_ stream. 524 When the isolate is paused an event will be sent on the _Debug_ stream.
522 525
523 See [Success](#success). 526 See [Success](#success).
524 527
525 ### removeBreakpoint 528 ### removeBreakpoint
526 529
527 ``` 530 ```
528 Success removeBreakpoint(string isolateId, 531 Success removeBreakpoint(string isolateId,
529 string breakpointId) 532 string breakpointId)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 subscribed) error code is returned. 597 subscribed) error code is returned.
595 598
596 See [Success](#success). 599 See [Success](#success).
597 600
598 ### streamListen 601 ### streamListen
599 602
600 ``` 603 ```
601 Success streamListen(string streamId) 604 Success streamListen(string streamId)
602 ``` 605 ```
603 606
604 The _streamListen_ RPC subscribes to a stream in the VM. Once 607 The _streamListen_ RPC subscribes to a stream in the VM. Once
605 subscribed, the client will begin receiving events from the stream. 608 subscribed, the client will begin receiving events from the stream.
606 609
607 If the client is not subscribed to the stream, the _103_ (Stream already 610 If the client is not subscribed to the stream, the _103_ (Stream already
608 subscribed) error code is returned. 611 subscribed) error code is returned.
609 612
610 The _streamId_ parameter may have the following published values: 613 The _streamId_ parameter may have the following published values:
611 614
612 streamId | event types provided 615 streamId | event types provided
613 -------- | ----------- 616 -------- | -----------
614 Isolate | IsolateStart, IsolateExit, IsolateUpdate 617 Isolate | IsolateStart, IsolateExit, IsolateUpdate
(...skipping 25 matching lines...) Expand all
640 ``` 643 ```
641 class T { 644 class T {
642 string name; 645 string name;
643 int count; 646 int count;
644 ... 647 ...
645 } 648 }
646 ``` 649 ```
647 650
648 This describes a JSON object type _T_ with some set of expected properties. 651 This describes a JSON object type _T_ with some set of expected properties.
649 652
650 Types are organized into an inheritance hierarchy. If type _T_ 653 Types are organized into an inheritance hierarchy. If type _T_
651 extends type _S_... 654 extends type _S_...
652 655
653 ``` 656 ```
654 class S { 657 class S {
655 string a; 658 string a;
656 } 659 }
657 660
658 class T extends S { 661 class T extends S {
659 string b; 662 string b;
660 } 663 }
661 ``` 664 ```
662 665
663 ...then that means that all properties of _S_ are also present in type 666 ...then that means that all properties of _S_ are also present in type
664 _T_. In the example above, type _T_ would have the expected 667 _T_. In the example above, type _T_ would have the expected
665 properties _a_ and _b_. 668 properties _a_ and _b_.
666 669
667 If a property has an _Array_ type, it is written with brackets: 670 If a property has an _Array_ type, it is written with brackets:
668 671
669 ``` 672 ```
670 PropertyType[] arrayProperty; 673 PropertyType[] arrayProperty;
671 ``` 674 ```
672 675
673 If a property is optional, it is suffixed with the text _[optional]_: 676 If a property is optional, it is suffixed with the text _[optional]_:
674 677
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 789
787 // The location of this class in the source code. 790 // The location of this class in the source code.
788 SourceLocation location [optional]; 791 SourceLocation location [optional];
789 792
790 // The superclass of this class, if any. 793 // The superclass of this class, if any.
791 @Class super [optional]; 794 @Class super [optional];
792 795
793 // A list of interface types for this class. 796 // A list of interface types for this class.
794 @Type[] interfaces; 797 @Type[] interfaces;
795 798
796 // A list of fields in this class. Does not include fields from 799 // A list of fields in this class. Does not include fields from
797 // superclasses. 800 // superclasses.
798 @Field[] fields; 801 @Field[] fields;
799 802
800 // A list of functions in this class. Does not include functions 803 // A list of functions in this class. Does not include functions
801 // from superclasses. 804 // from superclasses.
802 @Function[] functions; 805 @Function[] functions;
803 806
804 // A list of subclasses of this class. 807 // A list of subclasses of this class.
805 @Class[] subclasses; 808 @Class[] subclasses;
806 } 809 }
807 ``` 810 ```
808 811
809 A _Class_ provides information about a Dart language class. 812 A _Class_ provides information about a Dart language class.
810 813
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 int length; 865 int length;
863 } 866 }
864 ``` 867 ```
865 868
866 ``` 869 ```
867 class Context { 870 class Context {
868 // The number of variables in this context. 871 // The number of variables in this context.
869 int length; 872 int length;
870 873
871 // The variables in this context object. 874 // The variables in this context object.
872 ListElement[] variables; 875 ContextElement[] variables;
873 } 876 }
874 ``` 877 ```
875 878
879 ### ContextElement
880
881 ```
882 class ContextElement {
883 @Instance|Sentinel value;
884 }
885 ```
886
876 ### Error 887 ### Error
877 888
878 ``` 889 ```
879 class @Error extends @Object { 890 class @Error extends @Object {
891 // What kind of error is this?
892 ErrorKind kind;
893
880 // A description of the error. 894 // A description of the error.
881 string message; 895 string message;
882 } 896 }
883 ``` 897 ```
884 898
885 _@Error_ is a reference to an _Error_. 899 _@Error_ is a reference to an _Error_.
886 900
887 ``` 901 ```
888 class Error extends Object { 902 class Error extends Object {
903 // What kind of error is this?
904 ErrorKind kind;
905
889 // A description of the error. 906 // A description of the error.
890 string message; 907 string message;
891 908
892 // If this error is due to an unhandled exception, this 909 // If this error is due to an unhandled exception, this
893 // is the exception thrown. 910 // is the exception thrown.
894 @Instance exception [optional]; 911 @Instance exception [optional];
895 912
896 // If this error is due to an unhandled exception, this 913 // If this error is due to an unhandled exception, this
897 // is the stacktrace object. 914 // is the stacktrace object.
898 @Instance stacktrace [optional]; 915 @Instance stacktrace [optional];
899 } 916 }
900 ``` 917 ```
901 918
902 An _Error_ represents a Dart language level error. This is distinct from an 919 An _Error_ represents a Dart language level error. This is distinct from an
903 [rpc error](#rpc-error). 920 [rpc error](#rpc-error).
904 921
905 An error may occur when: 922 ### ErrorKind
906 923
907 - The program has encountered an unhandled exception 924 ```
908 - The program has encountered a syntax error (or another Dart language error) 925 enum ErrorKind {
909 - The program has encountered an unhandled erroneous condition in native code 926 // The isolate has encountered an unhandled Dart exception.
910 - The program has been terminated 927 UnhandledException,
928
929 // The isolate has encountered a Dart language error in the program.
930 LanguageError,
931
932 // The isolate has encounted an internal error. These errors should be
933 // reported as bugs.
934 InternalError,
935
936 // The isolate has been terminated by an external source.
937 TerminationError
938 }
939 ```
911 940
912 ### Event 941 ### Event
913 942
914 ``` 943 ```
915 class Event extends Response { 944 class Event extends Response {
916 // What kind of event is this? 945 // What kind of event is this?
917 EventKind kind; 946 EventKind kind;
918 947
919 // The isolate with which this event is associated. 948 // The isolate with which this event is associated.
920 @Isolate isolate; 949 @Isolate isolate;
921 950
922 // The breakpoint associated with this event, if applicable. 951 // The breakpoint which was added, removed, or resolved.
923 // 952 //
924 // This is provided for the event kinds: 953 // This is provided for the event kinds:
925 // PauseBreakpoint 954 // PauseBreakpoint
926 // BreakpointAdded 955 // BreakpointAdded
927 // BreakpointRemoved 956 // BreakpointRemoved
928 // BreakpointResolved 957 // BreakpointResolved
929 Breakpoint breakpoint [optional]; 958 Breakpoint breakpoint [optional];
930 959
960 // The list of breakpoints at which we are currently paused
961 // for a PauseBreakpoint event.
962 //
963 // This list may be empty. For example, while single-stepping, the
964 // VM sends a PauseBreakpoint event with no breakpoints.
965 //
966 // If there is more than one breakpoint set at the program position,
967 // then all of them will be provided.
968 //
969 // This is provided for the event kinds:
970 // PauseBreakpoint
971 Breakpoint[] pauseBreakpoints [optional];
972
931 // The top stack frame associated with this event, if applicable. 973 // The top stack frame associated with this event, if applicable.
932 // 974 //
933 // This is provided for the event kinds: 975 // This is provided for the event kinds:
934 // PauseBreakpoint 976 // PauseBreakpoint
935 // PauseInterrupted 977 // PauseInterrupted
936 // PauseException 978 // PauseException
937 // 979 //
938 // For the Resume event, the top frame is provided at 980 // For the Resume event, the top frame is provided at
939 // all times except for the initial resume event that is delivered 981 // all times except for the initial resume event that is delivered
940 // when an isolate begins execution. 982 // when an isolate begins execution.
941 Frame topFrame [optional]; 983 Frame topFrame [optional];
942 984
943 // The exception associated with this event, if this is a 985 // The exception associated with this event, if this is a
944 // PauseException event. 986 // PauseException event.
945 @Instance exception [optional]; 987 @Instance exception [optional];
946 } 988 }
947 ``` 989 ```
948 990
949 An _Event_ is an asynchronous notification from the VM. It is delivered 991 An _Event_ is an asynchronous notification from the VM. It is delivered
950 only when the client has subscribed to an event stream using the 992 only when the client has subscribed to an event stream using the
951 [streamListen](#streamListen) RPC. 993 [streamListen](#streamListen) RPC.
952 994
953 For more information, see [events](#events). 995 For more information, see [events](#events).
954 996
955 ### EventKind 997 ### EventKind
956 998
957 ``` 999 ```
958 enum EventKind { 1000 enum EventKind {
959 // Notification that a new isolate has started. 1001 // Notification that a new isolate has started.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 1035
994 // A breakpoint has been removed. 1036 // A breakpoint has been removed.
995 BreakpointRemoved, 1037 BreakpointRemoved,
996 1038
997 // A garbage collection event. 1039 // A garbage collection event.
998 GC 1040 GC
999 } 1041 }
1000 ``` 1042 ```
1001 1043
1002 Adding new values to _EventKind_ is considered a backwards compatible 1044 Adding new values to _EventKind_ is considered a backwards compatible
1003 change. Clients should ignore unrecognized events. 1045 change. Clients should ignore unrecognized events.
1004 1046
1005 ### Field 1047 ### Field
1006 1048
1007 ``` 1049 ```
1008 class @Field extends @Object { 1050 class @Field extends @Object {
1009 // The name of this field. 1051 // The name of this field.
1010 string name; 1052 string name;
1011 1053
1012 // The owner of this field, which can be either a Library or a 1054 // The owner of this field, which can be either a Library or a
1013 // Class. 1055 // Class.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1196
1155 A _Function_ represents a Dart language function. 1197 A _Function_ represents a Dart language function.
1156 1198
1157 ### Instance 1199 ### Instance
1158 1200
1159 ``` 1201 ```
1160 class @Instance extends @Object { 1202 class @Instance extends @Object {
1161 // What kind of instance is this? 1203 // What kind of instance is this?
1162 InstanceKind kind; 1204 InstanceKind kind;
1163 1205
1164 // Instance references include their class. 1206 // Instance references always include their class.
1165 @Class class; 1207 @Class class;
1166 1208
1167 // The value of this instance as a string. 1209 // The value of this instance as a string.
1168 // 1210 //
1169 // Provided for the instance kinds: 1211 // Provided for the instance kinds:
1170 // Null (null) 1212 // Null (null)
1171 // Bool (true or false) 1213 // Bool (true or false)
1172 // Double (suitable for passing to Double.parse()) 1214 // Double (suitable for passing to Double.parse())
1173 // Int (suitable for passing to int.parse()) 1215 // Int (suitable for passing to int.parse())
1174 // String (value may be truncated) 1216 // String (value may be truncated)
1175 string valueAsString [optional]; 1217 string valueAsString [optional];
1176 1218
1177 // The valueAsString for String references may be truncated. If so, 1219 // The valueAsString for String references may be truncated. If so,
1178 // this property is added with the value 'true'. 1220 // this property is added with the value 'true'.
1179 bool valueAsStringIsTruncated [optional]; 1221 bool valueAsStringIsTruncated [optional];
1180 1222
1181 // The length of a List instance. 1223 // The length of a List instance.
1182 // 1224 //
1183 // Provided for instance kinds: 1225 // Provided for instance kinds:
1184 // List 1226 // List
1185 int length [optional]; 1227 int length [optional];
1186 1228
1187 // The name of a Type instance. 1229 // The name of a Type instance.
(...skipping 16 matching lines...) Expand all
1204 } 1246 }
1205 ``` 1247 ```
1206 1248
1207 _@Instance_ is a reference to an _Instance_. 1249 _@Instance_ is a reference to an _Instance_.
1208 1250
1209 ``` 1251 ```
1210 class Instance extends Object { 1252 class Instance extends Object {
1211 // What kind of instance is this? 1253 // What kind of instance is this?
1212 InstanceKind kind; 1254 InstanceKind kind;
1213 1255
1214 // Instance references include their class. 1256 // Instance references always include their class.
1215 @Class class; 1257 @Class class;
1216 1258
1217 // The value of this instance as a string. 1259 // The value of this instance as a string.
1218 // 1260 //
1219 // Provided for the instance kinds: 1261 // Provided for the instance kinds:
1220 // Bool (true or false) 1262 // Bool (true or false)
1221 // Double (suitable for passing to Double.parse()) 1263 // Double (suitable for passing to Double.parse())
1222 // Int (suitable for passing to int.parse()) 1264 // Int (suitable for passing to int.parse())
1223 // String (value may be truncated) 1265 // String (value may be truncated)
1224 string valueAsString [optional]; 1266 string valueAsString [optional];
1225 1267
1226 // The valueAsString for String references may be truncated. If so, 1268 // The valueAsString for String references may be truncated. If so,
1227 // this property is added with the value 'true'. 1269 // this property is added with the value 'true'.
1228 bool valueAsStringIsTruncated [optional]; 1270 bool valueAsStringIsTruncated [optional];
1229 1271
1230 // The length of a List instance. 1272 // The length of a List instance.
1231 // 1273 //
1232 // Provided for instance kinds: 1274 // Provided for instance kinds:
1233 // List 1275 // List
1234 int length [optional]; 1276 int length [optional];
1235 1277
1236 // The name of a Type instance. 1278 // The name of a Type instance.
(...skipping 14 matching lines...) Expand all
1251 // TypeParameter 1293 // TypeParameter
1252 @Class parameterizedClass [optional]; 1294 @Class parameterizedClass [optional];
1253 1295
1254 // The fields of this Instance. 1296 // The fields of this Instance.
1255 BoundField fields [optional]; 1297 BoundField fields [optional];
1256 1298
1257 // The elements of a List instance. 1299 // The elements of a List instance.
1258 // 1300 //
1259 // Provided for instance kinds: 1301 // Provided for instance kinds:
1260 // List 1302 // List
1261 ListElement[] elements [optional]; 1303 @Instance|Sentinel[] elements [optional];
1262 1304
1263 // The elements of a List instance. 1305 // The elements of a List instance.
1264 // 1306 //
1265 // Provided for instance kinds: 1307 // Provided for instance kinds:
1266 // Map 1308 // Map
1267 MapAssociation[] associations [optional]; 1309 MapAssociation[] associations [optional];
1268 1310
1269 // The function associated with a Closure instance. 1311 // The function associated with a Closure instance.
1270 // 1312 //
1271 // Provided for instance kinds: 1313 // Provided for instance kinds:
(...skipping 30 matching lines...) Expand all
1302 // Type 1344 // Type
1303 @TypeArguments typeArguments [optional]; 1345 @TypeArguments typeArguments [optional];
1304 1346
1305 // The index of a TypeParameter instance. 1347 // The index of a TypeParameter instance.
1306 // 1348 //
1307 // Provided for instance kinds: 1349 // Provided for instance kinds:
1308 // TypeParameter 1350 // TypeParameter
1309 int parameterIndex [optional]; 1351 int parameterIndex [optional];
1310 1352
1311 // The type bounded by a BoundedType instance 1353 // The type bounded by a BoundedType instance
1312 // or 1354 // - or -
1313 // The referent of a TypeRef instance. 1355 // the referent of a TypeRef instance.
1314 // 1356 //
1315 // The value will always be one of: 1357 // The value will always be one of:
1316 // Type, TypeRef, TypeParameter, BoundedType. 1358 // Type, TypeRef, TypeParameter, BoundedType.
1317 // 1359 //
1318 // Provided for instance kinds: 1360 // Provided for instance kinds:
1319 // BoundedType 1361 // BoundedType
1320 // TypeRef 1362 // TypeRef
1321 @Instance type [optional]; 1363 @Instance targetType [optional];
1322 1364
1323 // The bound of a TypeParameter or BoundedType. 1365 // The bound of a TypeParameter or BoundedType.
1324 // 1366 //
1325 // The value will always be one of: 1367 // The value will always be one of:
1326 // Type, TypeRef, TypeParameter, BoundedType. 1368 // Type, TypeRef, TypeParameter, BoundedType.
1327 // 1369 //
1328 // Provided for instance kinds: 1370 // Provided for instance kinds:
1329 // BoundedType 1371 // BoundedType
1330 // TypeParameter 1372 // TypeParameter
1331 @Instance bound [optional]; 1373 @Instance bound [optional];
(...skipping 17 matching lines...) Expand all
1349 1391
1350 // An instance of the Dart class double. 1392 // An instance of the Dart class double.
1351 Double, 1393 Double,
1352 1394
1353 // An instance of the Dart class int. 1395 // An instance of the Dart class int.
1354 Int, 1396 Int,
1355 1397
1356 // An instance of the Dart class String. 1398 // An instance of the Dart class String.
1357 String, 1399 String,
1358 1400
1359 // An instance of the built-in VM List implementation. User-defined 1401 // An instance of the built-in VM List implementation. User-defined
1360 // Lists will be PlainInstance. 1402 // Lists will be PlainInstance.
1361 List, 1403 List,
1362 1404
1363 // An instance of the built-in VM Map implementation. User-defined 1405 // An instance of the built-in VM Map implementation. User-defined
1364 // Maps will be PlainInstance. 1406 // Maps will be PlainInstance.
1365 Map, 1407 Map,
1366 1408
1367 // An instance of the built-in VM Closure implementation. User-defined 1409 // An instance of the built-in VM Closure implementation. User-defined
1368 // Closures will be PlainInstance. 1410 // Closures will be PlainInstance.
1369 Closure, 1411 Closure,
1370 1412
1371 // An instance of the Dart class MirrorReference. 1413 // An instance of the Dart class MirrorReference.
1372 MirrorReference, 1414 MirrorReference,
1373 1415
1374 // An instance of the Dart class WeakProperty. 1416 // An instance of the Dart class WeakProperty.
1375 WeakProperty, 1417 WeakProperty,
1376 1418
1377 // An instance of the Dart class Type 1419 // An instance of the Dart class Type
1378 Type, 1420 Type,
1379 1421
1380 // An instance of the Dart class TypeParamer 1422 // An instance of the Dart class TypeParamer
1381 TypeParameter, 1423 TypeParameter,
1382 1424
1383 // An instance of the Dart class TypeRef 1425 // An instance of the Dart class TypeRef
1384 TypeRef, 1426 TypeRef,
1385 1427
1386 // An instance of the Dart class BoundedType 1428 // An instance of the Dart class BoundedType
1387 BoundedType, 1429 BoundedType,
1388 } 1430 }
1389 ``` 1431 ```
1390 1432
1391 Adding new values to _InstanceKind_ is considered a backwards 1433 Adding new values to _InstanceKind_ is considered a backwards
1392 compatible change. Clients should treat unrecognized instance kinds 1434 compatible change. Clients should treat unrecognized instance kinds
1393 as _PlainInstance_. 1435 as _PlainInstance_.
1394 1436
1395 ### Isolate 1437 ### Isolate
1396 1438
1397 ``` 1439 ```
1398 class @Isolate extends Response { 1440 class @Isolate extends Response {
1399 // The id which is passed to the getIsolate RPC to load this isolate. 1441 // The id which is passed to the getIsolate RPC to load this isolate.
1400 string id; 1442 string id;
1401 1443
1402 // A numeric id for this isolate, represented as a string. Unique. 1444 // A numeric id for this isolate, represented as a string. Unique.
1403 string number; 1445 string number;
1404 1446
1405 // A name identifying this isolate. Not guaranteed to be unique. 1447 // A name identifying this isolate. Not guaranteed to be unique.
1406 string name; 1448 string name;
1407 } 1449 }
1408 ``` 1450 ```
1409 1451
1410 _@Isolate_ is a reference to an _Isolate_ object. 1452 _@Isolate_ is a reference to an _Isolate_ object.
1411 1453
1412 ``` 1454 ```
1413 class Isolate extends Response { 1455 class Isolate extends Response {
1414 // The id which is passed to the getIsolate RPC to reload this 1456 // The id which is passed to the getIsolate RPC to reload this
1415 // isolate. 1457 // isolate.
1416 string id; 1458 string id;
1417 1459
1418 // A numeric id for this isolate, represented as a string. Unique. 1460 // A numeric id for this isolate, represented as a string. Unique.
1419 string number; 1461 string number;
1420 1462
1421 // A name identifying this isolate. Not guaranteed to be unique. 1463 // A name identifying this isolate. Not guaranteed to be unique.
1422 string name; 1464 string name;
1423 1465
1424 // The time that the VM started in milliseconds since the epoch. 1466 // The time that the VM started in milliseconds since the epoch.
1425 // 1467 //
1426 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch. 1468 // Suitable to pass to DateTime.fromMillisecondsSinceEpoch.
1427 int startTime; 1469 int startTime;
1428 1470
1429 // The entry function for this isolate. 1471 // The entry function for this isolate.
1430 @Function entry [optional]; 1472 @Function entry [optional];
1431 1473
1432 // The number of live ports for this isolate. 1474 // The number of live ports for this isolate.
1433 int livePorts; 1475 int livePorts;
1434 1476
1435 // Will this isolate pause when exiting? 1477 // Will this isolate pause when exiting?
1436 bool pauseOnExit; 1478 bool pauseOnExit;
1437 1479
1438 // The last pause event delivered to the isolate. If the isolate is 1480 // The last pause event delivered to the isolate. If the isolate is
1439 // running, this will be a resume event. 1481 // running, this will be a resume event.
1440 Event pauseEvent; 1482 Event pauseEvent;
1441 1483
1442 // The error that is causing this isolate to exit, if applicable. 1484 // The error that is causing this isolate to exit, if applicable.
1443 Error error [optional]; 1485 Error error [optional];
1444 1486
1445 // The root library for this isolate. 1487 // The root library for this isolate.
1446 @Library rootLib; 1488 @Library rootLib;
1447 1489
1448 // A list of all libraries for this isolate. 1490 // A list of all libraries for this isolate.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 // The prefix of an 'as' import, or null. 1556 // The prefix of an 'as' import, or null.
1515 String prefix; 1557 String prefix;
1516 1558
1517 // The library being imported or exported. 1559 // The library being imported or exported.
1518 @Library target; 1560 @Library target;
1519 } 1561 }
1520 ``` 1562 ```
1521 1563
1522 A _LibraryDependency_ provides information about an import or export. 1564 A _LibraryDependency_ provides information about an import or export.
1523 1565
1524 ### ListElement
1525
1526 ```
1527 class ListElement {
1528 int index;
1529 @Instance|Sentinel value;
1530 }
1531 ```
1532
1533 ### MapAssociation 1566 ### MapAssociation
1534 1567
1535 ``` 1568 ```
1536 class MapAssociation { 1569 class MapAssociation {
1537 @Instance|Sentinel key; 1570 @Instance|Sentinel key;
1538 @Instance|Sentinel value; 1571 @Instance|Sentinel value;
1539 } 1572 }
1540 ``` 1573 ```
1541 1574
1542 ### Message 1575 ### Message
(...skipping 26 matching lines...) Expand all
1569 string valueAsString; 1602 string valueAsString;
1570 } 1603 }
1571 ``` 1604 ```
1572 1605
1573 A _Null_ object represents the Dart language value null. 1606 A _Null_ object represents the Dart language value null.
1574 1607
1575 ### Object 1608 ### Object
1576 1609
1577 ``` 1610 ```
1578 class @Object extends Response { 1611 class @Object extends Response {
1579 // A unique identifier for an Object. Passed to the 1612 // A unique identifier for an Object. Passed to the
1580 // getObject RPC to load this Object. 1613 // getObject RPC to load this Object.
1581 string id 1614 string id
1582 } 1615 }
1583 ``` 1616 ```
1584 1617
1585 _@Object_ is a reference to a _Object_. 1618 _@Object_ is a reference to a _Object_.
1586 1619
1587 ``` 1620 ```
1588 class Object extends Response { 1621 class Object extends Response {
1589 // A unique identifier for an Object. Passed to the 1622 // A unique identifier for an Object. Passed to the
1590 // getObject RPC to reload this Object. 1623 // getObject RPC to reload this Object.
1591 // 1624 //
1592 // Some objects may get a new id when they are reloaded. 1625 // Some objects may get a new id when they are reloaded.
1593 string id; 1626 string id;
1594 1627
1595 // Every object has a corresponding Class in the VM. 1628 // If an object is allocated in the Dart heap, it will have
1596 @Class class; 1629 // a corresponding class object.
1630 //
1631 // The class of a non-instance is not a Dart class, but is instead
1632 // an internal vm object.
1633 //
1634 // Moving an Object into or out of the heap is considered a
1635 // backwards compatible change for types other than Instance.
1636 @Class class [optional];
1597 1637
1598 // The size of this object in the heap. 1638 // The size of this object in the heap.
1599 // 1639 //
1600 // Note that the size can be zero for some objects. 1640 // If an object is not heap-allocated, then this field is omitted.
1601 int size; 1641 //
1642 // Note that the size can be zero for some objects. In the current
1643 // VM implementation, this occurs for small integers, which are
1644 // stored entirely within their object pointers.
1645 int size [optional];
1602 } 1646 }
1603 ``` 1647 ```
1604 1648
1605 An _Object_ is a persistent object that is owned by some isolate. 1649 An _Object_ is a persistent object that is owned by some isolate.
1606 1650
1607 ### Sentinel 1651 ### Sentinel
1608 1652
1609 ``` 1653 ```
1610 class Sentinel extends Response { 1654 class Sentinel extends Response {
1611 // What kind of sentinel is this? 1655 // What kind of sentinel is this?
1612 SentinelKind kind; 1656 SentinelKind kind;
1613 1657
1614 // A reasonable string representation of this sentinel. 1658 // A reasonable string representation of this sentinel.
1615 string valueAsString; 1659 string valueAsString;
1616 } 1660 }
1617 ``` 1661 ```
1618 1662
1619 A _Sentinel_ is used to indicate that the normal response is not available. 1663 A _Sentinel_ is used to indicate that the normal response is not available.
1620 1664
1621 We use a _Sentinel_ instead of an [error](#errors) for these cases because 1665 We use a _Sentinel_ instead of an [error](#errors) for these cases because
1622 they do not represent a problematic condition. They are normal. 1666 they do not represent a problematic condition. They are normal.
1623 1667
1624 ### SentinelKind 1668 ### SentinelKind
1625 1669
1626 ``` 1670 ```
1627 enum SentinelKind { 1671 enum SentinelKind {
1628 // Indicates that the object referred to has been collected by the GC. 1672 // Indicates that the object referred to has been collected by the GC.
1629 Collected, 1673 Collected,
1630 1674
1631 // Indicates that an object id has expired. 1675 // Indicates that an object id has expired.
1632 Expired, 1676 Expired,
1633 1677
1634 // Indicates that a variable or field has not been initialized. 1678 // Indicates that a variable or field has not been initialized.
1635 NotInitialized, 1679 NotInitialized,
1636 1680
1637 // Indicates that a variable or field is in the process of being initialized. 1681 // Indicates that a variable or field is in the process of being initialized.
1638 BeingInitialized, 1682 BeingInitialized,
1639 1683
1640 // Indicates that a variable has been eliminated by the optimizing compiler. 1684 // Indicates that a variable has been eliminated by the optimizing compiler.
1641 OptimizedOut, 1685 OptimizedOut,
1642 1686
1643 // Reserved for future use. 1687 // Reserved for future use.
1644 Free, 1688 Free,
1645 } 1689 }
1646 ``` 1690 ```
1647 1691
1648 A _SentinelKind_ is used to distinguish different kinds of _Sentinel_ objects. 1692 A _SentinelKind_ is used to distinguish different kinds of _Sentinel_ objects.
1649 1693
1650 Adding new values to _SentinelKind_ is considered a backwards 1694 Adding new values to _SentinelKind_ is considered a backwards
1651 compatible change. Clients must handle this gracefully. 1695 compatible change. Clients must handle this gracefully.
1652 1696
1653 ### Script 1697 ### Script
1654 1698
1655 ``` 1699 ```
1656 class @Script extends @Object { 1700 class @Script extends @Object {
1657 // The uri from which this script was loaded. 1701 // The uri from which this script was loaded.
1658 string uri; 1702 string uri;
1659 } 1703 }
1660 ``` 1704 ```
1661 1705
1662 _@Script_ is a reference to a _Script_. 1706 _@Script_ is a reference to a _Script_.
1663 1707
1664 ``` 1708 ```
1665 class Script extends Object { 1709 class Script extends Object {
1666 // The uri from which this script was loaded. 1710 // The uri from which this script was loaded.
1667 string uri; 1711 string uri;
1668 1712
1669 // The library which owns this script. 1713 // The library which owns this script.
1670 @Library library; 1714 @Library library;
1671 1715
1672 // The source code for this script. For certain built-in scripts, 1716 // The source code for this script. For certain built-in scripts,
1673 // this may be reconstructed without source comments. 1717 // this may be reconstructed without source comments.
1674 string source; 1718 string source;
1675 1719
1676 // A table encoding a mapping from token position to line and column. 1720 // A table encoding a mapping from token position to line and column.
1677 int[][] tokenPosTable; 1721 int[][] tokenPosTable;
1678 } 1722 }
1679 ``` 1723 ```
1680 1724
1681 A _Script_ provides information about a Dart language script. 1725 A _Script_ provides information about a Dart language script.
1682 1726
1683 The _tokenPosTable_ is an array of int arrays. Each subarray 1727 The _tokenPosTable_ is an array of int arrays. Each subarray
1684 consists of a line number followed by _(tokenPos, columnNumber)_ pairs: 1728 consists of a line number followed by _(tokenPos, columnNumber)_ pairs:
1685 1729
1686 > [lineNumber, (tokenPos, columnNumber)*] 1730 > [lineNumber, (tokenPos, columnNumber)*]
1687 1731
1688 For example, a _tokenPosTable_ with the value... 1732 For example, a _tokenPosTable_ with the value...
1689 1733
1690 > [[1, 100, 5, 101, 8],[2, 102, 7]] 1734 > [[1, 100, 5, 101, 8],[2, 102, 7]]
1691 1735
1692 ...encodes the mapping: 1736 ...encodes the mapping:
1693 1737
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 ``` 1811 ```
1768 1812
1769 A _TypeArguments_ object represents the type argument vector for some 1813 A _TypeArguments_ object represents the type argument vector for some
1770 instantiated generic type. 1814 instantiated generic type.
1771 1815
1772 ### Response 1816 ### Response
1773 1817
1774 ``` 1818 ```
1775 class Response { 1819 class Response {
1776 // Every response returned by the VM Service has the 1820 // Every response returned by the VM Service has the
1777 // type property. This allows the client distinguish 1821 // type property. This allows the client distinguish
1778 // between different kinds of responses. 1822 // between different kinds of responses.
1779 string type; 1823 string type;
1780 } 1824 }
1781 ``` 1825 ```
1782 1826
1783 Every non-error response returned by the Service Protocol extends _Response_. 1827 Every non-error response returned by the Service Protocol extends _Response_.
1784 By using the _type_ property, the client can determine which [type](#types) 1828 By using the _type_ property, the client can determine which [type](#types)
1785 of response has been provided. 1829 of response has been provided.
1786 1830
1787 ### Version 1831 ### Version
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 1870
1827 // A list of isolates running in the VM. 1871 // A list of isolates running in the VM.
1828 @Isolate[] isolates 1872 @Isolate[] isolates
1829 } 1873 }
1830 ``` 1874 ```
1831 1875
1832 ## Revision History 1876 ## Revision History
1833 1877
1834 version | comments 1878 version | comments
1835 ------- | -------- 1879 ------- | --------
1836 0.0 | draft 1880 1.0 draft 1 | initial revision
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698