Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(814)

Side by Side Diff: runtime/vm/debugger.cc

Issue 2684763002: Use CodeSourceMap for stack traces (still JIT only). (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 code = ex_trace.CodeAtFrame(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 (!code.IsNull()) {
1588 code = ex_trace.CodeAtFrame(i); 1588 ASSERT(code.IsFunctionCode());
1589 ASSERT(function.raw() == code.function()); 1589 function = code.function();
1590 uword pc = code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i)); 1590 if (function.is_visible()) {
1591 if (code.is_optimized() && ex_trace.expand_inlined()) { 1591 code = ex_trace.CodeAtFrame(i);
1592 // Traverse inlined frames. 1592 ASSERT(function.raw() == code.function());
1593 for (InlinedFunctionsIterator it(code, pc); !it.Done(); it.Advance()) { 1593 uword pc =
1594 function = it.function(); 1594 code.PayloadStart() + Smi::Value(ex_trace.PcOffsetAtFrame(i));
1595 code = it.code(); 1595 if (code.is_optimized() && ex_trace.expand_inlined()) {
1596 ASSERT(function.raw() == code.function()); 1596 // Traverse inlined frames.
1597 uword pc = it.pc(); 1597 for (InlinedFunctionsIterator it(code, pc); !it.Done();
1598 ASSERT(pc != 0); 1598 it.Advance()) {
1599 ASSERT(code.PayloadStart() <= pc); 1599 function = it.function();
1600 ASSERT(pc < (code.PayloadStart() + code.Size())); 1600 code = it.code();
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()));
1601 1606
1607 ActivationFrame* activation = new ActivationFrame(
1608 pc, fp, sp, code, deopt_frame, deopt_frame_offset);
1609 stack_trace->AddActivation(activation);
1610 }
1611 } else {
1602 ActivationFrame* activation = new ActivationFrame( 1612 ActivationFrame* activation = new ActivationFrame(
1603 pc, fp, sp, code, deopt_frame, deopt_frame_offset); 1613 pc, fp, sp, code, deopt_frame, deopt_frame_offset);
1604 stack_trace->AddActivation(activation); 1614 stack_trace->AddActivation(activation);
1605 } 1615 }
1606 } else {
1607 ActivationFrame* activation = new ActivationFrame(
1608 pc, fp, sp, code, deopt_frame, deopt_frame_offset);
1609 stack_trace->AddActivation(activation);
1610 } 1616 }
1611 } 1617 }
1612 } 1618 }
1613 return stack_trace; 1619 return stack_trace;
1614 } 1620 }
1615 1621
1616 1622
1617 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { 1623 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) {
1618 ASSERT((pause_info == kNoPauseOnExceptions) || 1624 ASSERT((pause_info == kNoPauseOnExceptions) ||
1619 (pause_info == kPauseOnUnhandledExceptions) || 1625 (pause_info == kPauseOnUnhandledExceptions) ||
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after
3607 3613
3608 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3614 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3609 ASSERT(bpt->next() == NULL); 3615 ASSERT(bpt->next() == NULL);
3610 bpt->set_next(code_breakpoints_); 3616 bpt->set_next(code_breakpoints_);
3611 code_breakpoints_ = bpt; 3617 code_breakpoints_ = bpt;
3612 } 3618 }
3613 3619
3614 #endif // !PRODUCT 3620 #endif // !PRODUCT
3615 3621
3616 } // namespace dart 3622 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698