Index: runtime/vm/debugger.cc |
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc |
index 60059ee051fe62504700da5c26a8233aee56a8a9..0ae8cab93711eb4c87bb43a6adf9d384af7aee68 100644 |
--- a/runtime/vm/debugger.cc |
+++ b/runtime/vm/debugger.cc |
@@ -226,7 +226,32 @@ ActivationFrame::ActivationFrame( |
bool Debugger::HasEventHandler() { |
- return (event_handler_ != NULL) || Service::NeedsEvents(); |
+ return ((event_handler_ != NULL) || |
+ Service::NeedsIsolateEvents() || |
+ Service::NeedsDebugEvents()); |
+} |
+ |
+ |
+static bool ServiceNeedsDebuggerEvent(DebuggerEvent::EventType type) { |
+ switch (type) { |
+ case DebuggerEvent::kBreakpointResolved: |
+ // kBreakpointResolved events are handled differently in the vm |
+ // service, so suppress them here. |
+ return false; |
+ |
+ case DebuggerEvent::kBreakpointReached: |
+ case DebuggerEvent::kExceptionThrown: |
+ case DebuggerEvent::kIsolateInterrupted: |
+ return Service::NeedsDebugEvents(); |
+ |
+ case DebuggerEvent::kIsolateCreated: |
+ case DebuggerEvent::kIsolateShutdown: |
+ return Service::NeedsIsolateEvents(); |
+ |
+ default: |
+ UNREACHABLE(); |
+ return false; |
+ } |
} |
@@ -238,8 +263,7 @@ void Debugger::InvokeEventHandler(DebuggerEvent* event) { |
// |
// kBreakpointResolved events are handled differently in the vm |
// service, so suppress them here. |
- if (Service::NeedsEvents() && |
- (event->type() != DebuggerEvent::kBreakpointResolved)) { |
+ if (ServiceNeedsDebuggerEvent(event->type())) { |
ServiceEvent service_event(event); |
Service::HandleEvent(&service_event); |
} |
@@ -251,7 +275,7 @@ void Debugger::InvokeEventHandler(DebuggerEvent* event) { |
(*event_handler_)(event); |
} |
- if (Service::NeedsEvents() && event->IsPauseEvent()) { |
+ if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) { |
// If we were paused, notify the service that we have resumed. |
ServiceEvent service_event(event->isolate(), ServiceEvent::kResume); |
service_event.set_top_frame(event->top_frame()); |
@@ -294,7 +318,7 @@ void Debugger::SignalIsolateInterrupted() { |
// than the regular debugger breakpoint notifications. |
static void SendServiceBreakpointEvent(ServiceEvent::EventType type, |
SourceBreakpoint* bpt) { |
- if (Service::NeedsEvents()) { |
+ if (Service::NeedsDebugEvents()) { |
ServiceEvent service_event(Isolate::Current(), type); |
service_event.set_breakpoint(bpt); |
Service::HandleEvent(&service_event); |