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 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 | 3237 |
3238 void Debugger::CleanupSyntheticAsyncBreakpoint() { | 3238 void Debugger::CleanupSyntheticAsyncBreakpoint() { |
3239 if (synthetic_async_breakpoint_ != NULL) { | 3239 if (synthetic_async_breakpoint_ != NULL) { |
3240 RemoveBreakpoint(synthetic_async_breakpoint_->id()); | 3240 RemoveBreakpoint(synthetic_async_breakpoint_->id()); |
3241 synthetic_async_breakpoint_ = NULL; | 3241 synthetic_async_breakpoint_ = NULL; |
3242 } | 3242 } |
3243 } | 3243 } |
3244 | 3244 |
3245 | 3245 |
3246 void Debugger::RememberTopFrameAwaiter() { | 3246 void Debugger::RememberTopFrameAwaiter() { |
3247 if (!FLAG_async_debugger_stepping) { | 3247 if (!FLAG_async_debugger) { |
3248 return; | 3248 return; |
3249 } | 3249 } |
3250 if (stack_trace_->Length() > 0) { | 3250 if (stack_trace_->Length() > 0) { |
3251 top_frame_awaiter_ = stack_trace_->FrameAt(0)->GetAsyncAwaiter(); | 3251 top_frame_awaiter_ = stack_trace_->FrameAt(0)->GetAsyncAwaiter(); |
3252 } else { | 3252 } else { |
3253 top_frame_awaiter_ = Object::null(); | 3253 top_frame_awaiter_ = Object::null(); |
3254 } | 3254 } |
3255 } | 3255 } |
3256 | 3256 |
3257 | 3257 |
3258 void Debugger::SetAsyncSteppingFramePointer() { | 3258 void Debugger::SetAsyncSteppingFramePointer() { |
3259 if (!FLAG_async_debugger_stepping) { | 3259 if (!FLAG_async_debugger) { |
3260 return; | 3260 return; |
3261 } | 3261 } |
3262 if (stack_trace_->FrameAt(0)->function().IsAsyncClosure() || | 3262 if (stack_trace_->FrameAt(0)->function().IsAsyncClosure() || |
3263 stack_trace_->FrameAt(0)->function().IsAsyncGenClosure()) { | 3263 stack_trace_->FrameAt(0)->function().IsAsyncGenClosure()) { |
3264 async_stepping_fp_ = stack_trace_->FrameAt(0)->fp(); | 3264 async_stepping_fp_ = stack_trace_->FrameAt(0)->fp(); |
3265 } else { | 3265 } else { |
3266 async_stepping_fp_ = 0; | 3266 async_stepping_fp_ = 0; |
3267 } | 3267 } |
3268 } | 3268 } |
3269 | 3269 |
(...skipping 19 matching lines...) Expand all Loading... |
3289 DeoptimizeWorld(); | 3289 DeoptimizeWorld(); |
3290 isolate_->set_single_step(true); | 3290 isolate_->set_single_step(true); |
3291 skip_next_step_ = skip_next_step; | 3291 skip_next_step_ = skip_next_step; |
3292 ASSERT(stack_trace->Length() > 0); | 3292 ASSERT(stack_trace->Length() > 0); |
3293 stepping_fp_ = stack_trace->FrameAt(0)->fp(); | 3293 stepping_fp_ = stack_trace->FrameAt(0)->fp(); |
3294 SetAsyncSteppingFramePointer(); | 3294 SetAsyncSteppingFramePointer(); |
3295 if (FLAG_verbose_debug) { | 3295 if (FLAG_verbose_debug) { |
3296 OS::Print("HandleSteppingRequest- kStepOver %" Px "\n", stepping_fp_); | 3296 OS::Print("HandleSteppingRequest- kStepOver %" Px "\n", stepping_fp_); |
3297 } | 3297 } |
3298 } else if (resume_action_ == kStepOut) { | 3298 } else if (resume_action_ == kStepOut) { |
3299 if (FLAG_async_debugger_stepping) { | 3299 if (FLAG_async_debugger) { |
3300 if (stack_trace->FrameAt(0)->function().IsAsyncClosure() || | 3300 if (stack_trace->FrameAt(0)->function().IsAsyncClosure() || |
3301 stack_trace->FrameAt(0)->function().IsAsyncGenClosure()) { | 3301 stack_trace->FrameAt(0)->function().IsAsyncGenClosure()) { |
3302 // Request to step out of an async/async* closure. | 3302 // Request to step out of an async/async* closure. |
3303 const Object& async_op = | 3303 const Object& async_op = |
3304 Object::Handle(stack_trace->FrameAt(0)->GetAsyncAwaiter()); | 3304 Object::Handle(stack_trace->FrameAt(0)->GetAsyncAwaiter()); |
3305 if (!async_op.IsNull()) { | 3305 if (!async_op.IsNull()) { |
3306 // Step out to the awaiter. | 3306 // Step out to the awaiter. |
3307 ASSERT(async_op.IsClosure()); | 3307 ASSERT(async_op.IsClosure()); |
3308 AsyncStepInto(Closure::Cast(async_op)); | 3308 AsyncStepInto(Closure::Cast(async_op)); |
3309 return; | 3309 return; |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 } | 3657 } |
3658 | 3658 |
3659 // Check whether we are in a Dart function that the user is | 3659 // Check whether we are in a Dart function that the user is |
3660 // interested in. If we saved the frame pointer of a stack frame | 3660 // interested in. If we saved the frame pointer of a stack frame |
3661 // the user is interested in, we ignore the single step if we are | 3661 // the user is interested in, we ignore the single step if we are |
3662 // in a callee of that frame. Note that we assume that the stack | 3662 // in a callee of that frame. Note that we assume that the stack |
3663 // grows towards lower addresses. | 3663 // grows towards lower addresses. |
3664 ActivationFrame* frame = TopDartFrame(); | 3664 ActivationFrame* frame = TopDartFrame(); |
3665 ASSERT(frame != NULL); | 3665 ASSERT(frame != NULL); |
3666 | 3666 |
3667 if (FLAG_async_debugger_stepping) { | 3667 if (FLAG_async_debugger) { |
3668 if ((async_stepping_fp_ != 0) && (top_frame_awaiter_ != Object::null())) { | 3668 if ((async_stepping_fp_ != 0) && (top_frame_awaiter_ != Object::null())) { |
3669 // Check if the user has single stepped out of an async function with | 3669 // Check if the user has single stepped out of an async function with |
3670 // an awaiter. The first check handles the case of calling into the | 3670 // an awaiter. The first check handles the case of calling into the |
3671 // async machinery as we finish the async function. The second check | 3671 // async machinery as we finish the async function. The second check |
3672 // handles the case of returning from an async function. | 3672 // handles the case of returning from an async function. |
3673 const bool exited_async_function = | 3673 const bool exited_async_function = |
3674 (IsCalleeFrameOf(async_stepping_fp_, frame->fp()) && | 3674 (IsCalleeFrameOf(async_stepping_fp_, frame->fp()) && |
3675 frame->IsAsyncMachinery()) || | 3675 frame->IsAsyncMachinery()) || |
3676 IsCalleeFrameOf(frame->fp(), async_stepping_fp_); | 3676 IsCalleeFrameOf(frame->fp(), async_stepping_fp_); |
3677 if (exited_async_function) { | 3677 if (exited_async_function) { |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4294 } | 4294 } |
4295 bpt = bpt->next(); | 4295 bpt = bpt->next(); |
4296 } | 4296 } |
4297 loc = loc->next(); | 4297 loc = loc->next(); |
4298 } | 4298 } |
4299 return NULL; | 4299 return NULL; |
4300 } | 4300 } |
4301 | 4301 |
4302 | 4302 |
4303 void Debugger::MaybeAsyncStepInto(const Closure& async_op) { | 4303 void Debugger::MaybeAsyncStepInto(const Closure& async_op) { |
4304 if (FLAG_async_debugger_stepping && IsSingleStepping()) { | 4304 if (FLAG_async_debugger && IsSingleStepping()) { |
4305 // We are single stepping, set a breakpoint on the closure activation | 4305 // We are single stepping, set a breakpoint on the closure activation |
4306 // and resume execution so we can hit the breakpoint. | 4306 // and resume execution so we can hit the breakpoint. |
4307 AsyncStepInto(async_op); | 4307 AsyncStepInto(async_op); |
4308 } | 4308 } |
4309 } | 4309 } |
4310 | 4310 |
4311 | 4311 |
4312 void Debugger::AsyncStepInto(const Closure& async_op) { | 4312 void Debugger::AsyncStepInto(const Closure& async_op) { |
4313 SetBreakpointAtActivation(async_op, true); | 4313 SetBreakpointAtActivation(async_op, true); |
4314 Continue(); | 4314 Continue(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4353 | 4353 |
4354 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 4354 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
4355 ASSERT(bpt->next() == NULL); | 4355 ASSERT(bpt->next() == NULL); |
4356 bpt->set_next(code_breakpoints_); | 4356 bpt->set_next(code_breakpoints_); |
4357 code_breakpoints_ = bpt; | 4357 code_breakpoints_ = bpt; |
4358 } | 4358 } |
4359 | 4359 |
4360 #endif // !PRODUCT | 4360 #endif // !PRODUCT |
4361 | 4361 |
4362 } // namespace dart | 4362 } // namespace dart |
OLD | NEW |