| 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 "platform/address_sanitizer.h" | 9 #include "platform/address_sanitizer.h" |
| 10 | 10 |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); | 1571 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); |
| 1572 Function& function = Function::Handle(); | 1572 Function& function = Function::Handle(); |
| 1573 Code& code = Code::Handle(); | 1573 Code& code = Code::Handle(); |
| 1574 | 1574 |
| 1575 const uword fp = 0; | 1575 const uword fp = 0; |
| 1576 const uword sp = 0; | 1576 const uword sp = 0; |
| 1577 const Array& deopt_frame = Array::Handle(); | 1577 const Array& deopt_frame = Array::Handle(); |
| 1578 const intptr_t deopt_frame_offset = -1; | 1578 const intptr_t deopt_frame_offset = -1; |
| 1579 | 1579 |
| 1580 for (intptr_t i = 0; i < ex_trace.Length(); i++) { | 1580 for (intptr_t i = 0; i < ex_trace.Length(); i++) { |
| 1581 code = ex_trace.CodeAtFrame(i); | 1581 function = ex_trace.FunctionAtFrame(i); |
| 1582 // Pre-allocated StackTraces may include empty slots, either (a) to indicate | 1582 // Pre-allocated StackTraces may include empty slots, either (a) to indicate |
| 1583 // where frames were omitted in the case a stack has more frames than the | 1583 // where frames were omitted in the case a stack has more frames than the |
| 1584 // pre-allocated trace (such as a stack overflow) or (b) because a stack has | 1584 // pre-allocated trace (such as a stack overflow) or (b) because a stack has |
| 1585 // fewer frames that the pre-allocated trace (such as memory exhaustion with | 1585 // fewer frames that the pre-allocated trace (such as memory exhaustion with |
| 1586 // a shallow stack). | 1586 // a shallow stack). |
| 1587 if (!code.IsNull()) { | 1587 if (!function.IsNull() && function.is_visible()) { |
| 1588 ASSERT(code.IsFunctionCode()); | 1588 code = ex_trace.CodeAtFrame(i); |
| 1589 function = code.function(); | 1589 ASSERT(function.raw() == code.function()); |
| 1590 if (function.is_visible()) { | 1590 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); |
| 1591 code = ex_trace.CodeAtFrame(i); | 1591 if (code.is_optimized() && ex_trace.expand_inlined()) { |
| 1592 ASSERT(function.raw() == code.function()); | 1592 // Traverse inlined frames. |
| 1593 uword pc = | 1593 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) { |
| 1594 code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); | 1594 function = it.function(); |
| 1595 if (code.is_optimized() && ex_trace.expand_inlined()) { | 1595 code = it.code(); |
| 1596 // Traverse inlined frames. | 1596 ASSERT(function.raw() == code.function()); |
| 1597 for (InlinedFunctionsIterator it(code, pc); !it.Done(); | 1597 uword pc = it.pc(); |
| 1598 it.Advance()) { | 1598 ASSERT(pc != 0); |
| 1599 function = it.function(); | 1599 ASSERT(code.PayloadStart() <= pc); |
| 1600 code = it.code(); | 1600 ASSERT(pc < (code.PayloadStart() + code.Size())); |
| 1601 ASSERT(function.raw() == code.function()); | |
| 1602 uword pc = it.pc(); | |
| 1603 ASSERT(pc != 0); | |
| 1604 ASSERT(code.PayloadStart() <= pc); | |
| 1605 ASSERT(pc < (code.PayloadStart() + code.Size())); | |
| 1606 | 1601 |
| 1607 ActivationFrame* activation = new ActivationFrame( | |
| 1608 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | |
| 1609 stack_trace->AddActivation(activation); | |
| 1610 } | |
| 1611 } else { | |
| 1612 ActivationFrame* activation = new ActivationFrame( | 1602 ActivationFrame* activation = new ActivationFrame( |
| 1613 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | 1603 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
| 1614 stack_trace->AddActivation(activation); | 1604 stack_trace->AddActivation(activation); |
| 1615 } | 1605 } |
| 1606 } else { |
| 1607 ActivationFrame* activation = new ActivationFrame( |
| 1608 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
| 1609 stack_trace->AddActivation(activation); |
| 1616 } | 1610 } |
| 1617 } | 1611 } |
| 1618 } | 1612 } |
| 1619 return stack_trace; | 1613 return stack_trace; |
| 1620 } | 1614 } |
| 1621 | 1615 |
| 1622 | 1616 |
| 1623 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { | 1617 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { |
| 1624 ASSERT((pause_info == kNoPauseOnExceptions) || | 1618 ASSERT((pause_info == kNoPauseOnExceptions) || |
| 1625 (pause_info == kPauseOnUnhandledExceptions) || | 1619 (pause_info == kPauseOnUnhandledExceptions) || |
| (...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 | 3607 |
| 3614 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3608 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 3615 ASSERT(bpt->next() == NULL); | 3609 ASSERT(bpt->next() == NULL); |
| 3616 bpt->set_next(code_breakpoints_); | 3610 bpt->set_next(code_breakpoints_); |
| 3617 code_breakpoints_ = bpt; | 3611 code_breakpoints_ = bpt; |
| 3618 } | 3612 } |
| 3619 | 3613 |
| 3620 #endif // !PRODUCT | 3614 #endif // !PRODUCT |
| 3621 | 3615 |
| 3622 } // namespace dart | 3616 } // namespace dart |
| OLD | NEW |