OLD | NEW |
| 1 // <h2>Connecting to the VM Service</h2> |
1 // | 2 // |
2 // TODO(turnidge): Finish writing an idl description of the service protocol. | 3 // TODO(turnidge): Describe how to connect, etc. |
3 // | 4 // |
| 5 // <h2>Types</h2> |
| 6 // |
| 7 // Every non-error response returned by the VM Service has the |
| 8 // <code>type</code> property. This allows the client distinguish |
| 9 // between different kinds of responses. |
| 10 // |
| 11 // If the type name of a response begins with an <code>@</code> |
| 12 // character then that response is a _reference_. If the type name of |
| 13 // a response does not begin with an <code>@</code> character then |
| 14 // that response is an _object_ (or sometimes _full object_). A |
| 15 // reference is meant to be a subset of a full object with just enough |
| 16 // information for the client to generate a reasonable-looking link. |
| 17 // |
| 18 // For example, an isolate reference may look like this... |
| 19 // |
| 20 // { |
| 21 // type: "@Isolate", |
| 22 // id: "isolates/123", |
| 23 // name: "worker" |
| 24 // } |
| 25 // |
| 26 // ... and a full isolate object would have additional properties: |
| 27 // |
| 28 // { |
| 29 // type: "Isolate", |
| 30 // id: "isolates/123", |
| 31 // name: "worker" |
| 32 // entry: ... |
| 33 // heaps: ... |
| 34 // topFrame: ... |
| 35 // ... |
| 36 // } |
| 37 // |
| 38 // <h2>IDs and Names</h2> |
| 39 // |
| 40 // Many responses returned by the VM Service have an <code>id</code> |
| 41 // property. This is an identifier used to request an object from an |
| 42 // isolate using the <code>getObject</code> rpc. If two responses |
| 43 // have the same id then they refer to the same object. The converse |
| 44 // is not true: the same object may occasionally be returned with two |
| 45 // different ids. |
| 46 // |
| 47 // The client must not parse ids -- they must be treated as opaque |
| 48 // strings. We reserve the right to change the ids of objects. |
| 49 // |
| 50 // TODO(turnidge): Describe id/handle expiration. Provide guidance on |
| 51 // which responses are cacheable/constant. Perhaps this needs to be |
| 52 // signaled in the Response itself. |
| 53 // |
| 54 // Many responses have the <code>name</code> property. Names are |
| 55 // provided so that objects can be displayed in a way that a Dart |
| 56 // language programmer would find sensible. |
| 57 // |
| 58 // Note that names are not unique. Many objects will have the same |
| 59 // name. |
| 60 // |
| 61 // <h2>Private Properties</h2> |
| 62 // |
| 63 // Some properties returned by the VM Service begin with an underscore |
| 64 // (_) character. These properties are called _private |
| 65 // properties_. Private properties provide private information |
| 66 // specific to the VM's implementation. Private properties may be |
| 67 // added, removed, or changed at any time with any release of the VM. |
| 68 // They are provided for those tools that need this level of internal |
| 69 // access, such as the Observatory. |
| 70 // |
| 71 // For example, some responses will have the <code>_vmType</code> |
| 72 // property. This provides the VM-internal type name of an object, |
| 73 // and is provided only when this type name differs from the |
| 74 // <code>type</code> property. |
| 75 // |
| 76 // <b>If your application relies on private properties, you should expect |
| 77 // to update it when new versions of the VM are released.</b> |
| 78 // |
| 79 // <hr> |
4 | 80 |
5 interface Service { | 81 interface Service { |
6 // Returns global information about the Dart VM. | 82 // Returns global information about the Dart VM. |
7 getVM() VM | 83 getVM() VM |
8 | 84 |
9 // Changes the debugging name for some isolate. | 85 // Changes the debugging name for some isolate. |
10 setName(isolateId string, name string) Response | 86 setName(isolateId string, name string) Response |
11 | 87 |
12 // Returns information about an isolate. | 88 // Returns information about an isolate. |
13 getIsolate(isolateId string) Isolate | 89 getIsolate(isolateId string) Isolate |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 text string) _EchoResponse | 209 text string) _EchoResponse |
134 | 210 |
135 // Response is bad JSON. | 211 // Response is bad JSON. |
136 _respondWithMalformedJson(isolateId string) Response | 212 _respondWithMalformedJson(isolateId string) Response |
137 | 213 |
138 // Response is not an object. | 214 // Response is not an object. |
139 _respondWithMalformedObject(isolateId string) Response | 215 _respondWithMalformedObject(isolateId string) Response |
140 } | 216 } |
141 | 217 |
142 | 218 |
143 // Every top level response returned by the Service interface extends | 219 // Every non-error top level response returned by the Service |
144 // <code>Response</code>. This allows the client to distinguish | 220 // interface extends <code>Response</code>. This allows the client to |
145 // between different kinds of responses by using the <code>type</code> | 221 // distinguish between different kinds of responses by using the |
146 // property. | 222 // <code>type</code> property. |
147 struct Response { | 223 struct Response { |
148 // Every response returned by the VM Service has the | 224 // Every response returned by the VM Service has the |
149 // <code>type</code> property. This allows the client distinguish | 225 // <code>type</code> property. This allows the client distinguish |
150 // between different kinds of responses. | 226 // between different kinds of responses. |
151 type string | 227 type string |
152 | 228 |
153 // Some responses will have the <code>_vmType</code> property. This | 229 // Some responses will have the <code>_vmType</code> property. This |
154 // provides the VM-internal type name of an object, and is provided | 230 // provides the VM-internal type name of an object, and is provided |
155 // only when this type name differs from the <code>type</code> | 231 // only when this type name differs from the <code>type</code> |
156 // property. | 232 // property. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 struct Object extends Response { | 459 struct Object extends Response { |
384 // A unique identifier for this object. | 460 // A unique identifier for this object. |
385 id string | 461 id string |
386 } | 462 } |
387 | 463 |
388 | 464 |
389 // TODO(turnidge): null type | 465 // TODO(turnidge): null type |
390 // TODO(turnidge): VMObject. | 466 // TODO(turnidge): VMObject. |
391 | 467 |
392 | 468 |
| 469 // A reference to a Dart language library. |
| 470 struct LibraryRef extends ObjectRef { |
| 471 // The name of this library. |
| 472 name string |
| 473 |
| 474 // The url of this library. |
| 475 url string |
| 476 } |
| 477 |
| 478 |
| 479 // A Dart language library. |
| 480 struct Library extends Object { |
| 481 // The name of this library. |
| 482 name string |
| 483 |
| 484 // The url of this library. |
| 485 url string |
| 486 |
| 487 // A list of the imports for this library. |
| 488 imports []LibraryRef |
| 489 |
| 490 // A list of the scripts which constitute this library. |
| 491 scripts []ScriptRef |
| 492 |
| 493 // A list of the top-level variables in this library. |
| 494 variables []FieldRef |
| 495 |
| 496 // A list of the top-level functions in this library. |
| 497 functions []FunctionRef |
| 498 |
| 499 // A list of all classes in this library. |
| 500 classes []ClassRef |
| 501 } |
| 502 |
| 503 |
| 504 // A reference to a Dart language script. |
| 505 struct ScriptRef extends ObjectRef { |
| 506 // A name for this script. |
| 507 name string |
| 508 |
| 509 // What kind of script is this? |
| 510 kind ScriptKind |
| 511 } |
| 512 |
| 513 |
| 514 // A Dart language script. |
| 515 struct Script extends Object { |
| 516 // A name for this script. |
| 517 name string |
| 518 |
| 519 // What kind of script is this? |
| 520 kind ScriptKind |
| 521 |
| 522 // The library which owns this script. |
| 523 library LibraryRef |
| 524 |
| 525 // The source code for this script. For certain built-in scripts, |
| 526 // this may be reconstructed without source comments. |
| 527 source string |
| 528 |
| 529 // A table encoding a mapping from token position to line and column. |
| 530 // |
| 531 // Each entry in the array consists of a line number followed by |
| 532 // (tokenPos, columnNumber) pairs: |
| 533 // |
| 534 // [lineNumber, (tokenPos, columnNumber)*] |
| 535 // |
| 536 // For example, the following table: |
| 537 // |
| 538 // [[1, 100, 5, 101, 8],[2, 102, 7]] |
| 539 // |
| 540 // Encodes the following mapping: |
| 541 // |
| 542 // tokenPos line column |
| 543 // -------- ------ ------ |
| 544 // 100 1 5 |
| 545 // 101 1 8 |
| 546 // 102 2 7 |
| 547 // |
| 548 // TODO(turnidge): The tool I'm using does not support [][]. |
| 549 // tokenPosTable [][]int |
| 550 tokenPosTable int |
| 551 } |
| 552 |
| 553 |
| 554 enum ScriptKind { |
| 555 script |
| 556 library |
| 557 source |
| 558 patch |
| 559 } |
| 560 |
| 561 |
393 // A reference to a Dart language class. | 562 // A reference to a Dart language class. |
394 struct ClassRef extends ObjectRef { | 563 struct ClassRef extends ObjectRef { |
395 // The name of this class. | 564 // The name of this class. |
396 name string | 565 name string |
397 | 566 |
398 // A vm internal name, provided only when it is different than name. | 567 // A vm internal name, provided only when it is different than name. |
399 _vmName string | 568 _vmName string [optional] |
400 } | 569 } |
401 | 570 |
402 | 571 |
403 // A Dart language class. | 572 // A Dart language class. |
404 struct Class extends Object { | 573 struct Class extends Object { |
405 // The name of this class. | 574 // The name of this class. |
406 name string | 575 name string |
407 | 576 |
408 // A vm internal name, provided only when it is different than name. | 577 // A vm internal name, provided only when it is different than name. |
409 _vmName string | 578 _vmName string [optional] |
410 | 579 |
411 // The error which occurred during class finalization, if it exists. | 580 // The error which occurred during class finalization, if it exists. |
412 error InstanceRef [optional] | 581 error InstanceRef [optional] |
413 | 582 |
414 // Is this an abstract class? | 583 // Is this an abstract class? |
415 abstract bool | 584 abstract bool |
416 | 585 |
417 // Is this a const class? | 586 // Is this a const class? |
418 const bool | 587 const bool |
419 | 588 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // Allocation statistics for this class, if available. | 622 // Allocation statistics for this class, if available. |
454 allocationStats ClassHeapStats [optional] | 623 allocationStats ClassHeapStats [optional] |
455 } | 624 } |
456 | 625 |
457 | 626 |
458 struct ClassHeapStats extends Response { | 627 struct ClassHeapStats extends Response { |
459 TODO int | 628 TODO int |
460 } | 629 } |
461 | 630 |
462 | 631 |
| 632 // A reference to a Dart language field or variable. |
| 633 struct FieldRef extends ObjectRef { |
| 634 // The name of this field. |
| 635 name string |
| 636 |
| 637 // A vm internal name, provided only when it is different than name. |
| 638 _vmName string [optional] |
| 639 |
| 640 // The value of this field, if the field is static. |
| 641 value InstanceRef [optional] |
| 642 |
| 643 // The owner of this field, which can be either a LibraryRef for a |
| 644 // ClassRef. |
| 645 owner ObjectRef |
| 646 |
| 647 // The declared type of this field. |
| 648 declaredType TypeRef |
| 649 |
| 650 // Is this field const? |
| 651 const bool |
| 652 |
| 653 // Is this field final? |
| 654 final bool |
| 655 |
| 656 // Is this field static? |
| 657 static bool |
| 658 } |
| 659 |
| 660 |
| 661 // A Dart language field or variable. |
| 662 struct Field extends ObjectRef { |
| 663 // The name of this field. |
| 664 name string |
| 665 |
| 666 // A vm internal name, provided only when it is different than name. |
| 667 _vmName string [optional] |
| 668 |
| 669 // The value of this field, if the field is static. |
| 670 value InstanceRef [optional] |
| 671 |
| 672 // The owner of this field, which can be either a LibraryRef for a |
| 673 // ClassRef. |
| 674 owner ObjectRef |
| 675 |
| 676 // The declared type of this field. |
| 677 declaredType TypeRef |
| 678 |
| 679 // Is this field const? |
| 680 const bool |
| 681 |
| 682 // Is this field final? |
| 683 final bool |
| 684 |
| 685 // Is this field static? |
| 686 static bool |
| 687 |
| 688 // The script containing this feild. |
| 689 script ScriptRef [optional] |
| 690 |
| 691 // The token position of this field. |
| 692 tokenPos int [optional] |
| 693 |
| 694 // Have we seen null assigned to this field? |
| 695 _guardNullable bool |
| 696 |
| 697 // Have we seen a single class assigned to this field? |
| 698 // |
| 699 // TODO(johnmccutchan): This can actually be a string 'unknown' or |
| 700 // 'dynamic' or a ClassRef. Change how this is encoded. |
| 701 _guardClass string |
| 702 |
| 703 // Have we seen a fixed length list assigned to this field? |
| 704 // |
| 705 // TODO(johnmccutchan): This can actually be a string 'unknown' or |
| 706 // 'dynamic' or a ClassRef. Change how this is encoded. |
| 707 _guardLength string |
| 708 } |
| 709 |
| 710 |
| 711 // A reference to a Dart language function. |
| 712 struct FunctionRef extends ObjectRef { |
| 713 // The name of this function. |
| 714 name string |
| 715 |
| 716 // A vm internal name, provided only when it is different than name. |
| 717 _vmName string [optional] |
| 718 |
| 719 // The owner of this field, which can be a LibraryRef, ClassRef, or |
| 720 // a FunctionRef. |
| 721 owner ObjectRef |
| 722 |
| 723 // What kind of function is this? |
| 724 kind FunctionKind |
| 725 } |
| 726 |
| 727 |
| 728 // A Dart language function. |
| 729 struct Function extends ObjectRef { |
| 730 // The name of this function. |
| 731 name string |
| 732 |
| 733 // A vm internal name, provided only when it is different than name. |
| 734 _vmName string [optional] |
| 735 |
| 736 // What kind of function is this? |
| 737 kind FunctionKind |
| 738 |
| 739 // The owner of this field, which can be a LibraryRef, ClassRef, or |
| 740 // a FunctionRef. |
| 741 owner ObjectRef |
| 742 |
| 743 // Is this function static? |
| 744 // |
| 745 // TODO(turnidge): This is inconsistent with FieldRef. |
| 746 static bool |
| 747 |
| 748 // Is this function const? |
| 749 const bool |
| 750 |
| 751 // The script containing this function. |
| 752 script ScriptRef [optional] |
| 753 |
| 754 // The first token position of this function. |
| 755 tokenPos int [optional] |
| 756 |
| 757 // The last token position of this function. |
| 758 endTokenPos int [optional] |
| 759 |
| 760 // The compiled code associated with this function. |
| 761 code CodeRef [optional] |
| 762 |
| 763 // Are we able to generate optimized code for this function? |
| 764 _optimizable bool |
| 765 |
| 766 // Are we able to inline this function? |
| 767 _inlinable bool |
| 768 |
| 769 // The unoptimized version of this function, if retained. |
| 770 _unoptimizedCode CodeRef [optional] |
| 771 |
| 772 // An indicator of how actively this function is used. |
| 773 _usageCounter int |
| 774 |
| 775 // TODO(johnmccutchan): Document. |
| 776 _optimizedCallSiteCount int |
| 777 |
| 778 // How many times has this function been deoptimized? |
| 779 _deoptimizations int |
| 780 } |
| 781 |
| 782 |
| 783 enum FunctionKind { |
| 784 RegularFunction |
| 785 ClosureFunction |
| 786 GetterFunction |
| 787 SetterFunction |
| 788 Constructor |
| 789 ImplicitGetter |
| 790 ImplicitSetter |
| 791 ImplicitStaticFinalGetter |
| 792 IrregexpFunction |
| 793 StaticInitializer |
| 794 MethodExtractor |
| 795 NoSuchMethodDispatcher |
| 796 InvokeFieldDispatcher |
| 797 Collected |
| 798 Native |
| 799 Stub |
| 800 Tag |
| 801 } |
| 802 |
| 803 |
| 804 // A reference to a compiled code object in the Dart VM. |
| 805 struct CodeRef extends ObjectRef { |
| 806 // A name for this code object |
| 807 name string |
| 808 |
| 809 // A vm internal name, provided only when it is different than name. |
| 810 _vmName string [optional] |
| 811 |
| 812 // What kind of code object is this? |
| 813 kind CodeKind |
| 814 |
| 815 // Was this code generated using the optimizing compiler? |
| 816 _optimized bool |
| 817 } |
| 818 |
| 819 |
| 820 // A compiled code object in the Dart VM. |
| 821 struct Code extends Object { |
| 822 // A name for this code object |
| 823 name string |
| 824 |
| 825 // A vm internal name, provided only when it is different than name. |
| 826 _vmName string [optional] |
| 827 |
| 828 // What kind of code object is this? |
| 829 kind CodeKind |
| 830 |
| 831 // Was this code generated using the optimizing compiler? |
| 832 _optimized bool |
| 833 |
| 834 // The function which corresponds to this compiled code. |
| 835 function FunctionRef |
| 836 |
| 837 // The start address of the generated code as a hex string. |
| 838 _startAddress string |
| 839 |
| 840 // The end address of the generated code as a hex string. |
| 841 _endAddress string |
| 842 |
| 843 // The object pool associated with this code object. |
| 844 _objectPool UNDOCUMENTED [optional] |
| 845 |
| 846 // The disassembly of this code object. |
| 847 _disassembly UNDOCUMENTED [optional] |
| 848 |
| 849 // The pc descriptor table for this code object. |
| 850 _descriptors UNDOCUMENTED [optional] |
| 851 |
| 852 // The inlined function table for this code object. |
| 853 _inlinedFunctions UNDOCUMENTED [optional] |
| 854 |
| 855 // Inline interval information for this code object. |
| 856 _inlinedIntervals UNDOCUMENTED [optional] |
| 857 } |
| 858 |
| 859 |
| 860 enum CodeKind { |
| 861 Dart |
| 862 Native |
| 863 Stub |
| 864 Tag |
| 865 Collected |
| 866 } |
| 867 |
| 868 |
463 // A reference to a type arguments vector. | 869 // A reference to a type arguments vector. |
464 struct TypeArgumentsRef extends ObjectRef { | 870 struct TypeArgumentsRef extends ObjectRef { |
465 // A name for this type argument list. | 871 // A name for this type argument list. |
466 name string | 872 name string |
467 | 873 |
468 // A vm internal name, provided only when it is different than name. | 874 // A vm internal name, provided only when it is different than name. |
469 _vmName string | 875 _vmName string |
470 } | 876 } |
471 | 877 |
472 | 878 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 | 915 |
510 | 916 |
511 // A <code>Breakpoint</code> describes a debugger breakpoint. | 917 // A <code>Breakpoint</code> describes a debugger breakpoint. |
512 struct Breakpoint extends Object { | 918 struct Breakpoint extends Object { |
513 breakpointNumber int | 919 breakpointNumber int |
514 resolved bool | 920 resolved bool |
515 location Location | 921 location Location |
516 } | 922 } |
517 | 923 |
518 | 924 |
519 // A <code>CodeRef</code> encodes a reference to a <code>Code</code> object. | |
520 struct CodeRef extends ObjectRef { | |
521 TODO int | |
522 } | |
523 | |
524 | |
525 struct LibraryRef extends ObjectRef { | |
526 TODO int | |
527 } | |
528 | |
529 | |
530 // A <code>FunctionRef</code> encodes a reference to a <code>Function</code> obj
ect. | |
531 struct FunctionRef extends ObjectRef { | |
532 TODO int | |
533 } | |
534 | |
535 | |
536 // A <code>FieldRef</code> encodes a reference to a <code>Field</code> object. | |
537 struct FieldRef extends ObjectRef { | |
538 TODO int | |
539 } | |
540 | |
541 | |
542 // A <code>ScriptRef</code> encodes a reference to a <code>Script</code> object. | |
543 struct ScriptRef extends ObjectRef { | |
544 TODO int | |
545 } | |
546 | |
547 | |
548 // A <code>Location</code> encodes a location withing a dart script. | 925 // A <code>Location</code> encodes a location withing a dart script. |
549 // | 926 // |
550 // TODO(turnidge): Should this really be broken out as its own type? | 927 // TODO(turnidge): Should this really be broken out as its own type? |
551 // If so, we should use it more consistently in the api. For example, | 928 // If so, we should use it more consistently in the api. For example, |
552 // in Frame. | 929 // in Frame. |
553 struct Location { | 930 struct Location { |
554 script ScriptRef | 931 script ScriptRef |
555 tokenPos int | 932 tokenPos int |
556 } | 933 } |
557 | 934 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 // should be retrieved from an isolate. | 1115 // should be retrieved from an isolate. |
739 enum MetricSelector { | 1116 enum MetricSelector { |
740 Dart | 1117 Dart |
741 Native | 1118 Native |
742 } | 1119 } |
743 | 1120 |
744 | 1121 |
745 struct _EchoResponse extends Response { | 1122 struct _EchoResponse extends Response { |
746 text string | 1123 text string |
747 } | 1124 } |
| 1125 |
| 1126 |
| 1127 struct UNDOCUMENTED { |
| 1128 TODO int |
| 1129 } |
OLD | NEW |