| 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 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 // Don't pause recursively. | 1987 // Don't pause recursively. |
| 1988 if (IsPaused()) return; | 1988 if (IsPaused()) return; |
| 1989 | 1989 |
| 1990 // Check whether we are in a Dart function that the user is | 1990 // Check whether we are in a Dart function that the user is |
| 1991 // interested in. If we saved the frame pointer of a stack frame | 1991 // interested in. If we saved the frame pointer of a stack frame |
| 1992 // the user is interested in, we ignore the single step if we are | 1992 // the user is interested in, we ignore the single step if we are |
| 1993 // in a callee of that frame. Note that we assume that the stack | 1993 // in a callee of that frame. Note that we assume that the stack |
| 1994 // grows towards lower addresses. | 1994 // grows towards lower addresses. |
| 1995 ActivationFrame* frame = TopDartFrame(); | 1995 ActivationFrame* frame = TopDartFrame(); |
| 1996 ASSERT(frame != NULL); | 1996 ASSERT(frame != NULL); |
| 1997 if ((stepping_fp_ != 0) && (stepping_fp_ > frame->fp())) { | 1997 |
| 1998 return; | 1998 if (stepping_fp_ != 0) { |
| 1999 // There is an "interesting frame" set. Only pause at appropriate |
| 2000 // locations in this frame. |
| 2001 if (stepping_fp_ > frame->fp()) { |
| 2002 // We are in a callee of the frame we're interested in. |
| 2003 // Ignore this stepping break. |
| 2004 return; |
| 2005 } else if (frame->fp() > stepping_fp_) { |
| 2006 // We returned from the "interesting frame", there can be no more |
| 2007 // stepping breaks for it. Pause at the next appropriate location |
| 2008 // and let the user set the "interesting" frame again. |
| 2009 stepping_fp_ = 0; |
| 2010 } |
| 1999 } | 2011 } |
| 2000 // If an "interesting" frame is set, we are either in that frame | |
| 2001 // or the program has returned from that frame. Let the user set | |
| 2002 // the "interesting" frame again next time we pause. | |
| 2003 stepping_fp_ = 0; | |
| 2004 | 2012 |
| 2005 if (!frame->IsDebuggable()) { | 2013 if (!frame->IsDebuggable()) { |
| 2006 return; | 2014 return; |
| 2007 } | 2015 } |
| 2008 if (frame->TokenPos() == Scanner::kNoSourcePos) { | 2016 if (frame->TokenPos() == Scanner::kNoSourcePos) { |
| 2009 return; | 2017 return; |
| 2010 } | 2018 } |
| 2011 | 2019 |
| 2012 // Don't pause for a single step if there is a breakpoint set | 2020 // Don't pause for a single step if there is a breakpoint set |
| 2013 // at this location. | 2021 // at this location. |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 } | 2321 } |
| 2314 | 2322 |
| 2315 | 2323 |
| 2316 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2324 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 2317 ASSERT(bpt->next() == NULL); | 2325 ASSERT(bpt->next() == NULL); |
| 2318 bpt->set_next(code_breakpoints_); | 2326 bpt->set_next(code_breakpoints_); |
| 2319 code_breakpoints_ = bpt; | 2327 code_breakpoints_ = bpt; |
| 2320 } | 2328 } |
| 2321 | 2329 |
| 2322 } // namespace dart | 2330 } // namespace dart |
| OLD | NEW |