OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 Loading... | |
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) { | |
rmacnak
2015/07/15 16:32:50
This was mostly for debugging. Not sure if it shou
Cutch
2015/07/15 17:04:23
I'd rater have something more user friendly:
'Pau
rmacnak
2015/07/16 19:42:17
Done.
| |
1136 console.print("Async continuation: "); | |
1137 console.printRef(event.asyncContinuation); | |
1138 } | |
1105 }); | 1139 }); |
1106 } | 1140 } |
1107 } | 1141 } |
1108 | 1142 |
1109 Future _reportBreakpointEvent(ServiceEvent event) { | 1143 Future _reportBreakpointEvent(ServiceEvent event) { |
1110 var bpt = event.breakpoint; | 1144 var bpt = event.breakpoint; |
1111 var verb = null; | 1145 var verb = null; |
1112 switch (event.kind) { | 1146 switch (event.kind) { |
1113 case ServiceEvent.kBreakpointAdded: | 1147 case ServiceEvent.kBreakpointAdded: |
1114 verb = 'added'; | 1148 verb = 'added'; |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1851 }); | 1885 }); |
1852 } | 1886 } |
1853 | 1887 |
1854 void focus() { | 1888 void focus() { |
1855 $['textBox'].focus(); | 1889 $['textBox'].focus(); |
1856 } | 1890 } |
1857 | 1891 |
1858 DebuggerInputElement.created() : super.created(); | 1892 DebuggerInputElement.created() : super.created(); |
1859 } | 1893 } |
1860 | 1894 |
OLD | NEW |