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

Unified Diff: runtime/vm/debugger.cc

Issue 65343002: Fix breakpoints in mixin methods (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 30068)
+++ runtime/vm/debugger.cc (working copy)
@@ -1961,6 +1961,29 @@
}
+static RawFunction* GetOriginalFunction(const Function& func) {
+ const Class& origin_class = Class::Handle(func.origin());
+ if (origin_class.is_patch()) {
+ // Patched functions from patch classes are removed from the
+ // function array of the patch class, so we will not find an
+ // original function object.
+ return func.raw();
+ }
+ const Array& functions = Array::Handle(origin_class.functions());
+ Object& orig_func = Object::Handle();
+ for (intptr_t i = 0; i < functions.Length(); i++) {
+ orig_func = functions.At(i);
+ // Function names are symbols, so we can compare the raw pointers.
+ if (func.name() == Function::Cast(orig_func).name()) {
+ return Function::Cast(orig_func).raw();
+ }
+ }
+ // Uncommon case: not a mixin function.
+ ASSERT(!Class::Handle(func.Owner()).IsMixinApplication());
+ return func.raw();
+}
+
+
void Debugger::NotifyCompilation(const Function& func) {
if (src_breakpoints_ == NULL) {
// Return with minimal overhead if there are no breakpoints.
@@ -1976,6 +1999,12 @@
lookup_function = func.parent_function();
ASSERT(!lookup_function.IsNull());
}
+ if (lookup_function.Owner() != lookup_function.origin()) {
+ // This is a cloned function from a mixin class. If a breakpoint
+ // was set in this function, it is registered using the function
+ // of the origin class.
+ lookup_function = GetOriginalFunction(lookup_function);
+ }
SourceBreakpoint* bpt = src_breakpoints_;
while (bpt != NULL) {
if (lookup_function.raw() == bpt->function()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698