| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/debugger.h" | 5 #include "vm/debugger.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 target_function.token_pos(), | 1959 target_function.token_pos(), |
| 1960 target_function.end_token_pos()); | 1960 target_function.end_token_pos()); |
| 1961 if (single_shot) { | 1961 if (single_shot) { |
| 1962 return bpt_location->AddSingleShot(this); | 1962 return bpt_location->AddSingleShot(this); |
| 1963 } else { | 1963 } else { |
| 1964 return bpt_location->AddRepeated(this); | 1964 return bpt_location->AddRepeated(this); |
| 1965 } | 1965 } |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 | 1968 |
| 1969 Breakpoint* Debugger::SetBreakpointAtActivation( | 1969 Breakpoint* Debugger::SetBreakpointAtActivation(const Instance& closure) { |
| 1970 const Instance& closure) { | |
| 1971 if (!closure.IsClosure()) { | 1970 if (!closure.IsClosure()) { |
| 1972 return NULL; | 1971 return NULL; |
| 1973 } | 1972 } |
| 1974 const Function& func = Function::Handle(Closure::function(closure)); | 1973 const Function& func = Function::Handle(Closure::function(closure)); |
| 1975 const Script& script = Script::Handle(func.script()); | 1974 const Script& script = Script::Handle(func.script()); |
| 1976 BreakpointLocation* bpt = SetBreakpoint(script, | 1975 BreakpointLocation* bpt_location = SetBreakpoint(script, |
| 1977 func.token_pos(), | 1976 func.token_pos(), |
| 1978 func.end_token_pos()); | 1977 func.end_token_pos()); |
| 1979 return bpt->AddPerClosure(this, closure); | 1978 return bpt_location->AddPerClosure(this, closure); |
| 1980 } | 1979 } |
| 1981 | 1980 |
| 1982 | 1981 |
| 1982 Breakpoint* Debugger::BreakpointAtActivation(const Instance& closure) { |
| 1983 if (!closure.IsClosure()) { |
| 1984 return NULL; |
| 1985 } |
| 1986 |
| 1987 BreakpointLocation* loc = breakpoint_locations_; |
| 1988 while (loc != NULL) { |
| 1989 Breakpoint* bpt = loc->breakpoints(); |
| 1990 while (bpt != NULL) { |
| 1991 if (bpt->IsPerClosure()) { |
| 1992 if (closure.raw() == bpt->closure()) { |
| 1993 return bpt; |
| 1994 } |
| 1995 } |
| 1996 bpt = bpt->next(); |
| 1997 } |
| 1998 loc = loc->next(); |
| 1999 } |
| 2000 |
| 2001 return NULL; |
| 2002 } |
| 2003 |
| 2004 |
| 1983 Breakpoint* Debugger::SetBreakpointAtLine(const String& script_url, | 2005 Breakpoint* Debugger::SetBreakpointAtLine(const String& script_url, |
| 1984 intptr_t line_number) { | 2006 intptr_t line_number) { |
| 1985 BreakpointLocation* loc = BreakpointLocationAtLine(script_url, line_number); | 2007 BreakpointLocation* loc = BreakpointLocationAtLine(script_url, line_number); |
| 1986 if (loc != NULL) { | 2008 if (loc != NULL) { |
| 1987 return loc->AddRepeated(this); | 2009 return loc->AddRepeated(this); |
| 1988 } | 2010 } |
| 1989 return NULL; | 2011 return NULL; |
| 1990 } | 2012 } |
| 1991 | 2013 |
| 1992 | 2014 |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 } | 2991 } |
| 2970 | 2992 |
| 2971 | 2993 |
| 2972 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2994 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 2973 ASSERT(bpt->next() == NULL); | 2995 ASSERT(bpt->next() == NULL); |
| 2974 bpt->set_next(code_breakpoints_); | 2996 bpt->set_next(code_breakpoints_); |
| 2975 code_breakpoints_ = bpt; | 2997 code_breakpoints_ = bpt; |
| 2976 } | 2998 } |
| 2977 | 2999 |
| 2978 } // namespace dart | 3000 } // namespace dart |
| OLD | NEW |