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

Unified Diff: pkg/dartino_compiler/lib/vm_commands.dart

Issue 2065933004: Support for accessing arrays in the debugger (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/dartino_compiler/lib/vm_commands.dart
diff --git a/pkg/dartino_compiler/lib/vm_commands.dart b/pkg/dartino_compiler/lib/vm_commands.dart
index 131497c44485c1f2641afeacc79eea3919903a1f..be259ccd701236633b6c5f3dd0c15a6e661ec9df 100644
--- a/pkg/dartino_compiler/lib/vm_commands.dart
+++ b/pkg/dartino_compiler/lib/vm_commands.dart
@@ -50,6 +50,9 @@ abstract class VmCommand {
translateClass(CommandBuffer.readInt64FromBuffer(buffer, 0));
int fields = CommandBuffer.readInt32FromBuffer(buffer, 8);
return new InstanceStructure(classId, fields);
+ case VmCommandCode.ArrayStructure:
+ int length = CommandBuffer.readInt32FromBuffer(buffer, 0);
+ return new ArrayStructure(length);
case VmCommandCode.Instance:
int classId = translateClass(
CommandBuffer.readInt64FromBuffer(buffer, 0));
@@ -70,6 +73,9 @@ abstract class VmCommand {
case VmCommandCode.String:
return new StringValue(
CommandBuffer.readStringFromBuffer(buffer, 0, buffer.length));
+ case VmCommandCode.Array:
+ int length = CommandBuffer.readInt32FromBuffer(buffer, 0);
+ return new Array(length);
case VmCommandCode.StdoutData:
return new StdoutData(buffer);
case VmCommandCode.StderrData:
@@ -164,6 +170,9 @@ abstract class VmCommand {
bool isFromSnapshot = CommandBuffer.readBoolFromBuffer(buffer, 0);
int snapshotHash = CommandBuffer.readInt32FromBuffer(buffer, 1);
return new DebuggingReply(isFromSnapshot, snapshotHash);
+ case VmCommandCode.CommandError:
+ int errorCode = CommandBuffer.readInt32FromBuffer(buffer, 0);
+ return new CommandError(ErrorCode.values[errorCode]);
default:
throw 'Unhandled command in VmCommand.fromBuffer: $code';
}
@@ -1200,7 +1209,8 @@ class ProcessInstance extends VmCommand {
/// Peer will respond with a [DartValue].
int get numberOfResponsesExpected => 1;
- String valuesToString() => "frame: $frame, slot: $slot";
+ String valuesToString() =>
+ "frame: $frame, slot: $slot, fieldAccesses: $fieldAccesses";
}
class ProcessInstanceStructure extends VmCommand {
@@ -1231,7 +1241,8 @@ class ProcessInstanceStructure extends VmCommand {
/// The number of responses is not fixed.
int get numberOfResponsesExpected => null;
- String valuesToString() => "frame: $frame, slot: $slot";
+ String valuesToString() =>
+ "frame: $frame, slot: $slot fieldAccesses: $fieldAccesses";
}
class ProcessRestartFrame extends VmCommand {
@@ -1571,6 +1582,23 @@ class InstanceStructure extends VmCommand {
String valuesToString() => "classId: $classId, fields: $fields";
}
+class ArrayStructure extends VmCommand {
+ final int length;
+ const ArrayStructure(this.length)
+ : super(VmCommandCode.ArrayStructure);
+
+ void internalAddTo(
+ Sink<List<int>> sink,
+ CommandBuffer<VmCommandCode> buffer,
+ int translateObject(MapId mapId, int index)) {
+ throw new UnimplementedError();
+ }
+
+ int get numberOfResponsesExpected => 0;
+
+ String valuesToString() => "length: $length";
+}
+
abstract class DartValue extends VmCommand {
const DartValue(VmCommandCode code)
: super(code);
@@ -1665,6 +1693,15 @@ class StringValue extends DartValue {
String dartToString() => "'$value'";
}
+class Array extends DartValue {
+ final int length;
+
+ const Array(this.length)
+ : super(VmCommandCode.Array);
+
+ String dartToString() => "array of length $length";
+}
+
class CommandError extends VmCommand {
final ErrorCode errorCode;
@@ -1800,7 +1837,9 @@ enum VmCommandCode {
String,
Instance,
Class,
- InstanceStructure
+ Array,
+ InstanceStructure,
+ ArrayStructure,
}
enum MapId {

Powered by Google App Engine
This is Rietveld 408576698