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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 | 1560 |
1561 | 1561 |
1562 DebuggerStackTrace* Debugger::StackTrace() { | 1562 DebuggerStackTrace* Debugger::StackTrace() { |
1563 return (stack_trace_ != NULL) ? stack_trace_ : CollectStackTrace(); | 1563 return (stack_trace_ != NULL) ? stack_trace_ : CollectStackTrace(); |
1564 } | 1564 } |
1565 | 1565 |
1566 DebuggerStackTrace* Debugger::CurrentStackTrace() { | 1566 DebuggerStackTrace* Debugger::CurrentStackTrace() { |
1567 return CollectStackTrace(); | 1567 return CollectStackTrace(); |
1568 } | 1568 } |
1569 | 1569 |
1570 DebuggerStackTrace* Debugger::StackTraceFrom(const Stacktrace& ex_trace) { | 1570 DebuggerStackTrace* Debugger::StackTraceFrom(const class StackTrace& ex_trace) { |
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 function = ex_trace.FunctionAtFrame(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 (!function.IsNull() && function.is_visible()) { | 1587 if (!function.IsNull() && function.is_visible()) { |
1588 code = ex_trace.CodeAtFrame(i); | 1588 code = ex_trace.CodeAtFrame(i); |
1589 ASSERT(function.raw() == code.function()); | 1589 ASSERT(function.raw() == code.function()); |
1590 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); | 1590 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); |
1591 if (code.is_optimized() && ex_trace.expand_inlined()) { | 1591 if (code.is_optimized() && ex_trace.expand_inlined()) { |
1592 // Traverse inlined frames. | 1592 // Traverse inlined frames. |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3579 | 3579 |
3580 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3580 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3581 ASSERT(bpt->next() == NULL); | 3581 ASSERT(bpt->next() == NULL); |
3582 bpt->set_next(code_breakpoints_); | 3582 bpt->set_next(code_breakpoints_); |
3583 code_breakpoints_ = bpt; | 3583 code_breakpoints_ = bpt; |
3584 } | 3584 } |
3585 | 3585 |
3586 #endif // !PRODUCT | 3586 #endif // !PRODUCT |
3587 | 3587 |
3588 } // namespace dart | 3588 } // namespace dart |
OLD | NEW |