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

Unified Diff: runtime/vm/debugger.cc

Issue 2768103002: Debugger support for step-into async and async* functions. (Closed)
Patch Set: asiva review Created 3 years, 9 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/vm/debugger.h ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 7cce4af2d10ae90f839ab2cd35f4afc9d6d1e53f..bf3acd3ad5e839e6c4fea426cbeaf52b29994c3b 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -1590,6 +1590,41 @@ void Debugger::Shutdown() {
}
+void Debugger::OnIsolateRunnable() {
+ if (!FLAG_async_debugger_stepping) {
+ // We don't have async debugger stepping enabled.
+ return;
+ }
+ Thread::EnterIsolate(isolate_);
+ Thread* thread = Thread::Current();
+ ASSERT(thread != NULL);
+ {
+ StackZone zone(thread);
+ HandleScope handle_scope(thread);
+
+ const Library& async_lib =
+ Library::Handle(zone.GetZone(), Library::AsyncLibrary());
+ // Grab the _AsyncStarStreamController class.
+ const Class& controller_class = Class::Handle(
+ zone.GetZone(), async_lib.LookupClassAllowPrivate(
+ Symbols::_AsyncStarStreamController()));
+ const Array& functions =
+ Array::Handle(zone.GetZone(), controller_class.functions());
+ Function& function = Function::Handle(zone.GetZone());
+ // Mark all functions as not debuggable or inlinable.
+ for (intptr_t i = 0; i < functions.Length(); i++) {
+ function ^= functions.At(i);
+ if (function.IsNull()) {
+ break;
+ }
+ function.set_is_debuggable(false);
+ function.set_is_inlinable(false);
+ }
+ }
+ Thread::ExitIsolate();
+}
+
+
static RawFunction* ResolveLibraryFunction(const Library& library,
const String& fname) {
ASSERT(!library.IsNull());
@@ -4102,6 +4137,23 @@ Breakpoint* Debugger::GetBreakpointById(intptr_t id) {
}
+void Debugger::MaybeAsyncStepInto(const Closure& async_op) {
+ if (FLAG_async_debugger_stepping && IsSingleStepping()) {
+ // We are single stepping, set a breakpoint on the closure activation
+ // and resume execution so we can hit the breakpoint.
+ SetBreakpointAtActivation(async_op, true);
+ Continue();
+ }
+}
+
+
+void Debugger::Continue() {
+ SetResumeAction(kContinue);
+ stepping_fp_ = 0;
+ isolate_->set_single_step(false);
+}
+
+
BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url,
intptr_t line,
intptr_t column) {
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698