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 17 matching lines...) Expand all Loading... | |
28 #include "vm/visitor.h" | 28 #include "vm/visitor.h" |
29 | 29 |
30 | 30 |
31 namespace dart { | 31 namespace dart { |
32 | 32 |
33 DEFINE_FLAG(bool, show_invisible_frames, false, | 33 DEFINE_FLAG(bool, show_invisible_frames, false, |
34 "Show invisible frames in debugger stack traces"); | 34 "Show invisible frames in debugger stack traces"); |
35 DEFINE_FLAG(bool, trace_debugger_stacktrace, false, | 35 DEFINE_FLAG(bool, trace_debugger_stacktrace, false, |
36 "Trace debugger stacktrace collection"); | 36 "Trace debugger stacktrace collection"); |
37 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages"); | 37 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages"); |
38 DEFINE_FLAG(bool, steal_breakpoints, false, | |
39 "Intercept breakpoints and other pause events before they " | |
rmacnak
2015/04/30 21:48:55
Should probably indicate they go to the vm service
turnidge
2015/05/01 16:54:15
Done.
| |
40 "are sent to the embedder"); | |
38 | 41 |
39 | 42 |
40 Debugger::EventHandler* Debugger::event_handler_ = NULL; | 43 Debugger::EventHandler* Debugger::event_handler_ = NULL; |
41 | 44 |
42 | 45 |
43 class RemoteObjectCache : public ZoneAllocated { | 46 class RemoteObjectCache : public ZoneAllocated { |
44 public: | 47 public: |
45 explicit RemoteObjectCache(intptr_t initial_size); | 48 explicit RemoteObjectCache(intptr_t initial_size); |
46 intptr_t AddObject(const Object& obj); | 49 intptr_t AddObject(const Object& obj); |
47 RawObject* GetObj(intptr_t obj_id) const; | 50 RawObject* GetObj(intptr_t obj_id) const; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 // may go into a message loop and the Service will not. | 235 // may go into a message loop and the Service will not. |
233 // | 236 // |
234 // kBreakpointResolved events are handled differently in the vm | 237 // kBreakpointResolved events are handled differently in the vm |
235 // service, so suppress them here. | 238 // service, so suppress them here. |
236 if (Service::NeedsEvents() && | 239 if (Service::NeedsEvents() && |
237 (event->type() != DebuggerEvent::kBreakpointResolved)) { | 240 (event->type() != DebuggerEvent::kBreakpointResolved)) { |
238 ServiceEvent service_event(event); | 241 ServiceEvent service_event(event); |
239 Service::HandleEvent(&service_event); | 242 Service::HandleEvent(&service_event); |
240 } | 243 } |
241 | 244 |
242 if (event_handler_ != NULL) { | 245 if (FLAG_steal_breakpoints && event->IsPauseEvent()) { |
246 // We allow the embedder's default breakpoint handler to be overridden. | |
247 isolate_->PauseEventHandler(); | |
248 } else if (event_handler_ != NULL) { | |
243 (*event_handler_)(event); | 249 (*event_handler_)(event); |
244 } | 250 } |
245 | 251 |
246 if (Service::NeedsEvents() && event->IsPauseEvent()) { | 252 if (Service::NeedsEvents() && event->IsPauseEvent()) { |
247 // If we were paused, notify the service that we have resumed. | 253 // If we were paused, notify the service that we have resumed. |
248 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); | 254 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); |
249 service_event.set_top_frame(event->top_frame()); | 255 service_event.set_top_frame(event->top_frame()); |
250 Service::HandleEvent(&service_event); | 256 Service::HandleEvent(&service_event); |
251 } | 257 } |
252 } | 258 } |
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2639 } | 2645 } |
2640 | 2646 |
2641 | 2647 |
2642 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 2648 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
2643 ASSERT(bpt->next() == NULL); | 2649 ASSERT(bpt->next() == NULL); |
2644 bpt->set_next(code_breakpoints_); | 2650 bpt->set_next(code_breakpoints_); |
2645 code_breakpoints_ = bpt; | 2651 code_breakpoints_ = bpt; |
2646 } | 2652 } |
2647 | 2653 |
2648 } // namespace dart | 2654 } // namespace dart |
OLD | NEW |