| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 context_level_(-1), | 314 context_level_(-1), |
| 315 deopt_frame_(Array::ZoneHandle()), | 315 deopt_frame_(Array::ZoneHandle()), |
| 316 deopt_frame_offset_(0), | 316 deopt_frame_offset_(0), |
| 317 kind_(kAsyncActivation), | 317 kind_(kAsyncActivation), |
| 318 vars_initialized_(false), | 318 vars_initialized_(false), |
| 319 var_descriptors_(LocalVarDescriptors::ZoneHandle()), | 319 var_descriptors_(LocalVarDescriptors::ZoneHandle()), |
| 320 desc_indices_(8), | 320 desc_indices_(8), |
| 321 pc_desc_(PcDescriptors::ZoneHandle()) { | 321 pc_desc_(PcDescriptors::ZoneHandle()) { |
| 322 // Extract the function and the code from the asynchronous activation. | 322 // Extract the function and the code from the asynchronous activation. |
| 323 function_ = async_activation.function(); | 323 function_ = async_activation.function(); |
| 324 function_.EnsureHasCompiledUnoptimizedCode(); |
| 324 code_ = function_.unoptimized_code(); | 325 code_ = function_.unoptimized_code(); |
| 325 ctx_ = async_activation.context(); | 326 ctx_ = async_activation.context(); |
| 326 ASSERT(fp_ == 0); | 327 ASSERT(fp_ == 0); |
| 327 ASSERT(!ctx_.IsNull()); | 328 ASSERT(!ctx_.IsNull()); |
| 328 } | 329 } |
| 329 | 330 |
| 330 | 331 |
| 331 bool Debugger::NeedsIsolateEvents() { | 332 bool Debugger::NeedsIsolateEvents() { |
| 332 return ((isolate_ != Dart::vm_isolate()) && | 333 return ((isolate_ != Dart::vm_isolate()) && |
| 333 !ServiceIsolate::IsServiceIsolateDescendant(isolate_) && | 334 !ServiceIsolate::IsServiceIsolateDescendant(isolate_) && |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1810 Code* code, | 1811 Code* code, |
| 1811 Code* inlined_code, | 1812 Code* inlined_code, |
| 1812 Array* deopt_frame) { | 1813 Array* deopt_frame) { |
| 1813 if (code->is_optimized() && !FLAG_precompiled_runtime) { | 1814 if (code->is_optimized() && !FLAG_precompiled_runtime) { |
| 1814 // TODO(rmacnak): Use CodeSourceMap | 1815 // TODO(rmacnak): Use CodeSourceMap |
| 1815 *deopt_frame = DeoptimizeToArray(thread, frame, *code); | 1816 *deopt_frame = DeoptimizeToArray(thread, frame, *code); |
| 1816 for (InlinedFunctionsIterator it(*code, frame->pc()); !it.Done(); | 1817 for (InlinedFunctionsIterator it(*code, frame->pc()); !it.Done(); |
| 1817 it.Advance()) { | 1818 it.Advance()) { |
| 1818 *inlined_code = it.code(); | 1819 *inlined_code = it.code(); |
| 1819 if (FLAG_trace_debugger_stacktrace) { | 1820 if (FLAG_trace_debugger_stacktrace) { |
| 1820 const Function& function = | 1821 const Function& function = Function::Handle(zone, it.function()); |
| 1821 Function::Handle(zone, inlined_code->function()); | |
| 1822 ASSERT(!function.IsNull()); | 1822 ASSERT(!function.IsNull()); |
| 1823 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n", | 1823 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n", |
| 1824 function.ToFullyQualifiedCString()); | 1824 function.ToFullyQualifiedCString()); |
| 1825 } | 1825 } |
| 1826 intptr_t deopt_frame_offset = it.GetDeoptFpOffset(); | 1826 intptr_t deopt_frame_offset = it.GetDeoptFpOffset(); |
| 1827 stack_trace->AddActivation(CollectDartFrame(isolate, it.pc(), frame, | 1827 stack_trace->AddActivation(CollectDartFrame(isolate, it.pc(), frame, |
| 1828 *inlined_code, *deopt_frame, | 1828 *inlined_code, *deopt_frame, |
| 1829 deopt_frame_offset)); | 1829 deopt_frame_offset)); |
| 1830 } | 1830 } |
| 1831 } else { | 1831 } else { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 frame->ToCString()); | 1947 frame->ToCString()); |
| 1948 } | 1948 } |
| 1949 if (frame->IsDartFrame()) { | 1949 if (frame->IsDartFrame()) { |
| 1950 code = frame->LookupDartCode(); | 1950 code = frame->LookupDartCode(); |
| 1951 if (code.is_optimized()) { | 1951 if (code.is_optimized()) { |
| 1952 deopt_frame = DeoptimizeToArray(thread, frame, code); | 1952 deopt_frame = DeoptimizeToArray(thread, frame, code); |
| 1953 bool found_async_awaiter = false; | 1953 bool found_async_awaiter = false; |
| 1954 for (InlinedFunctionsIterator it(code, frame->pc()); !it.Done(); | 1954 for (InlinedFunctionsIterator it(code, frame->pc()); !it.Done(); |
| 1955 it.Advance()) { | 1955 it.Advance()) { |
| 1956 inlined_code = it.code(); | 1956 inlined_code = it.code(); |
| 1957 function = inlined_code.function(); | 1957 function = it.function(); |
| 1958 if (FLAG_trace_debugger_stacktrace) { | 1958 if (FLAG_trace_debugger_stacktrace) { |
| 1959 ASSERT(!function.IsNull()); | 1959 ASSERT(!function.IsNull()); |
| 1960 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n", | 1960 OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n", |
| 1961 function.ToFullyQualifiedCString()); | 1961 function.ToFullyQualifiedCString()); |
| 1962 } | 1962 } |
| 1963 intptr_t deopt_frame_offset = it.GetDeoptFpOffset(); | 1963 intptr_t deopt_frame_offset = it.GetDeoptFpOffset(); |
| 1964 if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) { | 1964 if (function.IsAsyncClosure() || function.IsAsyncGenClosure()) { |
| 1965 ActivationFrame* activation = CollectDartFrame( | 1965 ActivationFrame* activation = CollectDartFrame( |
| 1966 isolate, it.pc(), frame, inlined_code, deopt_frame, | 1966 isolate, it.pc(), frame, inlined_code, deopt_frame, |
| 1967 deopt_frame_offset, ActivationFrame::kAsyncActivation); | 1967 deopt_frame_offset, ActivationFrame::kAsyncActivation); |
| (...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4133 | 4133 |
| 4134 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4134 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 4135 ASSERT(bpt->next() == NULL); | 4135 ASSERT(bpt->next() == NULL); |
| 4136 bpt->set_next(code_breakpoints_); | 4136 bpt->set_next(code_breakpoints_); |
| 4137 code_breakpoints_ = bpt; | 4137 code_breakpoints_ = bpt; |
| 4138 } | 4138 } |
| 4139 | 4139 |
| 4140 #endif // !PRODUCT | 4140 #endif // !PRODUCT |
| 4141 | 4141 |
| 4142 } // namespace dart | 4142 } // namespace dart |
| OLD | NEW |