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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/debugger.dart
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index a11f046e66d5616d4b669b5be9bcde23239f5564..3425aa499e46d37ae00eedfbbc01966e6440c549 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -349,6 +349,35 @@ class StepCommand extends DebuggerCommand {
'Syntax: step\n';
}
+class AsyncStepCommand extends DebuggerCommand {
+ AsyncStepCommand(Debugger debugger) : super(debugger, 'astep', []) {
+ }
+
+ Future run(List<String> args) async {
+ if (debugger.isolatePaused()) {
+ var event = debugger.isolate.pauseEvent;
+ if (event.asyncContinuation == null) {
+ debugger.console.print("No async continuation at this location");
+ return;
+ }
+ var bpt = await
+ debugger.isolate.addBreakOnActivation(event.asyncContinuation);
+ return debugger.isolate.resume();
+ } else {
+ debugger.console.print('The program is already running');
+ }
+ }
+
+ String helpShort =
+ 'Step into asynchronous continuation';
+
+ String helpLong =
+ 'Continue running the isolate until control returns to the current '
+ 'activation of an async or async* function.\n'
+ '\n'
+ 'Syntax: astep\n';
+}
+
class FinishCommand extends DebuggerCommand {
FinishCommand(Debugger debugger) : super(debugger, 'finish', []);
@@ -950,6 +979,7 @@ class ObservatoryDebugger extends Debugger {
new ContinueCommand(this),
new NextCommand(this),
new StepCommand(this),
+ new AsyncStepCommand(this),
new FinishCommand(this),
new BreakCommand(this),
new SetCommand(this),
@@ -1102,6 +1132,10 @@ class ObservatoryDebugger extends Debugger {
} else {
console.print('Paused at ${script.name}:${line}:${col}');
}
+ 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.
+ console.print("Async continuation: ");
+ console.printRef(event.asyncContinuation);
+ }
});
}
}

Powered by Google App Engine
This is Rietveld 408576698