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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 } | 512 } |
513 | 513 |
514 | 514 |
515 // Compute token_pos_ and try_index_ and token_pos_initialized_. | 515 // Compute token_pos_ and try_index_ and token_pos_initialized_. |
516 TokenPosition ActivationFrame::TokenPos() { | 516 TokenPosition ActivationFrame::TokenPos() { |
517 if (!token_pos_initialized_) { | 517 if (!token_pos_initialized_) { |
518 token_pos_initialized_ = true; | 518 token_pos_initialized_ = true; |
519 token_pos_ = TokenPosition::kNoSource; | 519 token_pos_ = TokenPosition::kNoSource; |
520 GetPcDescriptors(); | 520 GetPcDescriptors(); |
521 PcDescriptors::Iterator iter(pc_desc_, RawPcDescriptors::kAnyKind); | 521 PcDescriptors::Iterator iter(pc_desc_, RawPcDescriptors::kAnyKind); |
522 uword pc_offset = pc_ - code().EntryPoint(); | 522 uword pc_offset = pc_ - code().PayloadStart(); |
523 while (iter.MoveNext()) { | 523 while (iter.MoveNext()) { |
524 if (iter.PcOffset() == pc_offset) { | 524 if (iter.PcOffset() == pc_offset) { |
525 try_index_ = iter.TryIndex(); | 525 try_index_ = iter.TryIndex(); |
526 token_pos_ = iter.TokenPos(); | 526 token_pos_ = iter.TokenPos(); |
527 break; | 527 break; |
528 } | 528 } |
529 } | 529 } |
530 } | 530 } |
531 return token_pos_; | 531 return token_pos_; |
532 } | 532 } |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 for (intptr_t i = 0; i < ex_trace.Length(); i++) { | 1521 for (intptr_t i = 0; i < ex_trace.Length(); i++) { |
1522 function = ex_trace.FunctionAtFrame(i); | 1522 function = ex_trace.FunctionAtFrame(i); |
1523 // Pre-allocated Stacktraces may include empty slots, either (a) to indicate | 1523 // Pre-allocated Stacktraces may include empty slots, either (a) to indicate |
1524 // where frames were omitted in the case a stack has more frames than the | 1524 // where frames were omitted in the case a stack has more frames than the |
1525 // pre-allocated trace (such as a stack overflow) or (b) because a stack has | 1525 // pre-allocated trace (such as a stack overflow) or (b) because a stack has |
1526 // fewer frames that the pre-allocated trace (such as memory exhaustion with | 1526 // fewer frames that the pre-allocated trace (such as memory exhaustion with |
1527 // a shallow stack). | 1527 // a shallow stack). |
1528 if (!function.IsNull() && function.is_visible()) { | 1528 if (!function.IsNull() && function.is_visible()) { |
1529 code = ex_trace.CodeAtFrame(i); | 1529 code = ex_trace.CodeAtFrame(i); |
1530 ASSERT(function.raw() == code.function()); | 1530 ASSERT(function.raw() == code.function()); |
1531 uword pc = code.EntryPoint() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); | 1531 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); |
1532 if (code.is_optimized() && ex_trace.expand_inlined()) { | 1532 if (code.is_optimized() && ex_trace.expand_inlined()) { |
1533 // Traverse inlined frames. | 1533 // Traverse inlined frames. |
1534 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) { | 1534 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) { |
1535 function = it.function(); | 1535 function = it.function(); |
1536 code = it.code(); | 1536 code = it.code(); |
1537 ASSERT(function.raw() == code.function()); | 1537 ASSERT(function.raw() == code.function()); |
1538 uword pc = it.pc(); | 1538 uword pc = it.pc(); |
1539 ASSERT(pc != 0); | 1539 ASSERT(pc != 0); |
1540 ASSERT(code.EntryPoint() <= pc); | 1540 ASSERT(code.PayloadStart() <= pc); |
1541 ASSERT(pc < (code.EntryPoint() + code.Size())); | 1541 ASSERT(pc < (code.PayloadStart() + code.Size())); |
1542 | 1542 |
1543 ActivationFrame* activation = new ActivationFrame( | 1543 ActivationFrame* activation = new ActivationFrame( |
1544 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | 1544 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
1545 stack_trace->AddActivation(activation); | 1545 stack_trace->AddActivation(activation); |
1546 } | 1546 } |
1547 } else { | 1547 } else { |
1548 ActivationFrame* activation = new ActivationFrame( | 1548 ActivationFrame* activation = new ActivationFrame( |
1549 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | 1549 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
1550 stack_trace->AddActivation(activation); | 1550 stack_trace->AddActivation(activation); |
1551 } | 1551 } |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 if (iter.TokenPos() == loc->token_pos_) { | 1821 if (iter.TokenPos() == loc->token_pos_) { |
1822 if (iter.PcOffset() < lowest_pc_offset) { | 1822 if (iter.PcOffset() < lowest_pc_offset) { |
1823 lowest_pc_offset = iter.PcOffset(); | 1823 lowest_pc_offset = iter.PcOffset(); |
1824 lowest_kind = iter.Kind(); | 1824 lowest_kind = iter.Kind(); |
1825 } | 1825 } |
1826 } | 1826 } |
1827 } | 1827 } |
1828 if (lowest_pc_offset == kUwordMax) { | 1828 if (lowest_pc_offset == kUwordMax) { |
1829 return; | 1829 return; |
1830 } | 1830 } |
1831 uword lowest_pc = code.EntryPoint() + lowest_pc_offset; | 1831 uword lowest_pc = code.PayloadStart() + lowest_pc_offset; |
1832 CodeBreakpoint* code_bpt = GetCodeBreakpoint(lowest_pc); | 1832 CodeBreakpoint* code_bpt = GetCodeBreakpoint(lowest_pc); |
1833 if (code_bpt == NULL) { | 1833 if (code_bpt == NULL) { |
1834 // No code breakpoint for this code exists; create one. | 1834 // No code breakpoint for this code exists; create one. |
1835 code_bpt = new CodeBreakpoint(code, loc->token_pos_, | 1835 code_bpt = new CodeBreakpoint(code, loc->token_pos_, |
1836 lowest_pc, lowest_kind); | 1836 lowest_pc, lowest_kind); |
1837 RegisterCodeBreakpoint(code_bpt); | 1837 RegisterCodeBreakpoint(code_bpt); |
1838 } | 1838 } |
1839 code_bpt->set_bpt_location(loc); | 1839 code_bpt->set_bpt_location(loc); |
1840 if (loc->AnyEnabled()) { | 1840 if (loc->AnyEnabled()) { |
1841 code_bpt->Enable(); | 1841 code_bpt->Enable(); |
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3317 | 3317 |
3318 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3318 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3319 ASSERT(bpt->next() == NULL); | 3319 ASSERT(bpt->next() == NULL); |
3320 bpt->set_next(code_breakpoints_); | 3320 bpt->set_next(code_breakpoints_); |
3321 code_breakpoints_ = bpt; | 3321 code_breakpoints_ = bpt; |
3322 } | 3322 } |
3323 | 3323 |
3324 #endif // !PRODUCT | 3324 #endif // !PRODUCT |
3325 | 3325 |
3326 } // namespace dart | 3326 } // namespace dart |
OLD | NEW |