Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: runtime/vm/debugger.cc

Issue 1113243002: Add the --steal-breakpoints flag. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: switch branch Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "
40 "are sent to the embedder and use a generic VM breakpoint "
41 "handler instead. This handler dispatches breakpoints to "
42 "the VM service.");
38 43
39 44
40 Debugger::EventHandler* Debugger::event_handler_ = NULL; 45 Debugger::EventHandler* Debugger::event_handler_ = NULL;
41 46
42 47
43 class RemoteObjectCache : public ZoneAllocated { 48 class RemoteObjectCache : public ZoneAllocated {
44 public: 49 public:
45 explicit RemoteObjectCache(intptr_t initial_size); 50 explicit RemoteObjectCache(intptr_t initial_size);
46 intptr_t AddObject(const Object& obj); 51 intptr_t AddObject(const Object& obj);
47 RawObject* GetObj(intptr_t obj_id) const; 52 RawObject* GetObj(intptr_t obj_id) const;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // may go into a message loop and the Service will not. 237 // may go into a message loop and the Service will not.
233 // 238 //
234 // kBreakpointResolved events are handled differently in the vm 239 // kBreakpointResolved events are handled differently in the vm
235 // service, so suppress them here. 240 // service, so suppress them here.
236 if (Service::NeedsEvents() && 241 if (Service::NeedsEvents() &&
237 (event->type() != DebuggerEvent::kBreakpointResolved)) { 242 (event->type() != DebuggerEvent::kBreakpointResolved)) {
238 ServiceEvent service_event(event); 243 ServiceEvent service_event(event);
239 Service::HandleEvent(&service_event); 244 Service::HandleEvent(&service_event);
240 } 245 }
241 246
242 if (event_handler_ != NULL) { 247 if (FLAG_steal_breakpoints && event->IsPauseEvent()) {
248 // We allow the embedder's default breakpoint handler to be overridden.
249 isolate_->PauseEventHandler();
250 } else if (event_handler_ != NULL) {
243 (*event_handler_)(event); 251 (*event_handler_)(event);
244 } 252 }
245 253
246 if (Service::NeedsEvents() && event->IsPauseEvent()) { 254 if (Service::NeedsEvents() && event->IsPauseEvent()) {
247 // If we were paused, notify the service that we have resumed. 255 // If we were paused, notify the service that we have resumed.
248 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); 256 ServiceEvent service_event(event->isolate(), ServiceEvent::kResume);
249 service_event.set_top_frame(event->top_frame()); 257 service_event.set_top_frame(event->top_frame());
250 Service::HandleEvent(&service_event); 258 Service::HandleEvent(&service_event);
251 } 259 }
252 } 260 }
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 } 2654 }
2647 2655
2648 2656
2649 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2657 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2650 ASSERT(bpt->next() == NULL); 2658 ASSERT(bpt->next() == NULL);
2651 bpt->set_next(code_breakpoints_); 2659 bpt->set_next(code_breakpoints_);
2652 code_breakpoints_ = bpt; 2660 code_breakpoints_ = bpt;
2653 } 2661 }
2654 2662
2655 } // namespace dart 2663 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698