| 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 "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/flags.h" | 12 #include "vm/flags.h" |
| 13 #include "vm/globals.h" | 13 #include "vm/globals.h" |
| 14 #include "vm/longjump.h" | 14 #include "vm/longjump.h" |
| 15 #include "vm/object.h" | 15 #include "vm/object.h" |
| 16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 17 #include "vm/os.h" | 17 #include "vm/os.h" |
| 18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 20 #include "vm/visitor.h" | 20 #include "vm/visitor.h" |
| 21 | 21 |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 static const bool verbose = true; | 25 static const bool verbose = false; |
| 26 | 26 |
| 27 | 27 |
| 28 SourceBreakpoint::SourceBreakpoint(const Function& func, intptr_t token_index) | 28 SourceBreakpoint::SourceBreakpoint(const Function& func, intptr_t token_index) |
| 29 : function_(func.raw()), | 29 : function_(func.raw()), |
| 30 token_index_(token_index), | 30 token_index_(token_index), |
| 31 line_number_(-1), | 31 line_number_(-1), |
| 32 is_enabled_(false), | 32 is_enabled_(false), |
| 33 next_(NULL) { | 33 next_(NULL) { |
| 34 ASSERT(!func.IsNull()); | 34 ASSERT(!func.IsNull()); |
| 35 ASSERT((func.token_index() <= token_index_) && | 35 ASSERT((func.token_index() <= token_index_) && |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 | 536 |
| 537 CodeBreakpoint* Debugger::MakeCodeBreakpoint(const Function& func, | 537 CodeBreakpoint* Debugger::MakeCodeBreakpoint(const Function& func, |
| 538 intptr_t token_index) { | 538 intptr_t token_index) { |
| 539 ASSERT(func.HasCode()); | 539 ASSERT(func.HasCode()); |
| 540 ASSERT(!func.HasOptimizedCode()); | 540 ASSERT(!func.HasOptimizedCode()); |
| 541 Code& code = Code::Handle(func.unoptimized_code()); | 541 Code& code = Code::Handle(func.unoptimized_code()); |
| 542 ASSERT(!code.IsNull()); | 542 ASSERT(!code.IsNull()); |
| 543 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); | 543 PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors()); |
| 544 intptr_t best_fit_index = -1; | 544 intptr_t best_fit_index = -1; |
| 545 // TODO(hausner): find a symbolic value that works on all platforms. | 545 intptr_t best_fit = INT_MAX; |
| 546 intptr_t best_fit = 0x7fffffff; | |
| 547 for (int i = 0; i < desc.Length(); i++) { | 546 for (int i = 0; i < desc.Length(); i++) { |
| 548 intptr_t desc_token_index = desc.TokenIndex(i); | 547 intptr_t desc_token_index = desc.TokenIndex(i); |
| 549 if (desc_token_index < token_index) { | 548 if (desc_token_index < token_index) { |
| 550 continue; | 549 continue; |
| 551 } | 550 } |
| 552 PcDescriptors::Kind kind = desc.DescriptorKind(i); | 551 PcDescriptors::Kind kind = desc.DescriptorKind(i); |
| 553 if ((kind == PcDescriptors::kIcCall) || | 552 if ((kind == PcDescriptors::kIcCall) || |
| 554 (kind == PcDescriptors::kFuncCall) || | 553 (kind == PcDescriptors::kFuncCall) || |
| 555 (kind == PcDescriptors::kReturn)) { | 554 (kind == PcDescriptors::kReturn)) { |
| 556 if ((desc_token_index - token_index) < best_fit) { | 555 if ((desc_token_index - token_index) < best_fit) { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 } | 1050 } |
| 1052 | 1051 |
| 1053 | 1052 |
| 1054 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1053 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1055 ASSERT(bpt->next() == NULL); | 1054 ASSERT(bpt->next() == NULL); |
| 1056 bpt->set_next(code_breakpoints_); | 1055 bpt->set_next(code_breakpoints_); |
| 1057 code_breakpoints_ = bpt; | 1056 code_breakpoints_ = bpt; |
| 1058 } | 1057 } |
| 1059 | 1058 |
| 1060 } // namespace dart | 1059 } // namespace dart |
| OLD | NEW |