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

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
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..31bcd91b35f0630321419215ee7897d0dcf085e9 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,9 @@ class ObservatoryDebugger extends Debugger {
} else {
console.print('Paused at ${script.name}:${line}:${col}');
}
+ if (event.asyncContinuation != null) {
+ console.print("Paused in async function: 'astep' available");
+ }
});
}
}
« 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