| 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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 if (best_fit_index >= 0) { | 930 if (best_fit_index >= 0) { |
| 931 CodeBreakpoint* bpt = GetCodeBreakpoint(desc.PC(best_fit_index)); | 931 CodeBreakpoint* bpt = GetCodeBreakpoint(desc.PC(best_fit_index)); |
| 932 // We should only ever have one code breakpoint at the same address. | 932 // We should only ever have one code breakpoint at the same address. |
| 933 if (bpt != NULL) { | 933 if (bpt != NULL) { |
| 934 return bpt; | 934 return bpt; |
| 935 } | 935 } |
| 936 | 936 |
| 937 bpt = new CodeBreakpoint(func, best_fit_index); | 937 bpt = new CodeBreakpoint(func, best_fit_index); |
| 938 if (FLAG_verbose_debug) { | 938 if (FLAG_verbose_debug) { |
| 939 OS::Print("Setting breakpoint in function '%s' " | 939 OS::Print("Setting breakpoint in function '%s' " |
| 940 "(%s:%"Pd") (PC %#"Px")\n", | 940 "(%s:%"Pd") (Token %"Pd") (PC %#"Px")\n", |
| 941 String::Handle(func.name()).ToCString(), | 941 String::Handle(func.name()).ToCString(), |
| 942 String::Handle(bpt->SourceUrl()).ToCString(), | 942 String::Handle(bpt->SourceUrl()).ToCString(), |
| 943 bpt->LineNumber(), | 943 bpt->LineNumber(), |
| 944 bpt->token_pos(), |
| 944 bpt->pc()); | 945 bpt->pc()); |
| 945 } | 946 } |
| 946 RegisterCodeBreakpoint(bpt); | 947 RegisterCodeBreakpoint(bpt); |
| 947 return bpt; | 948 return bpt; |
| 948 } | 949 } |
| 949 return NULL; | 950 return NULL; |
| 950 } | 951 } |
| 951 | 952 |
| 952 | 953 |
| 953 SourceBreakpoint* Debugger::SetBreakpoint(const Function& target_function, | 954 SourceBreakpoint* Debugger::SetBreakpoint(const Function& target_function, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 if (ignore_breakpoints_ || (stack_trace_ != NULL)) { | 1345 if (ignore_breakpoints_ || (stack_trace_ != NULL)) { |
| 1345 return; | 1346 return; |
| 1346 } | 1347 } |
| 1347 DebuggerStackTrace* stack_trace = CollectStackTrace(); | 1348 DebuggerStackTrace* stack_trace = CollectStackTrace(); |
| 1348 ASSERT(stack_trace->Length() > 0); | 1349 ASSERT(stack_trace->Length() > 0); |
| 1349 ActivationFrame* top_frame = stack_trace->ActivationFrameAt(0); | 1350 ActivationFrame* top_frame = stack_trace->ActivationFrameAt(0); |
| 1350 ASSERT(top_frame != NULL); | 1351 ASSERT(top_frame != NULL); |
| 1351 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc()); | 1352 CodeBreakpoint* bpt = GetCodeBreakpoint(top_frame->pc()); |
| 1352 ASSERT(bpt != NULL); | 1353 ASSERT(bpt != NULL); |
| 1353 if (FLAG_verbose_debug) { | 1354 if (FLAG_verbose_debug) { |
| 1354 OS::Print(">>> hit %s breakpoint at %s:%"Pd" (Address %#"Px")\n", | 1355 OS::Print(">>> hit %s breakpoint at %s:%"Pd" " |
| 1356 "(token %"Pd") (address %#"Px")\n", |
| 1355 bpt->IsInternal() ? "internal" : "user", | 1357 bpt->IsInternal() ? "internal" : "user", |
| 1356 String::Handle(bpt->SourceUrl()).ToCString(), | 1358 String::Handle(bpt->SourceUrl()).ToCString(), |
| 1357 bpt->LineNumber(), | 1359 bpt->LineNumber(), |
| 1360 bpt->token_pos(), |
| 1358 top_frame->pc()); | 1361 top_frame->pc()); |
| 1359 } | 1362 } |
| 1360 | 1363 |
| 1361 if (!bpt->IsInternal()) { | 1364 if (!bpt->IsInternal()) { |
| 1362 // This is a user-defined breakpoint so we call the breakpoint | 1365 // This is a user-defined breakpoint so we call the breakpoint |
| 1363 // callback even if it is on the same line as the previous breakpoint. | 1366 // callback even if it is on the same line as the previous breakpoint. |
| 1364 last_bpt_line_ = -1; | 1367 last_bpt_line_ = -1; |
| 1365 } | 1368 } |
| 1366 | 1369 |
| 1367 bool notify_frontend = | 1370 bool notify_frontend = |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 } | 1641 } |
| 1639 | 1642 |
| 1640 | 1643 |
| 1641 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1644 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1642 ASSERT(bpt->next() == NULL); | 1645 ASSERT(bpt->next() == NULL); |
| 1643 bpt->set_next(code_breakpoints_); | 1646 bpt->set_next(code_breakpoints_); |
| 1644 code_breakpoints_ = bpt; | 1647 code_breakpoints_ = bpt; |
| 1645 } | 1648 } |
| 1646 | 1649 |
| 1647 } // namespace dart | 1650 } // namespace dart |
| OLD | NEW |