OLD | NEW |
1 # Dart VM Service Protocol 0.0 | 1 # Dart VM Service Protocol 0.0 |
2 | 2 |
3 This document describes _version 0.0_ of the Dart VM Service Protocol. | 3 This document describes _version 0.0_ of the Dart VM Service Protocol. |
4 This protocol is used to communicate with a running Dart Virtual | 4 This protocol is used to communicate with a running Dart Virtual |
5 Machine. | 5 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 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
(...skipping 29 matching lines...) Expand all Loading... |
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]; |
(...skipping 26 matching lines...) Expand all Loading... |
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 Loading... |
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 // |
| 1355 // The value will always be one of: |
| 1356 // Type, TypeRef, TypeParameter, BoundedType. |
| 1357 // |
| 1358 // Provided for instance kinds: |
| 1359 // BoundedType |
| 1360 @Instance boundedType [optional]; |
| 1361 |
1313 // The referent of a TypeRef instance. | 1362 // The referent of a TypeRef instance. |
1314 // | 1363 // |
1315 // The value will always be one of: | 1364 // The value will always be one of: |
1316 // Type, TypeRef, TypeParameter, BoundedType. | 1365 // Type, TypeRef, TypeParameter, BoundedType. |
1317 // | 1366 // |
1318 // Provided for instance kinds: | 1367 // Provided for instance kinds: |
1319 // BoundedType | 1368 // BoundedType |
1320 // TypeRef | 1369 // TypeRef |
1321 @Instance type [optional]; | 1370 @Instance referentType [optional]; |
1322 | 1371 |
1323 // The bound of a TypeParameter or BoundedType. | 1372 // The bound of a TypeParameter or BoundedType. |
1324 // | 1373 // |
1325 // The value will always be one of: | 1374 // The value will always be one of: |
1326 // Type, TypeRef, TypeParameter, BoundedType. | 1375 // Type, TypeRef, TypeParameter, BoundedType. |
1327 // | 1376 // |
1328 // Provided for instance kinds: | 1377 // Provided for instance kinds: |
1329 // BoundedType | 1378 // BoundedType |
1330 // TypeParameter | 1379 // TypeParameter |
1331 @Instance bound [optional]; | 1380 @Instance bound [optional]; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 // The prefix of an 'as' import, or null. | 1563 // The prefix of an 'as' import, or null. |
1515 String prefix; | 1564 String prefix; |
1516 | 1565 |
1517 // The library being imported or exported. | 1566 // The library being imported or exported. |
1518 @Library target; | 1567 @Library target; |
1519 } | 1568 } |
1520 ``` | 1569 ``` |
1521 | 1570 |
1522 A _LibraryDependency_ provides information about an import or export. | 1571 A _LibraryDependency_ provides information about an import or export. |
1523 | 1572 |
1524 ### ListElement | |
1525 | |
1526 ``` | |
1527 class ListElement { | |
1528 int index; | |
1529 @Instance|Sentinel value; | |
1530 } | |
1531 ``` | |
1532 | |
1533 ### MapAssociation | 1573 ### MapAssociation |
1534 | 1574 |
1535 ``` | 1575 ``` |
1536 class MapAssociation { | 1576 class MapAssociation { |
1537 @Instance|Sentinel key; | 1577 @Instance|Sentinel key; |
1538 @Instance|Sentinel value; | 1578 @Instance|Sentinel value; |
1539 } | 1579 } |
1540 ``` | 1580 ``` |
1541 | 1581 |
1542 ### Message | 1582 ### Message |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 _@Object_ is a reference to a _Object_. | 1625 _@Object_ is a reference to a _Object_. |
1586 | 1626 |
1587 ``` | 1627 ``` |
1588 class Object extends Response { | 1628 class Object extends Response { |
1589 // A unique identifier for an Object. Passed to the | 1629 // A unique identifier for an Object. Passed to the |
1590 // getObject RPC to reload this Object. | 1630 // getObject RPC to reload this Object. |
1591 // | 1631 // |
1592 // Some objects may get a new id when they are reloaded. | 1632 // Some objects may get a new id when they are reloaded. |
1593 string id; | 1633 string id; |
1594 | 1634 |
1595 // Every object has a corresponding Class in the VM. | 1635 // If an object is allocated in the Dart heap, it will have |
1596 @Class class; | 1636 // a corresponding class object. |
| 1637 // |
| 1638 // The class of a non-instance is not a Dart class, but is instead |
| 1639 // an internal vm object. |
| 1640 // |
| 1641 // Moving an Object into or out of the heap is considered a |
| 1642 // backwards compatible change for types other than Instance. |
| 1643 @Class class [optional]; |
1597 | 1644 |
1598 // The size of this object in the heap. | 1645 // The size of this object in the heap. |
1599 // | 1646 // |
1600 // Note that the size can be zero for some objects. | 1647 // If an object is not heap-allocated, then this field is omitted. |
1601 int size; | 1648 // |
| 1649 // Note that the size can be zero for some objects. In the current |
| 1650 // VM implementation, this occurs for small integers, which are |
| 1651 // stored entirely within their object pointers. |
| 1652 int size [optional]; |
1602 } | 1653 } |
1603 ``` | 1654 ``` |
1604 | 1655 |
1605 An _Object_ is a persistent object that is owned by some isolate. | 1656 An _Object_ is a persistent object that is owned by some isolate. |
1606 | 1657 |
1607 ### Sentinel | 1658 ### Sentinel |
1608 | 1659 |
1609 ``` | 1660 ``` |
1610 class Sentinel extends Response { | 1661 class Sentinel extends Response { |
1611 // What kind of sentinel is this? | 1662 // What kind of sentinel is this? |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 // A list of isolates running in the VM. | 1878 // A list of isolates running in the VM. |
1828 @Isolate[] isolates | 1879 @Isolate[] isolates |
1829 } | 1880 } |
1830 ``` | 1881 ``` |
1831 | 1882 |
1832 ## Revision History | 1883 ## Revision History |
1833 | 1884 |
1834 version | comments | 1885 version | comments |
1835 ------- | -------- | 1886 ------- | -------- |
1836 0.0 | draft | 1887 0.0 | draft |
OLD | NEW |