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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); | 1760 DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8); |
1761 Function& function = Function::Handle(); | 1761 Function& function = Function::Handle(); |
1762 Code& code = Code::Handle(); | 1762 Code& code = Code::Handle(); |
1763 | 1763 |
1764 const uword fp = 0; | 1764 const uword fp = 0; |
1765 const uword sp = 0; | 1765 const uword sp = 0; |
1766 const Array& deopt_frame = Array::Handle(); | 1766 const Array& deopt_frame = Array::Handle(); |
1767 const intptr_t deopt_frame_offset = -1; | 1767 const intptr_t deopt_frame_offset = -1; |
1768 | 1768 |
1769 for (intptr_t i = 0; i < ex_trace.Length(); i++) { | 1769 for (intptr_t i = 0; i < ex_trace.Length(); i++) { |
1770 function = ex_trace.FunctionAtFrame(i); | 1770 code = ex_trace.CodeAtFrame(i); |
1771 // Pre-allocated StackTraces may include empty slots, either (a) to indicate | 1771 // Pre-allocated StackTraces may include empty slots, either (a) to indicate |
1772 // where frames were omitted in the case a stack has more frames than the | 1772 // where frames were omitted in the case a stack has more frames than the |
1773 // pre-allocated trace (such as a stack overflow) or (b) because a stack has | 1773 // pre-allocated trace (such as a stack overflow) or (b) because a stack has |
1774 // fewer frames that the pre-allocated trace (such as memory exhaustion with | 1774 // fewer frames that the pre-allocated trace (such as memory exhaustion with |
1775 // a shallow stack). | 1775 // a shallow stack). |
1776 if (!function.IsNull() && function.is_visible()) { | 1776 if (!code.IsNull()) { |
1777 code = ex_trace.CodeAtFrame(i); | 1777 ASSERT(code.IsFunctionCode()); |
1778 ASSERT(function.raw() == code.function()); | 1778 function = code.function(); |
1779 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); | 1779 if (function.is_visible()) { |
1780 if (code.is_optimized() && ex_trace.expand_inlined()) { | 1780 code = ex_trace.CodeAtFrame(i); |
1781 // Traverse inlined frames. | 1781 ASSERT(function.raw() == code.function()); |
1782 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) { | 1782 uword pc = |
1783 function = it.function(); | 1783 code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); |
1784 code = it.code(); | 1784 if (code.is_optimized() && ex_trace.expand_inlined()) { |
1785 ASSERT(function.raw() == code.function()); | 1785 // Traverse inlined frames. |
1786 uword pc = it.pc(); | 1786 for (InlinedFunctionsIterator it(code, pc); !it.Done(); |
1787 ASSERT(pc != 0); | 1787 it.Advance()) { |
1788 ASSERT(code.PayloadStart() <= pc); | 1788 function = it.function(); |
1789 ASSERT(pc < (code.PayloadStart() + code.Size())); | 1789 code = it.code(); |
| 1790 ASSERT(function.raw() == code.function()); |
| 1791 uword pc = it.pc(); |
| 1792 ASSERT(pc != 0); |
| 1793 ASSERT(code.PayloadStart() <= pc); |
| 1794 ASSERT(pc < (code.PayloadStart() + code.Size())); |
1790 | 1795 |
| 1796 ActivationFrame* activation = new ActivationFrame( |
| 1797 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
| 1798 stack_trace->AddActivation(activation); |
| 1799 } |
| 1800 } else { |
1791 ActivationFrame* activation = new ActivationFrame( | 1801 ActivationFrame* activation = new ActivationFrame( |
1792 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | 1802 pc, fp, sp, code, deopt_frame, deopt_frame_offset); |
1793 stack_trace->AddActivation(activation); | 1803 stack_trace->AddActivation(activation); |
1794 } | 1804 } |
1795 } else { | |
1796 ActivationFrame* activation = new ActivationFrame( | |
1797 pc, fp, sp, code, deopt_frame, deopt_frame_offset); | |
1798 stack_trace->AddActivation(activation); | |
1799 } | 1805 } |
1800 } | 1806 } |
1801 } | 1807 } |
1802 return stack_trace; | 1808 return stack_trace; |
1803 } | 1809 } |
1804 | 1810 |
1805 | 1811 |
1806 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { | 1812 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { |
1807 ASSERT((pause_info == kNoPauseOnExceptions) || | 1813 ASSERT((pause_info == kNoPauseOnExceptions) || |
1808 (pause_info == kPauseOnUnhandledExceptions) || | 1814 (pause_info == kPauseOnUnhandledExceptions) || |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 | 3813 |
3808 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3814 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3809 ASSERT(bpt->next() == NULL); | 3815 ASSERT(bpt->next() == NULL); |
3810 bpt->set_next(code_breakpoints_); | 3816 bpt->set_next(code_breakpoints_); |
3811 code_breakpoints_ = bpt; | 3817 code_breakpoints_ = bpt; |
3812 } | 3818 } |
3813 | 3819 |
3814 #endif // !PRODUCT | 3820 #endif // !PRODUCT |
3815 | 3821 |
3816 } // namespace dart | 3822 } // namespace dart |
OLD | NEW |