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

Unified Diff: runtime/vm/debugger.cc

Issue 9716004: Properly recognize closures when setting breakpoints (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 5528)
+++ runtime/vm/debugger.cc (working copy)
@@ -73,6 +73,11 @@
}
+void SourceBreakpoint::set_function(const Function& func) {
+ function_ = func.raw();
+}
+
+
void SourceBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) {
visitor->VisitPointer(reinterpret_cast<RawObject**>(&function_));
}
@@ -936,7 +941,7 @@
return;
}
Function& lookup_function = Function::Handle(func.raw());
- if (func.IsClosureFunction()) {
+ if (func.IsImplicitClosureFunction()) {
regis 2012/03/16 22:04:01 I do not understand why you changed this test. The
hausner 2012/03/16 22:20:58 Updated the comment.
// If the newly compiled function is a closure, we need to use
// the closure's parent function to see whether there are any
// breakpoints.
@@ -945,15 +950,28 @@
SourceBreakpoint* bpt = src_breakpoints_;
while (bpt != NULL) {
if (lookup_function.raw() == bpt->function()) {
- if (verbose) {
- OS::Print("Enable latent breakpoint for function '%s'\n",
- String::Handle(lookup_function.name()).ToCString());
+ // Check if the breakpoint is inside a closure or local function
regis 2012/03/16 22:04:01 Indentation
hausner 2012/03/16 22:20:58 Done.
+ // within the newly compiled function.
+ Class& owner = Class::Handle(lookup_function.owner());
+ Function& closure =
+ Function::Handle(owner.LookupClosureFunction(bpt->token_index()));
+ if (!closure.IsNull() && (closure.raw() != lookup_function.raw())) {
+ if (verbose) {
+ OS::Print("Resetting pending breakpoint to function %s\n",
+ String::Handle(closure.name()).ToCString());
+ }
+ bpt->set_function(closure);
+ } else {
+ if (verbose) {
+ OS::Print("Enable pending breakpoint for function '%s'\n",
+ String::Handle(lookup_function.name()).ToCString());
+ }
+ // Set breakpoint in newly compiled code of function func.
+ CodeBreakpoint* cbpt = MakeCodeBreakpoint(func, bpt->token_index());
+ if (cbpt != NULL) {
+ cbpt->set_src_bpt(bpt);
+ }
}
- // Set breakpoint in newly compiled code of function func.
- CodeBreakpoint* cbpt = MakeCodeBreakpoint(func, bpt->token_index());
- if (cbpt != NULL) {
- cbpt->set_src_bpt(bpt);
- }
bpt->Enable(); // Enables the code breakpoint as well.
}
bpt = bpt->next();

Powered by Google App Engine
This is Rietveld 408576698