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

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

Issue 1162133002: Introduce Instance.kind. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: regis feedback 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/report_test.cc ('k') | runtime/vm/service_test.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 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 24 matching lines...) Expand all
35 - [getVersion](#getversion) 35 - [getVersion](#getversion)
36 - [getVM](#getvm) 36 - [getVM](#getvm)
37 - [pause](#pause) 37 - [pause](#pause)
38 - [removeBreakpoint](#removebreakpoint) 38 - [removeBreakpoint](#removebreakpoint)
39 - [resume](#resume) 39 - [resume](#resume)
40 - [setName](#setname) 40 - [setName](#setname)
41 - [setLibraryDebuggable](#setlibrarydebuggable) 41 - [setLibraryDebuggable](#setlibrarydebuggable)
42 - [streamCancel](#streamcancel) 42 - [streamCancel](#streamcancel)
43 - [streamListen](#streamlisten) 43 - [streamListen](#streamlisten)
44 - [Public Types](#public-types) 44 - [Public Types](#public-types)
45 - [Bool](#bool)
46 - [BoundField](#boundfield) 45 - [BoundField](#boundfield)
47 - [BoundVariable](#boundvariable) 46 - [BoundVariable](#boundvariable)
48 - [Breakpoint](#breakpoint) 47 - [Breakpoint](#breakpoint)
49 - [Class](#class) 48 - [Class](#class)
50 - [ClassList](#classlist) 49 - [ClassList](#classlist)
51 - [Code](#code) 50 - [Code](#code)
52 - [CodeKind](#codekind) 51 - [CodeKind](#codekind)
53 - [Double](#double)
54 - [Error](#error) 52 - [Error](#error)
55 - [Event](#event) 53 - [Event](#event)
56 - [EventKind](#eventkind) 54 - [EventKind](#eventkind)
57 - [Field](#field) 55 - [Field](#field)
58 - [Flag](#flag) 56 - [Flag](#flag)
59 - [FlagList](#flaglist) 57 - [FlagList](#flaglist)
60 - [Frame](#frame) 58 - [Frame](#frame)
61 - [Function](#function) 59 - [Function](#function)
62 - [Instance](#instance) 60 - [Instance](#instance)
63 - [Int](#int)
64 - [Isolate](#isolate) 61 - [Isolate](#isolate)
65 - [Library](#library) 62 - [Library](#library)
66 - [LibraryDependency](#librarydependency) 63 - [LibraryDependency](#librarydependency)
67 - [List](#list)
68 - [ListElement](#listelement) 64 - [ListElement](#listelement)
69 - [Message](#message) 65 - [Message](#message)
70 - [Null](#null) 66 - [Null](#null)
71 - [Object](#object) 67 - [Object](#object)
72 - [Sentinel](#sentinel) 68 - [Sentinel](#sentinel)
73 - [SentinelKind](#sentinelkind) 69 - [SentinelKind](#sentinelkind)
74 - [Script](#script) 70 - [Script](#script)
75 - [Stack](#stack) 71 - [Stack](#stack)
76 - [StepOption](#stepoption) 72 - [StepOption](#stepoption)
77 - [String](#string)
78 - [Success](#success) 73 - [Success](#success)
79 - [Type](#type)
80 - [TypeArguments](#typearguments) 74 - [TypeArguments](#typearguments)
81 - [Response](#response) 75 - [Response](#response)
82 - [Version](#version) 76 - [Version](#version)
83 - [VM](#vm) 77 - [VM](#vm)
84 - [Revision History](#revision-history) 78 - [Revision History](#revision-history)
85 79
86 ## RPCs, Requests, and Responses 80 ## RPCs, Requests, and Responses
87 81
88 An RPC request is a JSON object sent to the server. Here is an 82 An RPC request is a JSON object sent to the server. Here is an
89 example [getVersion](#getversion) request: 83 example [getVersion](#getversion) request:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ``` 293 ```
300 294
301 The major version number is incremented when the protocol is changed 295 The major version number is incremented when the protocol is changed
302 in a potentially _incompatible_ way. An example of an incompatible 296 in a potentially _incompatible_ way. An example of an incompatible
303 change is removing a non-optional property from a result. 297 change is removing a non-optional property from a result.
304 298
305 The minor version number is incremented when the protocol is changed 299 The minor version number is incremented when the protocol is changed
306 in a _backwards compatible_ way. An example of a backwards compatible 300 in a _backwards compatible_ way. An example of a backwards compatible
307 change is adding a property to a result. 301 change is adding a property to a result.
308 302
303 Certain changes that would normally not be backwards compatible are
304 considered backwards compatible for the purposes of versioning.
305 Specifically, additions can be made to the [EventKind](#eventkind) and
306 [InstanceKind](#instancekind) enumerated types and the client must
307 handle this gracefully. See the notes on these enumerated types for more
308 information.
309
309 ## Private RPCs, Types, and Properties 310 ## Private RPCs, Types, and Properties
310 311
311 Any RPC, type, or property which begins with an underscore is said to 312 Any RPC, type, or property which begins with an underscore is said to
312 be _private_. These RPCs, types, and fields can be changed at any 313 be _private_. These RPCs, types, and fields can be changed at any
313 time without changing major or minor version numbers. 314 time without changing major or minor version numbers.
314 315
315 The intention is that the Service Protocol will evolve by adding 316 The intention is that the Service Protocol will evolve by adding
316 private RPCs which may, over time, migrate to the public api as they 317 private RPCs which may, over time, migrate to the public api as they
317 become stable. Some private types and properties expose VM specific 318 become stable. Some private types and properties expose VM specific
318 implementation state and will never be appropriate to add to 319 implementation state and will never be appropriate to add to
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 ``` 686 ```
686 enum PermittedValues { 687 enum PermittedValues {
687 Value1, 688 Value1,
688 Value2 689 Value2
689 } 690 }
690 ``` 691 ```
691 692
692 This means that _PermittedValues_ is a _string_ with two potential values, 693 This means that _PermittedValues_ is a _string_ with two potential values,
693 _Value1_ and _Value2_. 694 _Value1_ and _Value2_.
694 695
695 ### Bool
696
697 ```
698 class @Bool extends @Instance {
699 // The value of this bool as a string, either 'true' or 'false'.
700 string valueAsString;
701 }
702 ```
703
704 _@Bool_ is a reference to a _Bool_.
705
706 ```
707 class Bool extends Instance {
708 // The value of this bool as a string, either 'true' or 'false'.
709 string valueAsString;
710 }
711 ```
712
713 An _Bool_ represents an instance of the Dart language class _bool_.
714
715 ### BoundField 696 ### BoundField
716 697
717 ``` 698 ```
718 class BoundField { 699 class BoundField {
719 @Field decl; 700 @Field decl;
720 @Instance|Sentinel value; 701 @Instance|Sentinel value;
721 } 702 }
722 ``` 703 ```
723 704
724 A _BoundField_ represents a field bound to a particular value in an 705 A _BoundField_ represents a field bound to a particular value in an
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 ``` 846 ```
866 enum CodeKind { 847 enum CodeKind {
867 Dart, 848 Dart,
868 Native, 849 Native,
869 Stub, 850 Stub,
870 Tag, 851 Tag,
871 Collected 852 Collected
872 } 853 }
873 ``` 854 ```
874 855
875 ### Double 856 ### Context
876 857
877 ``` 858 ```
878 class @Double extends @Instance { 859 class @Context {
879 // The value of this double as a string. 860 // The number of variables in this context.
880 // 861 int length;
881 // Suitable for passing to double.parse().
882 string valueAsString;
883 } 862 }
884 ``` 863 ```
885 864
886 _@Double_ is a reference to a _Double_. 865 ```
866 class Context {
867 // The number of variables in this context.
868 int length;
887 869
888 ``` 870 // The variables in this context object.
889 class Double extends Instance { 871 ListElement[] variables;
890 // The value of this double as a string.
891 //
892 // Suitable for passing to double.parse().
893 string valueAsString;
894 } 872 }
895 ``` 873 ```
896 874
897 A _Double_ represents an instance of the Dart language class _double_.
898
899 ### Error 875 ### Error
900 876
901 ``` 877 ```
902 class @Error extends @Object { 878 class @Error extends @Object {
903 // A description of the error. 879 // A description of the error.
904 string message; 880 string message;
905 } 881 }
906 ``` 882 ```
907 883
908 _@Error_ is a reference to an _Error_. 884 _@Error_ is a reference to an _Error_.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 @Code code [optional]; 1156 @Code code [optional];
1181 } 1157 }
1182 ``` 1158 ```
1183 1159
1184 A _Function_ represents a Dart language function. 1160 A _Function_ represents a Dart language function.
1185 1161
1186 ### Instance 1162 ### Instance
1187 1163
1188 ``` 1164 ```
1189 class @Instance extends @Object { 1165 class @Instance extends @Object {
1166 // What kind of instance is this?
1167 InstanceKind kind;
1168
1190 // Instance references include their class. 1169 // Instance references include their class.
1191 @Class class; 1170 @Class class;
1171
1172 // The value of this instance as a string.
1173 //
1174 // Provided for the instance kinds:
1175 // Null (null)
1176 // Bool (true or false)
1177 // Double (suitable for passing to Double.parse())
1178 // Int (suitable for passing to int.parse())
1179 // String (value may be truncated)
1180 string valueAsString [optional];
1181
1182 // The valueAsString for String references may be truncated. If so,
1183 // this property is added with the value 'true'.
1184 bool valueAsStringIsTruncated [optional];
1185
1186 // The length of a List instance.
1187 //
1188 // Provided for instance kinds:
1189 // List
1190 int length [optional];
1191
1192 // The name of a Type instance.
1193 //
1194 // Provided for instance kinds:
1195 // Type
1196 string name [optional];
1197
1198 // The corresponding Class if this Type is canonical.
1199 //
1200 // Provided for instance kinds:
1201 // Type
1202 @Class typeClass [optional];
1203
1204 // The parameterized class of a type parameter:
1205 //
1206 // Provided for instance kinds:
1207 // TypeParameter
1208 @Class parameterizedClass [optional];
1192 } 1209 }
1193 ``` 1210 ```
1194 1211
1195 _@Instance_ is a reference to an _Instance_. 1212 _@Instance_ is a reference to an _Instance_.
1196 1213
1197 ``` 1214 ```
1198 class Instance extends Object { 1215 class Instance extends Object {
1216 // What kind of instance is this?
1217 InstanceKind kind;
1218
1219 // Instance references include their class.
1220 @Class class;
1221
1222 // The value of this instance as a string.
1223 //
1224 // Provided for the instance kinds:
1225 // Bool (true or false)
1226 // Double (suitable for passing to Double.parse())
1227 // Int (suitable for passing to int.parse())
1228 // String (value may be truncated)
1229 string valueAsString [optional];
1230
1231 // The valueAsString for String references may be truncated. If so,
1232 // this property is added with the value 'true'.
1233 bool valueAsStringIsTruncated [optional];
1234
1235 // The length of a List instance.
1236 //
1237 // Provided for instance kinds:
1238 // List
1239 int length [optional];
1240
1241 // The name of a Type instance.
1242 //
1243 // Provided for instance kinds:
1244 // Type
1245 string name [optional];
1246
1247 // The corresponding Class if this Type is canonical.
1248 //
1249 // Provided for instance kinds:
1250 // Type
1251 @Class typeClass [optional];
1252
1253 // The parameterized class of a type parameter:
1254 //
1255 // Provided for instance kinds:
1256 // TypeParameter
1257 @Class parameterizedClass [optional];
1258
1259 // The fields of this Instance.
1199 BoundField fields [optional]; 1260 BoundField fields [optional];
1261
1262 // The elements of a List instance.
1263 //
1264 // Provided for instance kinds:
1265 // List
1266 ListElement[] elements [optional];
1267
1268 // The function associated with a Closure instance.
1269 //
1270 // Provided for instance kinds:
1271 // Closure
1272 @Function closureFunction [optional];
1273
1274 // The context associated with a Closure instance.
1275 //
1276 // Provided for instance kinds:
1277 // Closure
1278 @Function closureContext [optional];
1279
1280 // The referent of a MirrorReference instance.
1281 //
1282 // Provided for instance kinds:
1283 // MirrorReference
1284 @Instance mirrorReferent [optional];
1285
1286 // The key for a WeakProperty instance.
1287 //
1288 // Provided for instance kinds:
1289 // WeakProperty
1290 @Instance propertyKey [optional];
1291
1292 // The key for a WeakProperty instance.
1293 //
1294 // Provided for instance kinds:
1295 // WeakProperty
1296 @Instance propertyValue [optional];
1297
1298 // The type arguments for this type.
1299 //
1300 // Provided for instance kinds:
1301 // Type
1302 @TypeArguments typeArguments [optional];
1303
1304 // The index of a TypeParameter instance.
1305 //
1306 // Provided for instance kinds:
1307 // TypeParameter
1308 int parameterIndex [optional];
1309
1310 // The type bounded by a BoundedType instance
1311 // or
1312 // The referent of a TypeRef instance.
1313 //
1314 // The value will always be one of:
1315 // Type, TypeRef, TypeParameter, BoundedType.
1316 //
1317 // Provided for instance kinds:
1318 // BoundedType
1319 // TypeRef
1320 @Instance type [optional];
1321
1322 // The bound of a TypeParameter or BoundedType.
1323 //
1324 // The value will always be one of:
1325 // Type, TypeRef, TypeParameter, BoundedType.
1326 //
1327 // Provided for instance kinds:
1328 // BoundedType
1329 // TypeParameter
1330 @Instance bound [optional];
1200 } 1331 }
1201 ``` 1332 ```
1202 1333
1203 An _Instance_ represents an instance of the Dart language class _Object_. 1334 An _Instance_ represents an instance of the Dart language class _Object_.
1204 1335
1205 ### Int 1336 ### InstanceKind
1206 1337
1207 ``` 1338 ```
1208 class @Int extends @Instance { 1339 enum {
1209 // The value of this int as a string. 1340 // A general instance of the Dart class Object.
1210 // 1341 PlainInstance,
1211 // Suitable for passing to int.parse(). 1342
1212 string valueAsString; 1343 // null instance.
1344 Null,
1345
1346 // true or false.
1347 Bool,
1348
1349 // An instance of the Dart class double.
1350 Double,
1351
1352 // An instance of the Dart class int.
1353 Int,
1354
1355 // An instance of the Dart class String.
1356 String,
1357
1358 // An instance of the built-in VM List implementation. User-defined
1359 // Lists will be PlainInstance.
1360 List,
1361
1362 // An instance of the built-in VM Map implementation. User-defined
1363 // Lists will be PlainInstance.
1364 Map,
1365
1366 // An instance of the built-in VM Closure implementation. User-defined
1367 // Closures will be PlainInstance.
1368 Closure,
1369
1370 // An instance of the Dart class MirrorReference.
1371 MirrorReference,
1372
1373 // An instance of the Dart class WeakProperty.
1374 WeakProperty,
1375
1376 // An instance of the Dart class Type
1377 Type,
1378
1379 // An instance of the Dart class TypeParamer
1380 TypeParameter,
1381
1382 // An instance of the Dart class TypeRef
1383 TypeRef,
1384
1385 // An instance of the Dart class BoundedType
1386 BoundedType,
1213 } 1387 }
1214 ``` 1388 ```
1215 1389
1216 _@Int_ is a reference to an _Int_. 1390 Adding new values to _InstanceKind_ is considered a backwards
1217 1391 compatible change. Clients should treat unrecognized instance kinds
1218 ``` 1392 as _PlainInstance_.
1219 class Int extends Instance {
1220 // The value of this int as a string.
1221 //
1222 // Suitable for passing to int.parse().
1223 string valueAsString;
1224 }
1225 ```
1226
1227 An _Int_ represents an instance of the Dart language class _int_.
1228 1393
1229 ### Isolate 1394 ### Isolate
1230 1395
1231 ``` 1396 ```
1232 class @Isolate extends Response { 1397 class @Isolate extends Response {
1233 // The id which is passed to the getIsolate RPC to load this isolate. 1398 // The id which is passed to the getIsolate RPC to load this isolate.
1234 string id; 1399 string id;
1235 1400
1236 // A numeric id for this isolate, represented as a string. Unique. 1401 // A numeric id for this isolate, represented as a string. Unique.
1237 string number; 1402 string number;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 // The prefix of an 'as' import, or null. 1513 // The prefix of an 'as' import, or null.
1349 String prefix; 1514 String prefix;
1350 1515
1351 // The library being imported or exported. 1516 // The library being imported or exported.
1352 @Library target; 1517 @Library target;
1353 } 1518 }
1354 ``` 1519 ```
1355 1520
1356 A _LibraryDependency_ provides information about an import or export. 1521 A _LibraryDependency_ provides information about an import or export.
1357 1522
1358 ### List
1359
1360 ```
1361 class @List extends @Instance {
1362 // The length of this list.
1363 int length;
1364 }
1365 ```
1366
1367 _@List_ is a reference to a _List_.
1368
1369 ```
1370 class List extends Instance {
1371 // The length of this list.
1372 int length;
1373
1374 // The elements of this list.
1375 ListElement[] elements;
1376 }
1377 ```
1378
1379 A _List_ represents an built-in instance of the Dart class _List_.
1380 User-defined lists will be represented as _Instance_.
1381
1382 ### ListElement 1523 ### ListElement
1383 1524
1384 ``` 1525 ```
1385 class ListElement { 1526 class ListElement {
1386 int index; 1527 int index;
1387 @Instance|Sentinel value; 1528 @Instance|Sentinel value;
1388 } 1529 }
1389 ``` 1530 ```
1390 1531
1391 ### Message 1532 ### Message
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 ``` 1702 ```
1562 enum StepOption { 1703 enum StepOption {
1563 Into, 1704 Into,
1564 Over, 1705 Over,
1565 Out 1706 Out
1566 } 1707 }
1567 ``` 1708 ```
1568 1709
1569 A _StepOption_ indicates which form of stepping is requested in a [resume](#resu me) RPC. 1710 A _StepOption_ indicates which form of stepping is requested in a [resume](#resu me) RPC.
1570 1711
1571 ### String
1572
1573 ```
1574 class @String extends @Instance {
1575 // The value of this double as a string.
1576 //
1577 // Note that this may be truncated.
1578 //
1579 // Suitable for passing to double.parse().
1580 string valueAsString;
1581
1582 // The valueAsString for String references may be truncated. If so,
1583 // this property is added with the value 'true'.
1584 bool valueAsStringIsTruncated [optional];
1585 }
1586 ```
1587
1588 _@String_ is a reference to a _String_.
1589
1590 ```
1591 class String extends Instance {
1592 // The value of this double as a string.
1593 //
1594 // Note that this will never be truncated.
1595 //
1596 // Suitable for passing to double.parse().
1597 string valueAsString;
1598 }
1599 ```
1600
1601 An _String_ represents an instance of the Dart language class _String_.
1602
1603 The _valueAsString_ property for an _@String_ may be truncated. To get
1604 the untruncated _valueAsString_, call the [getObject](#getobject) RPC
1605 on the String's _id_. A _String_ object never truncates the
1606 _valueAsString_.
1607
1608 ### Success 1712 ### Success
1609 1713
1610 ``` 1714 ```
1611 class Success extends Response { 1715 class Success extends Response {
1612 } 1716 }
1613 ``` 1717 ```
1614 1718
1615 The _Success_ type is used to indicate that an operation completed successfully. 1719 The _Success_ type is used to indicate that an operation completed successfully.
1616 1720
1617 ### Type
1618
1619 ```
1620 class @Type extends @Instance {
1621 // The name of this type.
1622 string name;
1623
1624 // The corresponding Class if this Type is canonical.
1625 @Class typeClass [optional];
1626 }
1627 ```
1628
1629 _@Type_ is a reference to a _Type_.
1630
1631 ```
1632 class Type extends Instance {
1633 // The name of this type.
1634 string name;
1635
1636 // The corresponding Class if this Type is canonical.
1637 @Class typeClass [optional];
1638
1639 // The type arguments for this type.
1640 @TypeArguments typeArgs [optional];
1641 }
1642 ```
1643
1644 An _Type_ represents an instance of the Dart language class _Type_.
1645
1646 ### TypeArguments 1721 ### TypeArguments
1647 1722
1648 ``` 1723 ```
1649 class @TypeArguments extends @Object { 1724 class @TypeArguments extends @Object {
1650 // A name for this type argument list. 1725 // A name for this type argument list.
1651 string name; 1726 string name;
1652 } 1727 }
1653 ``` 1728 ```
1654 1729
1655 _@TypeArguments_ is a reference to a _TypeArguments_ object. 1730 _@TypeArguments_ is a reference to a _TypeArguments_ object.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // A list of isolates running in the VM. 1800 // A list of isolates running in the VM.
1726 @Isolate[] isolates 1801 @Isolate[] isolates
1727 } 1802 }
1728 ``` 1803 ```
1729 1804
1730 ## Revision History 1805 ## Revision History
1731 1806
1732 version | comments 1807 version | comments
1733 ------- | -------- 1808 ------- | --------
1734 0.0 | draft 1809 0.0 | draft
OLDNEW
« no previous file with comments | « runtime/vm/report_test.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698