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

Side by Side Diff: runtime/observatory/lib/src/elements/debugger.dart

Issue 1241673003: Async-step, first cut. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library debugger_page_element; 5 library debugger_page_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/cli.dart'; 10 import 'package:observatory/cli.dart';
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 String helpShort = 342 String helpShort =
343 'Continue running the isolate until it reaches the next source location'; 343 'Continue running the isolate until it reaches the next source location';
344 344
345 String helpLong = 345 String helpLong =
346 'Continue running the isolate until it reaches the next source ' 346 'Continue running the isolate until it reaches the next source '
347 'location.\n' 347 'location.\n'
348 '\n' 348 '\n'
349 'Syntax: step\n'; 349 'Syntax: step\n';
350 } 350 }
351 351
352 class AsyncStepCommand extends DebuggerCommand {
353 AsyncStepCommand(Debugger debugger) : super(debugger, 'astep', []) {
354 }
355
356 Future run(List<String> args) async {
357 if (debugger.isolatePaused()) {
358 var event = debugger.isolate.pauseEvent;
359 if (event.asyncContinuation == null) {
360 debugger.console.print("No async continuation at this location");
361 return;
362 }
363 var bpt = await
364 debugger.isolate.addBreakOnActivation(event.asyncContinuation);
365 return debugger.isolate.resume();
366 } else {
367 debugger.console.print('The program is already running');
368 }
369 }
370
371 String helpShort =
372 'Step into asynchronous continuation';
373
374 String helpLong =
375 'Continue running the isolate until control returns to the current '
376 'activation of an async or async* function.\n'
377 '\n'
378 'Syntax: astep\n';
379 }
380
352 class FinishCommand extends DebuggerCommand { 381 class FinishCommand extends DebuggerCommand {
353 FinishCommand(Debugger debugger) : super(debugger, 'finish', []); 382 FinishCommand(Debugger debugger) : super(debugger, 'finish', []);
354 383
355 Future run(List<String> args) { 384 Future run(List<String> args) {
356 if (debugger.isolatePaused()) { 385 if (debugger.isolatePaused()) {
357 return debugger.isolate.stepOut(); 386 return debugger.isolate.stepOut();
358 } else { 387 } else {
359 debugger.console.print('The program is already running'); 388 debugger.console.print('The program is already running');
360 return new Future.value(null); 389 return new Future.value(null);
361 } 390 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 cmd = new RootCommand([ 972 cmd = new RootCommand([
944 new HelpCommand(this), 973 new HelpCommand(this),
945 new PrintCommand(this), 974 new PrintCommand(this),
946 new DownCommand(this), 975 new DownCommand(this),
947 new UpCommand(this), 976 new UpCommand(this),
948 new FrameCommand(this), 977 new FrameCommand(this),
949 new PauseCommand(this), 978 new PauseCommand(this),
950 new ContinueCommand(this), 979 new ContinueCommand(this),
951 new NextCommand(this), 980 new NextCommand(this),
952 new StepCommand(this), 981 new StepCommand(this),
982 new AsyncStepCommand(this),
953 new FinishCommand(this), 983 new FinishCommand(this),
954 new BreakCommand(this), 984 new BreakCommand(this),
955 new SetCommand(this), 985 new SetCommand(this),
956 new ClearCommand(this), 986 new ClearCommand(this),
957 new DeleteCommand(this), 987 new DeleteCommand(this),
958 new InfoCommand(this), 988 new InfoCommand(this),
959 new IsolateCommand(this), 989 new IsolateCommand(this),
960 new RefreshCommand(this), 990 new RefreshCommand(this),
961 ]); 991 ]);
962 _stdioPrinter = new _VMStreamPrinter(this); 992 _stdioPrinter = new _VMStreamPrinter(this);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } else if (event.exception != null) { 1125 } else if (event.exception != null) {
1096 console.print('Paused due to exception at ' 1126 console.print('Paused due to exception at '
1097 '${script.name}:${line}:${col}'); 1127 '${script.name}:${line}:${col}');
1098 // This seems to be missing if we are paused-at-exception after 1128 // This seems to be missing if we are paused-at-exception after
1099 // paused-at-isolate-exit. Maybe we shutdown part of the debugger too 1129 // paused-at-isolate-exit. Maybe we shutdown part of the debugger too
1100 // soon? 1130 // soon?
1101 console.printRef(event.exception); 1131 console.printRef(event.exception);
1102 } else { 1132 } else {
1103 console.print('Paused at ${script.name}:${line}:${col}'); 1133 console.print('Paused at ${script.name}:${line}:${col}');
1104 } 1134 }
1135 if (event.asyncContinuation != null) {
1136 console.print("Paused in async function: 'astep' available");
1137 }
1105 }); 1138 });
1106 } 1139 }
1107 } 1140 }
1108 1141
1109 Future _reportBreakpointEvent(ServiceEvent event) { 1142 Future _reportBreakpointEvent(ServiceEvent event) {
1110 var bpt = event.breakpoint; 1143 var bpt = event.breakpoint;
1111 var verb = null; 1144 var verb = null;
1112 switch (event.kind) { 1145 switch (event.kind) {
1113 case ServiceEvent.kBreakpointAdded: 1146 case ServiceEvent.kBreakpointAdded:
1114 verb = 'added'; 1147 verb = 'added';
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 }); 1884 });
1852 } 1885 }
1853 1886
1854 void focus() { 1887 void focus() {
1855 $['textBox'].focus(); 1888 $['textBox'].focus();
1856 } 1889 }
1857 1890
1858 DebuggerInputElement.created() : super.created(); 1891 DebuggerInputElement.created() : super.created();
1859 } 1892 }
1860 1893
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/cli/command.dart ('k') | runtime/observatory/lib/src/service/object.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698