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

Side by Side Diff: pkg/dartino_compiler/lib/src/debug_service_protocol.dart

Issue 2060283002: Inspect local variables and fields from service protocol. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 /// An implementation of the vm service-protocol in terms of a DartinoVmContext. 5 /// An implementation of the vm service-protocol in terms of a DartinoVmContext.
6 /// Processes are mapped to isolates. 6 /// Processes are mapped to isolates.
7 // TODO(sigurdm): Handle processes better. 7 // TODO(sigurdm): Handle processes better.
8 // TODO(sigurdm): Find a way to represent fibers. 8 // TODO(sigurdm): Find a way to represent fibers.
9 // TODO(sigurdm): Represent remote values.
10 // TODO(sigurdm): Use https://pub.dartlang.org/packages/json_rpc_2 for serving. 9 // TODO(sigurdm): Use https://pub.dartlang.org/packages/json_rpc_2 for serving.
11 10
12 import "dart:async" show Future; 11 import "dart:async" show Future;
13 12
14 import 'dart:convert' show JSON; 13 import 'dart:convert' show JSON;
15 14
16 import 'dart:io' show File, HttpServer, WebSocket, WebSocketTransformer; 15 import 'dart:io' show File, HttpServer, WebSocket, WebSocketTransformer;
17 16
18 import 'hub/session_manager.dart' show SessionState; 17 import 'hub/session_manager.dart' show SessionState;
19 18
20 import 'guess_configuration.dart' show dartinoVersion; 19 import 'guess_configuration.dart' show dartinoVersion;
21 20
22 import '../debug_state.dart' 21 import '../debug_state.dart'
23 show BackTrace, BackTraceFrame, Breakpoint, RemoteObject; 22 show
23 BackTrace,
24 BackTraceFrame,
25 Breakpoint,
26 RemoteArray,
27 RemoteErrorObject,
28 RemoteInstance,
29 RemoteObject,
30 RemoteValue;
24 31
25 import '../vm_context.dart' show DartinoVmContext, DebugListener; 32 import '../vm_context.dart' show DartinoVmContext, DebugListener;
26 33
27 import '../dartino_system.dart' 34 import '../dartino_system.dart'
28 show DartinoFunction, DartinoFunctionKind, DartinoSystem; 35 show DartinoFunction, DartinoFunctionKind, DartinoSystem;
29 36
30 import 'debug_info.dart' show DebugInfo, ScopeInfo, SourceLocation; 37 import 'debug_info.dart' show DebugInfo, ScopeInfo, SourceLocation;
31 38
32 import 'dartino_compiler_implementation.dart' 39 import 'dartino_compiler_implementation.dart'
33 show DartinoCompilerImplementation; 40 show DartinoCompilerImplementation;
34 41 import 'element_utils.dart';
35 import 'codegen_visitor.dart' show LocalValue;
36 42
37 import '../program_info.dart' show Configuration; 43 import '../program_info.dart' show Configuration;
44 import '../vm_commands.dart'
45 show
46 Array,
47 Boolean,
48 ClassValue,
49 DartValue,
50 Double,
51 Instance,
52 Integer,
53 NullValue,
54 StringValue;
38 55
39 import 'package:collection/collection.dart' show binarySearch; 56 import 'package:collection/collection.dart' show binarySearch;
40 57
41 import 'package:compiler/src/scanner/scanner.dart' show Scanner; 58 import 'package:compiler/src/scanner/scanner.dart' show Scanner;
42 import 'package:compiler/src/tokens/token.dart' show Token; 59 import 'package:compiler/src/tokens/token.dart' show Token;
43 import 'package:compiler/src/io/source_file.dart' show SourceFile; 60 import 'package:compiler/src/io/source_file.dart' show SourceFile;
44 import 'package:compiler/src/elements/visitor.dart' show BaseElementVisitor; 61 import 'package:compiler/src/elements/visitor.dart' show BaseElementVisitor;
45 import 'package:compiler/src/elements/elements.dart' 62 import 'package:compiler/src/elements/elements.dart'
46 show 63 show
64 ClassElement,
47 CompilationUnitElement, 65 CompilationUnitElement,
48 Element, 66 Element,
67 FieldElement,
49 FunctionElement, 68 FunctionElement,
50 LibraryElement, 69 LibraryElement,
51 MemberElement, 70 MemberElement,
52 ScopeContainerElement; 71 ScopeContainerElement;
53 72
54 const bool logging = const bool.fromEnvironment("dartino-log-debug-server"); 73 const bool logging = const bool.fromEnvironment("dartino-log-debug-server");
55 74
56 //TODO(danrubel): Verify const map values
57 const Map<String, dynamic> dartCoreLibRefDesc = const <String, dynamic>{
58 "type": "@Library",
59 "id": "libraries/dart:core",
60 "fixedId": true,
61 "name": "dart:core",
62 "uri": "dart:core",
63 };
64
65 //TODO(danrubel): Verify correct id
66 const String nullId = "objects/Null";
67
68 //TODO(danrubel): Verify const map values
69 const Map<String, dynamic> nullClassRefDesc = const <String, dynamic>{
70 "type": "@Class",
71 "id": "classes/NullClass",
72 "name": "NullClass",
73 };
74
75 //TODO(danrubel): Verify const map values
76 const Map<String, dynamic> nullRefDesc = const <String, dynamic>{
77 "type": "@Null",
78 "id": nullId,
79 "kind": "Null",
80 "class": nullClassRefDesc,
81 "valueAsString": "null",
82 };
83
84 //TODO(danrubel): Verify const map values
85 const Map<String, dynamic> nullDesc = const <String, dynamic>{
86 "type": "Null",
87 "id": nullId,
88 "kind": "Null",
89 "class": nullClassRefDesc,
90 "valueAsString": "null",
91 };
92
93 class DebugServer { 75 class DebugServer {
94 Future<int> serveSingleShot(SessionState state, 76 Future<int> serveSingleShot(SessionState state,
95 {int port: 0, Uri snapshotLocation}) async { 77 {int port: 0, Uri snapshotLocation}) async {
96 HttpServer server = await HttpServer.bind("127.0.0.1", port); 78 HttpServer server = await HttpServer.bind("127.0.0.1", port);
97 // The Atom Dartino plugin waits for "localhost:<port-number>" 79 // The Atom Dartino plugin waits for "localhost:<port-number>"
98 // to determine the observatory port for debugging. 80 // to determine the observatory port for debugging.
99 print("localhost:${server.port}"); 81 print("localhost:${server.port}");
100 WebSocket socket = await server.transform(new WebSocketTransformer()).first; 82 WebSocket socket = await server.transform(new WebSocketTransformer()).first;
101 await new DebugConnection(state, socket, snapshotLocation: snapshotLocation) 83 await new DebugConnection(state, socket, snapshotLocation: snapshotLocation)
102 .serve(); 84 .serve();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 socket.add(JSON.encode(message)); 120 socket.add(JSON.encode(message));
139 } 121 }
140 122
141 void setStream(String streamId, bool value) { 123 void setStream(String streamId, bool value) {
142 streams[streamId] = value; 124 streams[streamId] = value;
143 } 125 }
144 126
145 Map<String, CompilationUnitElement> scripts = 127 Map<String, CompilationUnitElement> scripts =
146 new Map<String, CompilationUnitElement>(); 128 new Map<String, CompilationUnitElement>();
147 129
148 Map frameDesc(BackTraceFrame frame, int index) { 130 Future<Map> frameDesc(BackTraceFrame frame, int index) async {
149 List<Map> vars = new List<Map>(); 131 List<Map> vars = new List<Map>();
150 for (ScopeInfo current = frame.scopeInfo(); 132 for (ScopeInfo current = frame.scopeInfo();
151 current != ScopeInfo.sentinel; 133 current != ScopeInfo.sentinel;
152 current = current.previous) { 134 current = current.previous) {
135 RemoteValue remoteValue =
136 await vmContext.processLocal(index, current.local.slot);
153 vars.add({ 137 vars.add({
154 "type": "BoundVariable", 138 "type": "BoundVariable",
155 "name": current.name, 139 "name": current.name,
156 "value": valueDesc(current.lookup(current.name)) 140 "value": instanceRef(
141 remoteValue.value, "objects/$index.${current.local.slot}"),
157 }); 142 });
143 print("Adding ${vars.last}");
Søren Gjesse 2016/06/15 11:26:18 Debug print.
sigurdm 2016/06/17 07:29:32 Done.
158 } 144 }
159 return { 145 return {
160 "type": "Frame", 146 "type": "Frame",
161 "index": index, 147 "index": index,
162 "function": functionRef(frame.function), 148 "function": functionRef(frame.function),
163 "code": { 149 "code": {
164 "id": "code-id", //TODO(danrubel): what is the unique id here? 150 "id": "code-id", //TODO(danrubel): what is the unique id here?
165 "type": "@Code", 151 "type": "@Code",
166 "name": "code-name", // TODO(sigurdm): How to create a name here? 152 "name": "code-name", // TODO(sigurdm): How to create a name here?
167 "kind": "Dart", 153 "kind": "Dart",
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 "type": "Function", 317 "type": "Function",
332 "id": "functions/${function.functionId}", 318 "id": "functions/${function.functionId}",
333 // TODO(sigurdm): All kinds of owner. 319 // TODO(sigurdm): All kinds of owner.
334 "owner": libraryRef(element.library), 320 "owner": libraryRef(element.library),
335 "static": element.isStatic, 321 "static": element.isStatic,
336 "const": element.isConst, 322 "const": element.isConst,
337 "_kind": functionKind(function.kind), 323 "_kind": functionKind(function.kind),
338 }; 324 };
339 } 325 }
340 326
341 Map valueDesc(LocalValue lookup) { 327 Map classRef(ClassElement classElement) {
342 //TODO(danrubel): Translate local value into description? 328 if (classElement == null) {
343 // Need to return an @InstanceRef or Sentinel 329 return {"type": "@Class", "id": "unknown", "name": "unknown class"};
344 return nullRefDesc; 330 }
331 String symbolicName =
332 "${classElement.library.canonicalUri}.${classElement.name}";
333 return {
334 "type": "@Class",
335 "id": "classes/$symbolicName",
336 "name": "${classElement.name}",
337 };
338 }
339
340 Map instanceRef(DartValue value, String id) {
341 int classId;
342 Element classElement;
343 String stringValue;
344 String kind;
345 int length;
346 String name;
347 if (value is Instance) {
348 kind = "PlainInstance";
349 classId = value.classId;
350 } else if (value is Integer) {
351 kind = "Int";
352 classElement = vmContext.compiler.compiler.backend.intImplementation;
353 stringValue = "${value.value}";
354 } else if (value is StringValue) {
355 kind = "String";
356 classElement = vmContext.compiler.compiler.backend.stringImplementation;
357 stringValue = value.value;
358 } else if (value is Boolean) {
359 kind = "Bool";
360 classElement = vmContext.compiler.compiler.backend.boolImplementation;
361 stringValue = "${value.value}";
362 } else if (value is Double) {
363 kind = "Double";
364 classElement = vmContext.compiler.compiler.backend.doubleImplementation;
365 stringValue = "${value.value}";
366 } else if (value is ClassValue) {
367 kind = "Type";
368 Element element =
369 vmContext.dartinoSystem.classesById[value.classId].element;
370 classElement = vmContext.compiler.compiler.backend.typeImplementation;
371 name = "${element}";
372 } else if (value is NullValue) {
373 kind = "Null";
374 classElement = vmContext.compiler.compiler.backend.nullImplementation;
375 stringValue = "null";
376 } else if (value is Array) {
377 kind = "List";
378 classElement = vmContext.compiler.compiler.backend.listImplementation;
379 length = value.length;
380 } else {
381 throw "Unexpected remote value $value";
382 }
383 print("classId $classId element $classElement");
Søren Gjesse 2016/06/15 11:26:18 Debug print.
sigurdm 2016/06/17 07:29:32 Done.
384 Map classReference = classRef(
385 classElement ?? vmContext.dartinoSystem.classesById[classId]?.element);
386 Map result = {
387 "type": "@Instance",
388 "id": id,
389 "kind": kind,
390 "class": classReference,
391 };
392 if (stringValue != null) {
393 result["valueAsString"] = stringValue;
394 }
395 if (length != null) {
396 result["length"] = length;
397 }
398 if (name != null) {
399 result["name"] = name;
400 }
401 return result;
402 }
403
404 Map instanceDesc(RemoteObject remoteObject, String id) {
405 // TODO(sigurdm): Allow inspecting any frame.
406 assert(remoteObject is! RemoteErrorObject);
407 if (remoteObject is RemoteInstance) {
408 int classId = remoteObject.instance.classId;
409 Element classElement =
410 vmContext.dartinoSystem.classesById[classId].element;
411 List<FieldElement> fieldElements = computeFields(classElement);
412 assert(fieldElements.length == remoteObject.fields.length);
413 List fields = new List();
414 for (int i = 0; i < fieldElements.length; i++) {
415 FieldElement fieldElement = fieldElements[i];
416 fields.add({
417 "type": "BoundField",
418 "decl": {
419 "type": "@Field",
420 "name": fieldElement.name,
421 "owner": classRef(fieldElement.contextClass),
422 "declaredType": null, // TODO(sigurdm): fill this in.
423 "const": fieldElement.isConst,
424 "final": fieldElement.isFinal,
425 "static": fieldElement.isStatic,
426 },
427 "value": instanceRef(remoteObject.fields[i], "$id.$i"),
428 });
429 }
430 return <String, dynamic>{
431 "type": "Instance",
432 "id": id,
433 "kind": "PlainInstance",
434 "class": classRef(classElement),
435 "fields": fields,
436 };
437 } else if (remoteObject is RemoteArray) {
Søren Gjesse 2016/06/15 11:26:18 Probably want to have a TODO on handling large arr
sigurdm 2016/06/17 07:29:32 Added TODO.
438 List elements = new List();
439 for (int i = 0; i < remoteObject.array.length; i++) {
440 elements.add(instanceRef(remoteObject.values[i], "$id.$i"));
441 }
442 return <String, dynamic>{
443 "type": "Instance",
444 "id": id,
445 "kind": "List",
446 "class":
447 classRef(vmContext.compiler.compiler.backend.listImplementation),
448 "elements": elements,
449 };
450 } else if (remoteObject is RemoteValue) {
451 Map instance = instanceRef(remoteObject.value, id);
452 instance["type"] = "Instance";
453 return instance;
454 } else {
455 throw "Unexpected remote object kind";
456 }
345 } 457 }
346 458
347 initialize(DartinoCompilerImplementation compiler) { 459 initialize(DartinoCompilerImplementation compiler) {
348 for (LibraryElement library in compiler.libraryLoader.libraries) { 460 for (LibraryElement library in compiler.libraryLoader.libraries) {
349 cacheScripts(LibraryElement library) { 461 cacheScripts(LibraryElement library) {
350 for (CompilationUnitElement compilationUnit 462 for (CompilationUnitElement compilationUnit
351 in library.compilationUnits) { 463 in library.compilationUnits) {
352 Uri uri = compilationUnit.script.file.uri; 464 Uri uri = compilationUnit.script.file.uri;
353 scripts["scripts/$uri"] = compilationUnit; 465 scripts["scripts/$uri"] = compilationUnit;
354 tokenTables[uri] = makeTokenTable(compilationUnit); 466 tokenTables[uri] = makeTokenTable(compilationUnit);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 .lookupLibrary(Uri.parse(uri)))); 609 .lookupLibrary(Uri.parse(uri))));
498 break; 610 break;
499 case "scripts": 611 case "scripts":
500 sendResult(scriptDesc(scripts[id])); 612 sendResult(scriptDesc(scripts[id]));
501 break; 613 break;
502 case "functions": 614 case "functions":
503 sendResult(functionDesc(vmContext.dartinoSystem.functionsById[ 615 sendResult(functionDesc(vmContext.dartinoSystem.functionsById[
504 int.parse(id.substring(slashIndex + 1))])); 616 int.parse(id.substring(slashIndex + 1))]));
505 break; 617 break;
506 case "objects": 618 case "objects":
507 if (id == nullId) { 619 String path = id.substring(slashIndex + 1);
508 sendResult(nullDesc); 620 List<int> dotted = path.split(".").map(int.parse).toList();
509 } else { 621 int localFrame = dotted.first;
510 //TODO(danrubel): Need to return an Instance description 622 int localSlot = dotted[1];
511 // or Sentinel for the given @InstanceRef 623 List<int> fieldAccesses = dotted.skip(2).toList();
512 throw 'Unknown object: $id'; 624 RemoteObject remoteObject = await vmContext.processLocalStructure(
513 } 625 localFrame, localSlot,
626 fieldAccesses: fieldAccesses);
627 sendResult(instanceDesc(remoteObject, id));
514 break; 628 break;
515 default: 629 default:
516 throw "Unsupported object type $id"; 630 throw "Unsupported object type $id";
517 } 631 }
518 break; 632 break;
519 case "getStack": 633 case "getStack":
520 String isolateIdString = decodedMessage["params"]["isolateId"]; 634 String isolateIdString = decodedMessage["params"]["isolateId"];
521 int isolateId = int.parse( 635 int isolateId = int.parse(
522 isolateIdString.substring(isolateIdString.indexOf("/") + 1)); 636 isolateIdString.substring(isolateIdString.indexOf("/") + 1));
523 BackTrace backTrace = 637 BackTrace backTrace =
524 await state.vmContext.backTrace(processId: isolateId); 638 await state.vmContext.backTrace(processId: isolateId);
525 List frames = []; 639 List frames = [];
526 int index = 0; 640 int index = 0;
527 for (BackTraceFrame frame in backTrace.frames) { 641 for (BackTraceFrame frame in backTrace.frames) {
528 frames.add(frameDesc(frame, index)); 642 frames.add(await frameDesc(frame, index));
529 index++; 643 index++;
530 } 644 }
531 645
532 sendResult({"type": "Stack", "frames": frames, "messages": [],}); 646 sendResult({"type": "Stack", "frames": frames, "messages": [],});
533 break; 647 break;
534 case "getSourceReport": 648 case "getSourceReport":
535 String scriptId = decodedMessage["params"]["scriptId"]; 649 String scriptId = decodedMessage["params"]["scriptId"];
536 CompilationUnitElement compilationUnit = scripts[scriptId]; 650 CompilationUnitElement compilationUnit = scripts[scriptId];
537 Uri scriptUri = compilationUnit.script.file.uri; 651 Uri scriptUri = compilationUnit.script.file.uri;
538 List<int> tokenTable = tokenTables[scriptUri]; 652 List<int> tokenTable = tokenTables[scriptUri];
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // TODO(sigurdm): Implement gc notification. 817 // TODO(sigurdm): Implement gc notification.
704 } 818 }
705 819
706 @override 820 @override
707 lostConnection() { 821 lostConnection() {
708 socket.close(); 822 socket.close();
709 } 823 }
710 824
711 @override 825 @override
712 pauseBreakpoint( 826 pauseBreakpoint(
713 int processId, BackTraceFrame topFrame, Breakpoint breakpoint) { 827 int processId, BackTraceFrame topFrame, Breakpoint breakpoint) async {
714 //TODO(danrubel): are there any other breakpoints 828 //TODO(danrubel): are there any other breakpoints
715 // at which we are currently paused for a PauseBreakpoint event? 829 // at which we are currently paused for a PauseBreakpoint event?
716 List<Breakpoint> pauseBreakpoints = <Breakpoint>[]; 830 List<Breakpoint> pauseBreakpoints = <Breakpoint>[];
717 pauseBreakpoints.add(breakpoint); 831 pauseBreakpoints.add(breakpoint);
718 Map event = { 832 Map event = {
719 "type": "Event", 833 "type": "Event",
720 "kind": "PauseBreakpoint", 834 "kind": "PauseBreakpoint",
721 "isolate": isolateRef(processId), 835 "isolate": isolateRef(processId),
722 "timestamp": new DateTime.now().millisecondsSinceEpoch, 836 "timestamp": new DateTime.now().millisecondsSinceEpoch,
723 "topFrame": frameDesc(topFrame, 0), 837 "topFrame": await frameDesc(topFrame, 0),
724 "atAsyncSuspension": false, 838 "atAsyncSuspension": false,
725 "breakpoint": breakpointDesc(breakpoint), 839 "breakpoint": breakpointDesc(breakpoint),
726 "pauseBreakpoints": 840 "pauseBreakpoints":
727 new List.from(pauseBreakpoints.map((bp) => breakpointDesc(bp))), 841 new List.from(pauseBreakpoints.map((bp) => breakpointDesc(bp))),
728 }; 842 };
729 lastPauseEvent = event; 843 lastPauseEvent = event;
730 streamNotify("Debug", event); 844 streamNotify("Debug", event);
731 } 845 }
732 846
733 @override 847 @override
734 pauseException(int processId, BackTraceFrame topFrame, RemoteObject thrown) { 848 pauseException(
849 int processId, BackTraceFrame topFrame, RemoteObject thrown) async {
735 Map event = { 850 Map event = {
736 "type": "Event", 851 "type": "Event",
737 "kind": "PauseException", 852 "kind": "PauseException",
738 "isolate": isolateRef(processId), 853 "isolate": isolateRef(processId),
739 "timestamp": new DateTime.now().millisecondsSinceEpoch, 854 "timestamp": new DateTime.now().millisecondsSinceEpoch,
740 "topFrame": frameDesc(topFrame, 0), 855 "topFrame": await frameDesc(topFrame, 0),
741 "atAsyncSuspension": false, 856 "atAsyncSuspension": false,
742 // TODO(sigurdm): pass thrown as an instance. 857 // TODO(sigurdm): pass thrown as an instance.
743 }; 858 };
744 streamNotify("Debug", event); 859 streamNotify("Debug", event);
745 } 860 }
746 861
747 @override 862 @override
748 pauseExit(int processId, BackTraceFrame topFrame) { 863 pauseExit(int processId, BackTraceFrame topFrame) {
749 // TODO(sigurdm): implement pauseExit 864 // TODO(sigurdm): implement pauseExit
750 } 865 }
751 866
752 @override 867 @override
753 pauseInterrupted(int processId, BackTraceFrame topFrame) { 868 pauseInterrupted(int processId, BackTraceFrame topFrame) async {
754 Map event = { 869 Map event = {
755 "type": "Event", 870 "type": "Event",
756 "kind": "PauseInterrupted", 871 "kind": "PauseInterrupted",
757 "isolate": isolateRef(processId), 872 "isolate": isolateRef(processId),
758 "timestamp": new DateTime.now().millisecondsSinceEpoch, 873 "timestamp": new DateTime.now().millisecondsSinceEpoch,
759 "topFrame": frameDesc(topFrame, 0), 874 "topFrame": await frameDesc(topFrame, 0),
760 "atAsyncSuspension": false, 875 "atAsyncSuspension": false,
761 }; 876 };
762 lastPauseEvent = event; 877 lastPauseEvent = event;
763 streamNotify("Debug", event); 878 streamNotify("Debug", event);
764 } 879 }
765 880
766 @override 881 @override
767 pauseStart(int processId) { 882 pauseStart(int processId) {
768 Map event = { 883 Map event = {
769 "type": "Event", 884 "type": "Event",
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 processStart(int processId) { 916 processStart(int processId) {
802 streamNotify("Isolate", { 917 streamNotify("Isolate", {
803 "type": "Event", 918 "type": "Event",
804 "kind": "IsolateStart", 919 "kind": "IsolateStart",
805 "isolate": isolateRef(processId), 920 "isolate": isolateRef(processId),
806 "timestamp": new DateTime.now().millisecondsSinceEpoch, 921 "timestamp": new DateTime.now().millisecondsSinceEpoch,
807 }); 922 });
808 } 923 }
809 924
810 @override 925 @override
811 resume(int processId) { 926 resume(int processId) async {
812 Map event = { 927 Map event = {
813 "type": "Event", 928 "type": "Event",
814 "kind": "Resume", 929 "kind": "Resume",
815 "isolate": isolateRef(processId), 930 "isolate": isolateRef(processId),
816 "timestamp": new DateTime.now().millisecondsSinceEpoch, 931 "timestamp": new DateTime.now().millisecondsSinceEpoch,
817 }; 932 };
818 BackTraceFrame topFrame = vmContext.debugState.topFrame; 933 BackTraceFrame topFrame = vmContext.debugState.topFrame;
819 if (topFrame != null) { 934 if (topFrame != null) {
820 event["topFrame"] = frameDesc(vmContext.debugState.topFrame, 0); 935 event["topFrame"] = await frameDesc(vmContext.debugState.topFrame, 0);
821 } 936 }
822 lastPauseEvent = event; 937 lastPauseEvent = event;
823 streamNotify("Debug", event); 938 streamNotify("Debug", event);
824 } 939 }
825 940
826 @override 941 @override
827 writeStdErr(int processId, List<int> data) { 942 writeStdErr(int processId, List<int> data) {
828 Map event = { 943 Map event = {
829 "type": "Event", 944 "type": "Event",
830 "kind": "WriteEvent", 945 "kind": "WriteEvent",
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 987 }
873 988
874 visitScopeContainerElement(ScopeContainerElement e, _) { 989 visitScopeContainerElement(ScopeContainerElement e, _) {
875 e.forEachLocalMember(visit); 990 e.forEachLocalMember(visit);
876 } 991 }
877 992
878 visitCompilationUnitElement(CompilationUnitElement e, _) { 993 visitCompilationUnitElement(CompilationUnitElement e, _) {
879 e.forEachLocalMember(visit); 994 e.forEachLocalMember(visit);
880 } 995 }
881 } 996 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698