Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Dart VM Service Protocol 3.0 | 1 # Dart VM Service Protocol 3.1 |
| 2 | 2 |
| 3 > Please post feedback to the [observatory-discuss group][discuss-list] | 3 > Please post feedback to the [observatory-discuss group][discuss-list] |
| 4 | 4 |
| 5 This document describes of _version 3.0_ of the Dart VM Service Protocol. This | 5 This document describes of _version 3.1_ of the Dart VM Service Protocol. This |
| 6 protocol is used to communicate with a running Dart Virtual Machine. | 6 protocol is used to communicate with a running Dart Virtual Machine. |
| 7 | 7 |
| 8 To use the Service Protocol, start the VM with the *--observe* flag. | 8 To use the Service Protocol, start the VM with the *--observe* flag. |
| 9 The VM will start a webserver which services protocol requests via WebSocket. | 9 The VM will start a webserver which services protocol requests via WebSocket. |
| 10 It is possible to make HTTP (non-WebSocket) requests, | 10 It is possible to make HTTP (non-WebSocket) requests, |
| 11 but this does not allow access to VM _events_ and is not documented | 11 but this does not allow access to VM _events_ and is not documented |
| 12 here. | 12 here. |
| 13 | 13 |
| 14 The Service Protocol uses [JSON-RPC 2.0][]. | 14 The Service Protocol uses [JSON-RPC 2.0][]. |
| 15 | 15 |
| 16 [JSON-RPC 2.0]: http://www.jsonrpc.org/specification | 16 [JSON-RPC 2.0]: http://www.jsonrpc.org/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) |
| 25 - [Private RPCs, Types, and Properties](#private-rpcs-types-and-properties) | 25 - [Private RPCs, Types, and Properties](#private-rpcs-types-and-properties) |
| 26 - [Public RPCs](#public-rpcs) | 26 - [Public RPCs](#public-rpcs) |
| 27 - [addBreakpoint](#addbreakpoint) | 27 - [addBreakpoint](#addbreakpoint) |
| 28 - [addBreakpointWithScriptUri](#addbreakpointwithscripturi) | 28 - [addBreakpointWithScriptUri](#addbreakpointwithscripturi) |
| 29 - [addBreakpointAtEntry](#addbreakpointatentry) | 29 - [addBreakpointAtEntry](#addbreakpointatentry) |
| 30 - [evaluate](#evaluate) | 30 - [evaluate](#evaluate) |
| 31 - [evaluateInFrame](#evaluateinframe) | 31 - [evaluateInFrame](#evaluateinframe) |
| 32 - [getFlagList](#getflaglist) | 32 - [getFlagList](#getflaglist) |
| 33 - [getIsolate](#getisolate) | 33 - [getIsolate](#getisolate) |
| 34 - [getObject](#getobject) | 34 - [getObject](#getobject) |
| 35 - [getSourceReport](#getsourcereport) | |
| 35 - [getStack](#getstack) | 36 - [getStack](#getstack) |
| 36 - [getVersion](#getversion) | 37 - [getVersion](#getversion) |
| 37 - [getVM](#getvm) | 38 - [getVM](#getvm) |
| 38 - [pause](#pause) | 39 - [pause](#pause) |
| 39 - [removeBreakpoint](#removebreakpoint) | 40 - [removeBreakpoint](#removebreakpoint) |
| 40 - [resume](#resume) | 41 - [resume](#resume) |
| 41 - [setExceptionPauseMode](#setexceptionpausemode) | 42 - [setExceptionPauseMode](#setexceptionpausemode) |
| 42 - [setLibraryDebuggable](#setlibrarydebuggable) | 43 - [setLibraryDebuggable](#setlibrarydebuggable) |
| 43 - [setName](#setname) | 44 - [setName](#setname) |
| 44 - [setVMName](#setvmname) | 45 - [setVMName](#setvmname) |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 70 - [LibraryDependency](#librarydependency) | 71 - [LibraryDependency](#librarydependency) |
| 71 - [MapAssociation](#mapassociation) | 72 - [MapAssociation](#mapassociation) |
| 72 - [Message](#message) | 73 - [Message](#message) |
| 73 - [Null](#null) | 74 - [Null](#null) |
| 74 - [Object](#object) | 75 - [Object](#object) |
| 75 - [Response](#response) | 76 - [Response](#response) |
| 76 - [Sentinel](#sentinel) | 77 - [Sentinel](#sentinel) |
| 77 - [SentinelKind](#sentinelkind) | 78 - [SentinelKind](#sentinelkind) |
| 78 - [Script](#script) | 79 - [Script](#script) |
| 79 - [SourceLocation](#sourcelocation) | 80 - [SourceLocation](#sourcelocation) |
| 81 - [SourceReport](#sourcereport) | |
| 82 - [SourceReportCoverage](#sourcereportcoverage) | |
| 83 - [SourceReportKind](#sourcereportkind) | |
| 84 - [SourceReportRange](#sourcereportrange) | |
| 80 - [Stack](#stack) | 85 - [Stack](#stack) |
| 81 - [StepOption](#stepoption) | 86 - [StepOption](#stepoption) |
| 82 - [Success](#success) | 87 - [Success](#success) |
| 83 - [TypeArguments](#typearguments) | 88 - [TypeArguments](#typearguments) |
| 84 - [UresolvedSourceLocation](#unresolvedsourcelocation) | 89 - [UresolvedSourceLocation](#unresolvedsourcelocation) |
| 85 - [Version](#version) | 90 - [Version](#version) |
| 86 - [VM](#vm) | 91 - [VM](#vm) |
| 87 - [Revision History](#revision-history) | 92 - [Revision History](#revision-history) |
| 88 | 93 |
| 89 ## RPCs, Requests, and Responses | 94 ## RPCs, Requests, and Responses |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 | 565 |
| 561 ``` | 566 ``` |
| 562 Stack getStack(string isolateId) | 567 Stack getStack(string isolateId) |
| 563 ``` | 568 ``` |
| 564 | 569 |
| 565 The _getStack_ RPC is used to retrieve the current execution stack and | 570 The _getStack_ RPC is used to retrieve the current execution stack and |
| 566 message queue for an isolate. The isolate does not need to be paused. | 571 message queue for an isolate. The isolate does not need to be paused. |
| 567 | 572 |
| 568 See [Stack](#stack). | 573 See [Stack](#stack). |
| 569 | 574 |
| 575 ### getSourceReport | |
| 576 | |
| 577 ``` | |
| 578 SourceReport getSourceReport(string isolateId, | |
| 579 SourceReportKind[] reports, | |
| 580 string scriptId [optional], | |
| 581 int tokenPos [optional], | |
| 582 int endTokenPos [optional], | |
| 583 bool forceCompile [optional]) | |
| 584 ``` | |
| 585 | |
| 586 The _getSourceReport_ RPC is used to generate a set of reports tied to | |
| 587 source locations in an isolate. | |
| 588 | |
| 589 The _reports_ parameter is used to specify which reports should be | |
| 590 generated. The _reports_ parameter is a list, which allows multiple | |
| 591 reports to be generated simultaneously from a consistent isolate | |
| 592 state. The _reports_ parameter is allowed to be empty (this might be | |
| 593 used to force compilation of a particular subrange of some script). | |
| 594 | |
| 595 The available report kinds are: | |
| 596 | |
| 597 report kind | meaning | |
| 598 ----------- | ------- | |
| 599 Coverage | Provide code coverage information | |
| 600 PossibleBreakpoints | Provide a list of token positions which correspond to poss ible breakpoints. | |
| 601 | |
| 602 The _scriptId_ parameter is used to restrict the report to a | |
| 603 particular script. When analyzing a particular script, either or both | |
| 604 of the _tokenPos_ and _endTokenPos_ parameters may be provided to | |
| 605 restrict the analysis to a subrange of a script (for example, these | |
| 606 can be used to restrict the report to the range of a particular class | |
| 607 or function). | |
| 608 | |
| 609 If the _scriptId_ parameter is not provided then the reports are | |
| 610 generated for all loaded scripts and the _tokenPos_ and _endTokenPos_ | |
| 611 parameters are disallowed. | |
| 612 | |
| 613 The _forceCompilation_ parameter can be used to force compilation of | |
| 614 all functions in the range of the report. Forcing compilation can | |
| 615 have semantic side effects on the running Dart program. If this | |
|
rmacnak
2016/01/28 21:45:09
Consider specifically mentions early termination f
| |
| 616 parameter is not provided, it is considered to have the value _false_. | |
| 617 | |
| 618 See [SourceReport](#sourcereport). | |
| 619 | |
| 570 ### getVersion | 620 ### getVersion |
| 571 | 621 |
| 572 ``` | 622 ``` |
| 573 Version getVersion() | 623 Version getVersion() |
| 574 ``` | 624 ``` |
| 575 | 625 |
| 576 The _getVersion_ RPC is used to determine what version of the Service Protocol i s served by a VM. | 626 The _getVersion_ RPC is used to determine what version of the Service Protocol i s served by a VM. |
| 577 | 627 |
| 578 See [Version](#version). | 628 See [Version](#version). |
| 579 | 629 |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2142 int tokenPos; | 2192 int tokenPos; |
| 2143 | 2193 |
| 2144 // The last token of the location if this is a range. | 2194 // The last token of the location if this is a range. |
| 2145 int endTokenPos [optional]; | 2195 int endTokenPos [optional]; |
| 2146 } | 2196 } |
| 2147 ``` | 2197 ``` |
| 2148 | 2198 |
| 2149 The _SourceLocation_ class is used to designate a position or range in | 2199 The _SourceLocation_ class is used to designate a position or range in |
| 2150 some script. | 2200 some script. |
| 2151 | 2201 |
| 2202 ### SourceReport | |
| 2203 | |
| 2204 ``` | |
| 2205 class SourceReport extends Response { | |
| 2206 // A list of ranges in the program source. These ranges correspond | |
| 2207 // to ranges of executable code in the user's program (functions, | |
| 2208 // methods, constructors, etc.) | |
| 2209 // | |
| 2210 // Note that ranges may nest in other ranges, in the case of nested | |
| 2211 // functions. | |
| 2212 // | |
| 2213 // Note that ranges may be duplicated, in the case of mixins. | |
| 2214 SourceReportRange[] ranges; | |
| 2215 | |
| 2216 // A list of scripts, referenced by index in the report's ranges. | |
| 2217 ScriptRef[] scripts; | |
| 2218 } | |
| 2219 ``` | |
| 2220 | |
| 2221 The _SourceReport_ class represents a set of reports tied to source | |
| 2222 locations in an isolate. | |
| 2223 | |
| 2224 ### SourceReportCoverage | |
| 2225 | |
| 2226 ``` | |
| 2227 class SourceReportCoverage { | |
| 2228 // A list of token positions in a SourceReportRange which have been | |
| 2229 // executed. The list is sorted. | |
| 2230 int[] hits; | |
| 2231 | |
| 2232 // A list of token positions in a SourceReportRange which have not been | |
| 2233 // executed. The list is sorted. | |
| 2234 int[] misses; | |
| 2235 } | |
| 2236 ``` | |
| 2237 | |
| 2238 The _SourceReportCoverage_ class represents coverage information for | |
| 2239 one [SourceReportRange](#sourcereportrange). | |
| 2240 | |
| 2241 Note that _SourceReportCoverage_ does not extend [Response](#response) | |
| 2242 and therefore will not contain a _type_ property. | |
| 2243 | |
| 2244 ### SourceReportKind | |
| 2245 | |
| 2246 ``` | |
| 2247 enum SourceReportKind { | |
| 2248 // Used to request a code coverage information. | |
| 2249 Coverage, | |
| 2250 | |
| 2251 // Used to request a list of token positions of possible breakpoints. | |
| 2252 PossibleBreakpoints | |
| 2253 } | |
| 2254 ``` | |
| 2255 | |
| 2256 ### SourceReportRange | |
| 2257 | |
| 2258 ``` | |
| 2259 class SourceReportRange { | |
| 2260 // An index into the script table of the SourceReport, indicating | |
| 2261 // which script contains this range of code. | |
| 2262 int scriptIndex; | |
| 2263 | |
| 2264 // The token position at which this range begins. | |
| 2265 int startPos; | |
| 2266 | |
| 2267 // The token position at which this range ends. Inclusive. | |
| 2268 int endPos; | |
| 2269 | |
| 2270 // Has this range been compiled by the Dart VM? | |
| 2271 bool compiled; | |
| 2272 | |
| 2273 // Code coverage information for this range. Provided only when the | |
| 2274 // Coverage report has been requested and the range has been | |
| 2275 // compiled. | |
| 2276 SourceReportCoverage coverage [optional]; | |
| 2277 | |
| 2278 // Possible breakpoint information for this range, represented as a | |
| 2279 // sorted list of token positions. Provided only when the when the | |
| 2280 // PossibleBreakpoint report has been requested and the range has been | |
| 2281 // compiled. | |
| 2282 int possibleBreakpoints[] [optional]; | |
| 2283 } | |
| 2284 ``` | |
| 2285 | |
| 2286 The _SourceReportRange_ class represents a range of executable code | |
| 2287 (function, method, constructor, etc) in the running program. It is | |
| 2288 part of a [SourceReport](#sourcereport). | |
| 2289 | |
| 2290 Note that _SourceReportRange_ does not extend [Response](#response) | |
| 2291 and therefore will not contain a _type_ property. | |
| 2292 | |
| 2152 ### Stack | 2293 ### Stack |
| 2153 | 2294 |
| 2154 ``` | 2295 ``` |
| 2155 class Stack extends Response { | 2296 class Stack extends Response { |
| 2156 Frame[] frames; | 2297 Frame[] frames; |
| 2157 Message[] messages; | 2298 Message[] messages; |
| 2158 } | 2299 } |
| 2159 ``` | 2300 ``` |
| 2160 | 2301 |
| 2161 ### ExceptionPauseMode | 2302 ### ExceptionPauseMode |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2310 } | 2451 } |
| 2311 ``` | 2452 ``` |
| 2312 | 2453 |
| 2313 ## Revision History | 2454 ## Revision History |
| 2314 | 2455 |
| 2315 version | comments | 2456 version | comments |
| 2316 ------- | -------- | 2457 ------- | -------- |
| 2317 1.0 | initial revision | 2458 1.0 | initial revision |
| 2318 2.0 | Describe protocol version 2.0. | 2459 2.0 | Describe protocol version 2.0. |
| 2319 3.0 | Describe protocol version 3.0. Added UnresolvedSourceLocation. Added Sen tinel return to getIsolate. Add AddedBreakpointWithScriptUri. Removed Isolate. entry. The type of VM.pid was changed from string to int. Added VMUpdate events . Add offset and count parameters to getObject() and offset and count fields to Instance. Added ServiceExtensionAdded event. | 2460 3.0 | Describe protocol version 3.0. Added UnresolvedSourceLocation. Added Sen tinel return to getIsolate. Add AddedBreakpointWithScriptUri. Removed Isolate. entry. The type of VM.pid was changed from string to int. Added VMUpdate events . Add offset and count parameters to getObject() and offset and count fields to Instance. Added ServiceExtensionAdded event. |
| 2461 3.1 | Add the getSourceReport RPC. | |
| 2320 | 2462 |
| 2321 | 2463 |
| 2322 [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observato ry-discuss | 2464 [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observato ry-discuss |
| OLD | NEW |