[vm, service] Document past addition of InstanceKind WeakReference.

[observatory] Display WeakReference targets.

TEST=manually look at inspector.dart under Observatory
Change-Id: Ibfcc266528e28afdb9876335c0dfac94b178c1c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269982
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2022-11-17 23:37:11 +00:00
committed by Commit Queue
parent 9d36acbb06
commit b7ae764479
10 changed files with 81 additions and 27 deletions
@@ -215,6 +215,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
case M.InstanceKind.plainInstance:
case M.InstanceKind.mirrorReference:
case M.InstanceKind.stackTrace:
case M.InstanceKind.weakReference:
case M.InstanceKind.weakProperty:
case M.InstanceKind.recordType:
return true;
@@ -337,17 +338,18 @@ class InstanceRefElement extends CustomElement implements Renderable {
..classes = ['stackTraceBox']
..text = _instance.valueAsString
];
case M.InstanceKind.weakReference:
return [
new SpanElement()..text = '<target> : ',
anyRef(_isolate, _loadedInstance!.target, _objects, queue: _r.queue)
];
case M.InstanceKind.weakProperty:
return [
new SpanElement()..text = '<key> : ',
new InstanceRefElement(_isolate, _loadedInstance!.key!, _objects,
queue: _r.queue)
.element,
anyRef(_isolate, _loadedInstance!.key!, _objects, queue: _r.queue),
new BRElement(),
new SpanElement()..text = '<value> : ',
new InstanceRefElement(_isolate, _loadedInstance!.value!, _objects,
queue: _r.queue)
.element,
anyRef(_isolate, _loadedInstance!.value!, _objects, queue: _r.queue),
];
case M.InstanceKind.recordType:
final fields = _loadedInstance!.fields!.toList();
@@ -486,6 +486,10 @@ class InstanceViewElement extends CustomElement implements Renderable {
members.add(member('referent', _instance.referent));
}
if (_instance.kind == M.InstanceKind.weakReference) {
members.add(member('target', _instance.target));
}
if (_instance.kind == M.InstanceKind.weakProperty) {
members.add(member('key', _instance.key));
members.add(member('value', _instance.value));
@@ -374,17 +374,23 @@ abstract class Instance extends Object implements InstanceRef {
/// Map
Iterable<MapAssociation>? get associations;
/// [optional] The key for a WeakProperty instance.
/// [optional] The target of a WeakReference instance.
///
/// Provided for instance kinds:
/// WeakProperty
InstanceRef? get key;
/// WeakReference
ObjectRef? get target;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
InstanceRef? get value;
ObjectRef? get key;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
ObjectRef? get value;
/// [optional] The referent of a MirrorReference instance.
///
@@ -2873,8 +2873,9 @@ class Instance extends HeapObject implements M.Instance {
Iterable<MapAssociation>? associations; // If a Map.
List<dynamic>? typedElements; // If a TypedData.
HeapObject? referent; // If a MirrorReference.
Instance? key; // If a WeakProperty.
Instance? value; // If a WeakProperty.
HeapObject? target; // If a WeakReference.
HeapObject? key; // If a WeakProperty.
HeapObject? value; // If a WeakProperty.
Breakpoint? activationBreakpoint; // If a Closure.
ServiceFunction? oneByteFunction; // If a RegExp.
ServiceFunction? twoByteFunction; // If a RegExp.
@@ -3061,6 +3062,7 @@ class Instance extends HeapObject implements M.Instance {
bound = map['bound'];
referent = map['mirrorReferent'];
target = map['target'];
key = map['propertyKey'];
value = map['propertyValue'];
activationBreakpoint = map['_activationBreakpoint'];
@@ -41,6 +41,7 @@ class Node {
var nullable;
var mixedType;
var array;
var arrayConst;
var bigint;
var blockClean;
var blockCopying;
@@ -61,6 +62,7 @@ class Node {
var int32x4;
var isolate;
var map;
var mapConst;
var mint;
var mirrorClass;
var mirrorClosure;
@@ -72,6 +74,8 @@ class Node {
var recordType;
var regex;
late var sentinel; // Not initialized
var set;
var setConst;
var smi;
var stacktrace;
var string;
@@ -153,6 +157,7 @@ class Node {
array[0] = 1;
array[1] = 2;
array[2] = 3;
arrayConst = const [1, 2, 3];
bigint = BigInt.one << 65;
blockClean = genCleanBlock();
blockCopying = genCopyingBlock();
@@ -177,6 +182,10 @@ class Node {
"y-key": "y-value",
"removed-key": "removed-value"
};
mapConst = const {
1: 1.5,
2: 2.5,
};
map.remove("removed-key");
mint = 1 << 32;
mirrorClass = reflectClass(Object);
@@ -188,6 +197,13 @@ class Node {
record = (1, 2, three: 3, four: 4);
recordType = record.runtimeType;
regex = new RegExp("a*b+c");
set = {
"element1", "element2", "removed-element"
};
set.remove("removed-element");
setConst = const {
10, 20, 30
};
smi = 7;
stacktrace = genStackTrace();
string = "Hello $smi ${smi.runtimeType}";
@@ -213,6 +213,7 @@ class InstanceRefElement extends CustomElement implements Renderable {
case M.InstanceKind.plainInstance:
case M.InstanceKind.mirrorReference:
case M.InstanceKind.stackTrace:
case M.InstanceKind.weakReference:
case M.InstanceKind.weakProperty:
case M.InstanceKind.recordType:
return true;
@@ -335,17 +336,18 @@ class InstanceRefElement extends CustomElement implements Renderable {
..classes = ['stackTraceBox']
..text = _instance.valueAsString
];
case M.InstanceKind.weakReference:
return [
new SpanElement()..text = '<target> : ',
anyRef(_isolate, _loadedInstance.target, _objects, queue: _r.queue)
];
case M.InstanceKind.weakProperty:
return [
new SpanElement()..text = '<key> : ',
new InstanceRefElement(_isolate, _loadedInstance.key, _objects,
queue: _r.queue)
.element,
anyRef(_isolate, _loadedInstance.key, _objects, queue: _r.queue),
new BRElement(),
new SpanElement()..text = '<value> : ',
new InstanceRefElement(_isolate, _loadedInstance.value, _objects,
queue: _r.queue)
.element,
anyRef(_isolate, _loadedInstance.value, _objects, queue: _r.queue),
];
case M.InstanceKind.recordType:
final fields = _loadedInstance.fields.toList();
@@ -484,6 +484,10 @@ class InstanceViewElement extends CustomElement implements Renderable {
members.add(member('referent', _instance.referent));
}
if (_instance.kind == M.InstanceKind.weakReference) {
members.add(member('target', _instance.target));
}
if (_instance.kind == M.InstanceKind.weakProperty) {
members.add(member('key', _instance.key));
members.add(member('value', _instance.value));
@@ -365,17 +365,23 @@ abstract class Instance extends Object implements InstanceRef {
/// Map
Iterable<MapAssociation> get associations;
/// [optional] The key for a WeakProperty instance.
/// [optional] The target of a WeakReference instance.
///
/// Provided for instance kinds:
/// WeakProperty
InstanceRef get key;
/// WeakReference
ObjectRef get target;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
InstanceRef get value;
ObjectRef get key;
/// [optional] The key for a WeakProperty instance.
///
/// Provided for instance kinds:
/// WeakProperty
ObjectRef get value;
/// [optional] The referent of a MirrorReference instance.
///
@@ -2882,8 +2882,9 @@ class Instance extends HeapObject implements M.Instance {
Iterable<MapAssociation> associations; // If a Map.
List<dynamic> typedElements; // If a TypedData.
HeapObject referent; // If a MirrorReference.
Instance key; // If a WeakProperty.
Instance value; // If a WeakProperty.
HeapObject target; // If a WeakReference.
HeapObject key; // If a WeakProperty.
HeapObject value; // If a WeakProperty.
Breakpoint activationBreakpoint; // If a Closure.
ServiceFunction oneByteFunction; // If a RegExp.
ServiceFunction twoByteFunction; // If a RegExp.
@@ -3074,6 +3075,7 @@ class Instance extends HeapObject implements M.Instance {
bound = map['bound'];
referent = map['mirrorReferent'];
target = map['target'];
key = map['propertyKey'];
value = map['propertyValue'];
activationBreakpoint = map['_activationBreakpoint'];
+13 -3
View File
@@ -1,8 +1,8 @@
# Dart VM Service Protocol 3.61
# Dart VM Service Protocol 3.62
> Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 3.61_ of the Dart VM Service Protocol. This
This document describes of _version 3.62_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag.
@@ -2853,6 +2853,7 @@ class Instance extends Object {
// String
// List
// Map
// Set
// Uint8ClampedList
// Uint8List
// Uint16List
@@ -3014,6 +3015,12 @@ class Instance extends Object {
// WeakProperty
@Instance propertyValue [optional];
// The target for a WeakReference instance.
//
// Provided for instance kinds:
// WeakReference
@Instance target [optional];
// The type arguments for this type.
//
// Provided for instance kinds:
@@ -3142,6 +3149,9 @@ enum InstanceKind {
// An instance of the Dart class WeakProperty.
WeakProperty,
// An instance of the Dart class WeakReference.
WeakReference,
// An instance of the Dart class Type.
Type,
@@ -4399,7 +4409,7 @@ version | comments
3.54 | Added `CpuSamplesEvent`, updated `cpuSamples` property on `Event` to have type `CpuSamplesEvent`.
3.55 | Added `streamCpuSamplesWithUserTag` RPC.
3.56 | Added optional `line` and `column` properties to `SourceLocation`. Added a new `SourceReportKind`, `BranchCoverage`, which reports branch level coverage information.
3.57 | Added optional `libraryFilters` parameter to `getSourceReport` RPC.
3.57 | Added optional `libraryFilters` parameter to `getSourceReport` RPC. Added `WeakReference` to `InstanceKind`.
3.58 | Added optional `local` parameter to `lookupResolvedPackageUris` RPC.
3.59 | Added `abstract` property to `@Function` and `Function`.
3.60 | Added `gcType` property to `Event`.