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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 ASSERT(!stream_cls.IsNull()); | 779 ASSERT(!stream_cls.IsNull()); |
780 const Class& stream_impl_cls = Class::Handle(stream_cls.SuperClass()); | 780 const Class& stream_impl_cls = Class::Handle(stream_cls.SuperClass()); |
781 const Field& awaiter_field = Field::Handle( | 781 const Field& awaiter_field = Field::Handle( |
782 stream_impl_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter())); | 782 stream_impl_cls.LookupInstanceFieldAllowPrivate(Symbols::_Awaiter())); |
783 ASSERT(!awaiter_field.IsNull()); | 783 ASSERT(!awaiter_field.IsNull()); |
784 return Instance::Cast(stream).GetField(awaiter_field); | 784 return Instance::Cast(stream).GetField(awaiter_field); |
785 } | 785 } |
786 | 786 |
787 | 787 |
788 RawObject* ActivationFrame::GetAsyncAwaiter() { | 788 RawObject* ActivationFrame::GetAsyncAwaiter() { |
789 const Object& completer = Object::Handle(GetAsyncCompleter()); | |
790 if (!completer.IsNull()) { | |
791 return GetAsyncCompleterAwaiter(completer); | |
792 } | |
793 const Object& async_stream_controller_stream = | 789 const Object& async_stream_controller_stream = |
794 Object::Handle(GetAsyncStreamControllerStream()); | 790 Object::Handle(GetAsyncStreamControllerStream()); |
795 if (!async_stream_controller_stream.IsNull()) { | 791 if (!async_stream_controller_stream.IsNull()) { |
796 return GetAsyncStreamControllerStreamAwaiter( | 792 return GetAsyncStreamControllerStreamAwaiter( |
797 async_stream_controller_stream); | 793 async_stream_controller_stream); |
798 } | 794 } |
| 795 const Object& completer = Object::Handle(GetAsyncCompleter()); |
| 796 if (!completer.IsNull()) { |
| 797 return GetAsyncCompleterAwaiter(completer); |
| 798 } |
799 return Object::null(); | 799 return Object::null(); |
800 } | 800 } |
801 | 801 |
802 | 802 |
803 RawObject* ActivationFrame::GetCausalStack() { | 803 RawObject* ActivationFrame::GetCausalStack() { |
804 return GetAsyncContextVariable(Symbols::AsyncStackTraceVar()); | 804 return GetAsyncContextVariable(Symbols::AsyncStackTraceVar()); |
805 } | 805 } |
806 | 806 |
807 | 807 |
808 bool ActivationFrame::HandlesException(const Instance& exc_obj) { | 808 bool ActivationFrame::HandlesException(const Instance& exc_obj) { |
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3222 } else if (resume_action_ == kStepOver) { | 3222 } else if (resume_action_ == kStepOver) { |
3223 DeoptimizeWorld(); | 3223 DeoptimizeWorld(); |
3224 isolate_->set_single_step(true); | 3224 isolate_->set_single_step(true); |
3225 skip_next_step_ = skip_next_step; | 3225 skip_next_step_ = skip_next_step; |
3226 ASSERT(stack_trace->Length() > 0); | 3226 ASSERT(stack_trace->Length() > 0); |
3227 stepping_fp_ = stack_trace->FrameAt(0)->fp(); | 3227 stepping_fp_ = stack_trace->FrameAt(0)->fp(); |
3228 if (FLAG_verbose_debug) { | 3228 if (FLAG_verbose_debug) { |
3229 OS::Print("HandleSteppingRequest- kStepOver %" Px "\n", stepping_fp_); | 3229 OS::Print("HandleSteppingRequest- kStepOver %" Px "\n", stepping_fp_); |
3230 } | 3230 } |
3231 } else if (resume_action_ == kStepOut) { | 3231 } else if (resume_action_ == kStepOut) { |
| 3232 if (FLAG_async_debugger_stepping) { |
| 3233 if (stack_trace->FrameAt(0)->function().IsAsyncClosure() || |
| 3234 stack_trace->FrameAt(0)->function().IsAsyncGenClosure()) { |
| 3235 // Request to step out of an async/async* closure. |
| 3236 const Object& async_op = |
| 3237 Object::Handle(stack_trace->FrameAt(0)->GetAsyncAwaiter()); |
| 3238 if (!async_op.IsNull()) { |
| 3239 // Step out to the awaiter. |
| 3240 ASSERT(async_op.IsClosure()); |
| 3241 AsyncStepInto(Closure::Cast(async_op)); |
| 3242 return; |
| 3243 } |
| 3244 } |
| 3245 } |
| 3246 // Fall through to synchronous stepping. |
3232 DeoptimizeWorld(); | 3247 DeoptimizeWorld(); |
3233 isolate_->set_single_step(true); | 3248 isolate_->set_single_step(true); |
3234 // Find topmost caller that is debuggable. | 3249 // Find topmost caller that is debuggable. |
3235 for (intptr_t i = 1; i < stack_trace->Length(); i++) { | 3250 for (intptr_t i = 1; i < stack_trace->Length(); i++) { |
3236 ActivationFrame* frame = stack_trace->FrameAt(i); | 3251 ActivationFrame* frame = stack_trace->FrameAt(i); |
3237 if (frame->IsDebuggable()) { | 3252 if (frame->IsDebuggable()) { |
3238 stepping_fp_ = frame->fp(); | 3253 stepping_fp_ = frame->fp(); |
3239 break; | 3254 break; |
3240 } | 3255 } |
3241 } | 3256 } |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4199 loc = loc->next(); | 4214 loc = loc->next(); |
4200 } | 4215 } |
4201 return NULL; | 4216 return NULL; |
4202 } | 4217 } |
4203 | 4218 |
4204 | 4219 |
4205 void Debugger::MaybeAsyncStepInto(const Closure& async_op) { | 4220 void Debugger::MaybeAsyncStepInto(const Closure& async_op) { |
4206 if (FLAG_async_debugger_stepping && IsSingleStepping()) { | 4221 if (FLAG_async_debugger_stepping && IsSingleStepping()) { |
4207 // We are single stepping, set a breakpoint on the closure activation | 4222 // We are single stepping, set a breakpoint on the closure activation |
4208 // and resume execution so we can hit the breakpoint. | 4223 // and resume execution so we can hit the breakpoint. |
4209 SetBreakpointAtActivation(async_op, true); | 4224 AsyncStepInto(async_op); |
4210 Continue(); | |
4211 } | 4225 } |
4212 } | 4226 } |
4213 | 4227 |
4214 | 4228 |
| 4229 void Debugger::AsyncStepInto(const Closure& async_op) { |
| 4230 SetBreakpointAtActivation(async_op, true); |
| 4231 Continue(); |
| 4232 } |
| 4233 |
| 4234 |
4215 void Debugger::Continue() { | 4235 void Debugger::Continue() { |
4216 SetResumeAction(kContinue); | 4236 SetResumeAction(kContinue); |
4217 stepping_fp_ = 0; | 4237 stepping_fp_ = 0; |
4218 isolate_->set_single_step(false); | 4238 isolate_->set_single_step(false); |
4219 } | 4239 } |
4220 | 4240 |
4221 | 4241 |
4222 BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, | 4242 BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url, |
4223 intptr_t line, | 4243 intptr_t line, |
4224 intptr_t column) { | 4244 intptr_t column) { |
(...skipping 24 matching lines...) Expand all Loading... |
4249 | 4269 |
4250 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4270 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
4251 ASSERT(bpt->next() == NULL); | 4271 ASSERT(bpt->next() == NULL); |
4252 bpt->set_next(code_breakpoints_); | 4272 bpt->set_next(code_breakpoints_); |
4253 code_breakpoints_ = bpt; | 4273 code_breakpoints_ = bpt; |
4254 } | 4274 } |
4255 | 4275 |
4256 #endif // !PRODUCT | 4276 #endif // !PRODUCT |
4257 | 4277 |
4258 } // namespace dart | 4278 } // namespace dart |
OLD | NEW |