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 "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2268 stack_trace_ = stack_trace; | 2268 stack_trace_ = stack_trace; |
2269 SignalPausedEvent(top_frame, bpt->src_bpt_); | 2269 SignalPausedEvent(top_frame, bpt->src_bpt_); |
2270 HandleSteppingRequest(stack_trace_); | 2270 HandleSteppingRequest(stack_trace_); |
2271 stack_trace_ = NULL; | 2271 stack_trace_ = NULL; |
2272 if (bpt->IsInternal()) { | 2272 if (bpt->IsInternal()) { |
2273 RemoveInternalBreakpoints(); | 2273 RemoveInternalBreakpoints(); |
2274 } | 2274 } |
2275 } | 2275 } |
2276 | 2276 |
2277 | 2277 |
| 2278 void Debugger::BreakHere() { |
| 2279 // We ignore this breakpoint when the VM is executing code invoked |
| 2280 // by the debugger to evaluate variables values, or when we see a nested |
| 2281 // breakpoint or exception event. |
| 2282 if (ignore_breakpoints_ || IsPaused() || !HasEventHandler()) { |
| 2283 return; |
| 2284 } |
| 2285 |
| 2286 DebuggerStackTrace* stack_trace = CollectStackTrace(); |
| 2287 ASSERT(stack_trace->Length() > 0); |
| 2288 ASSERT(stack_trace_ == NULL); |
| 2289 stack_trace_ = stack_trace; |
| 2290 |
| 2291 // We are in the native call to Debugger_breakHere or Debugger_breakHereIf, |
| 2292 // the developer gets a better experience by not seeing this call. To |
| 2293 // accomplish this, we continue execution until the call exits (step out). |
| 2294 SetStepOut(); |
| 2295 HandleSteppingRequest(stack_trace_); |
| 2296 |
| 2297 stack_trace_ = NULL; |
| 2298 } |
| 2299 |
| 2300 |
2278 void Debugger::Initialize(Isolate* isolate) { | 2301 void Debugger::Initialize(Isolate* isolate) { |
2279 if (initialized_) { | 2302 if (initialized_) { |
2280 return; | 2303 return; |
2281 } | 2304 } |
2282 isolate_ = isolate; | 2305 isolate_ = isolate; |
2283 | 2306 |
2284 // Use the isolate's control port as the isolate_id for debugging. | 2307 // Use the isolate's control port as the isolate_id for debugging. |
2285 // This port will be used as a unique ID to represent the isolate in the | 2308 // This port will be used as a unique ID to represent the isolate in the |
2286 // debugger wire protocol messages. | 2309 // debugger wire protocol messages. |
2287 isolate_id_ = isolate->main_port(); | 2310 isolate_id_ = isolate->main_port(); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2667 } | 2690 } |
2668 | 2691 |
2669 | 2692 |
2670 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2693 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2671 ASSERT(bpt->next() == NULL); | 2694 ASSERT(bpt->next() == NULL); |
2672 bpt->set_next(code_breakpoints_); | 2695 bpt->set_next(code_breakpoints_); |
2673 code_breakpoints_ = bpt; | 2696 code_breakpoints_ = bpt; |
2674 } | 2697 } |
2675 | 2698 |
2676 } // namespace dart | 2699 } // namespace dart |
OLD | NEW |