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

Unified Diff: runtime/vm/debugger.cc

Issue 1497033003: - Remove the legacy debug protocol. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index adfea7a9510354b807b127ba5b3c1898d36617d8..aea2178a72487f41226d818193b273a4f3170f4b 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -258,13 +258,19 @@ void DebuggerEvent::UpdateTimestamp() {
}
-bool Debugger::HasEventHandler() {
+bool Debugger::HasAnyEventHandler() {
return ((event_handler_ != NULL) ||
Service::isolate_stream.enabled() ||
Service::debug_stream.enabled());
}
+bool Debugger::HasDebugEventHandler() {
+ return ((event_handler_ != NULL) ||
+ Service::debug_stream.enabled());
+}
+
+
static bool ServiceNeedsDebuggerEvent(DebuggerEvent::EventType type) {
switch (type) {
case DebuggerEvent::kBreakpointResolved:
@@ -289,8 +295,6 @@ static bool ServiceNeedsDebuggerEvent(DebuggerEvent::EventType type) {
void Debugger::InvokeEventHandler(DebuggerEvent* event) {
- ASSERT(HasEventHandler());
-
// Give the event to the Service first, as the debugger event handler
// may go into a message loop and the Service will not.
//
@@ -301,7 +305,8 @@ void Debugger::InvokeEventHandler(DebuggerEvent* event) {
Service::HandleEvent(&service_event);
}
- if (FLAG_steal_breakpoints && event->IsPauseEvent()) {
+ if ((FLAG_steal_breakpoints || (event_handler_ == NULL)) &&
+ event->IsPauseEvent()) {
// We allow the embedder's default breakpoint handler to be overridden.
isolate_->PauseEventHandler();
} else if (event_handler_ != NULL) {
@@ -325,7 +330,7 @@ void Debugger::InvokeEventHandler(DebuggerEvent* event) {
void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) {
- if (HasEventHandler()) {
+ if (HasAnyEventHandler()) {
DebuggerEvent event(isolate_, type);
ASSERT(event.isolate_id() != ILLEGAL_ISOLATE_ID);
if (type == DebuggerEvent::kIsolateInterrupted) {
@@ -347,21 +352,9 @@ void Debugger::SignalIsolateEvent(DebuggerEvent::EventType type) {
RawError* Debugger::SignalIsolateInterrupted() {
- if (HasEventHandler()) {
+ if (HasDebugEventHandler()) {
SignalIsolateEvent(DebuggerEvent::kIsolateInterrupted);
}
- Dart_IsolateInterruptCallback callback = isolate_->InterruptCallback();
- if (callback != NULL) {
- if (!(*callback)()) {
- if (FLAG_trace_isolates) {
- OS::Print("[!] Embedder api: terminating isolate:\n"
- "\tisolate: %s\n", isolate_->name());
- }
- const String& msg =
- String::Handle(String::New("isolate terminated by embedder"));
- return UnwindError::New(msg);
- }
- }
// If any error occurred while in the debug message loop, return it here.
const Error& error =
@@ -1411,7 +1404,7 @@ void Debugger::DeoptimizeWorld() {
void Debugger::SignalBpResolved(Breakpoint* bpt) {
- if (HasEventHandler() && !bpt->IsSingleShot()) {
+ if (HasDebugEventHandler() && !bpt->IsSingleShot()) {
DebuggerEvent event(isolate_, DebuggerEvent::kBreakpointResolved);
event.set_breakpoint(bpt);
InvokeEventHandler(&event);
@@ -1632,7 +1625,7 @@ void Debugger::SignalExceptionThrown(const Instance& exc) {
// interested in exception events.
if (ignore_breakpoints_ ||
IsPaused() ||
- (!HasEventHandler()) ||
+ (!HasDebugEventHandler()) ||
(exc_pause_info_ == kNoPauseOnExceptions)) {
return;
}
@@ -2616,9 +2609,6 @@ void Debugger::SignalPausedEvent(ActivationFrame* top_frame,
RawError* Debugger::DebuggerStepCallback() {
ASSERT(isolate_->single_step());
- // We can't get here unless the debugger event handler enabled
- // single stepping.
- ASSERT(HasEventHandler());
// Don't pause recursively.
if (IsPaused()) {
return Error::null();
@@ -2686,7 +2676,7 @@ RawError* Debugger::SignalBpReached() {
// We ignore this breakpoint when the VM is executing code invoked
// by the debugger to evaluate variables values, or when we see a nested
// breakpoint or exception event.
- if (ignore_breakpoints_ || IsPaused() || !HasEventHandler()) {
+ if (ignore_breakpoints_ || IsPaused()) {
return Error::null();
}
DebuggerStackTrace* stack_trace = CollectStackTrace();
@@ -2775,10 +2765,14 @@ void Debugger::BreakHere(const String& msg) {
// We ignore this breakpoint when the VM is executing code invoked
// by the debugger to evaluate variables values, or when we see a nested
// breakpoint or exception event.
- if (ignore_breakpoints_ || IsPaused() || !HasEventHandler()) {
+ if (ignore_breakpoints_ || IsPaused()) {
return;
}
+ if (!HasDebugEventHandler()) {
+ OS::Print("Hit debugger!");
+ }
+
DebuggerStackTrace* stack_trace = CollectStackTrace();
ASSERT(stack_trace->Length() > 0);
ASSERT(stack_trace_ == NULL);
« 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