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

Unified Diff: runtime/vm/service.cc

Issue 1649843002: Add --warn-on-pause-with-no-debugger flag. Add this to --observe behavior. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 8991390491f3258fde761e22ea96b5170fe7b52e..b27a21fa601d65245464508e0ed762caa56466e2 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -47,6 +47,10 @@ DEFINE_FLAG(charp, vm_name, "vm",
"The default name of this vm as reported by the VM service "
"protocol");
+DEFINE_FLAG(bool, warn_on_pause_with_no_debugger, false,
+ "Print a message when an isolate is paused but there is no "
+ "debugger attached.");
+
// The name of this of this vm as reported by the VM service protocol.
static char* vm_name = NULL;
@@ -922,11 +926,52 @@ void Service::SendEventWithData(const char* stream_id,
}
+static void ReportPauseOnConsole(ServiceEvent* event) {
+ const char* name = event->isolate()->debugger_name();
+ switch (event->kind()) {
+ case ServiceEvent::kPauseStart:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused at "
+ "start. Connect to Observatory to debug.\n", name);
+ break;
+ case ServiceEvent::kPauseExit:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused at "
+ "exit. Connect to Observatory to debug.\n", name);
+ break;
+ case ServiceEvent::kPauseException:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused due "
+ "to exception. Connect to Observatory to debug.\n", name);
+ break;
+ case ServiceEvent::kPauseInterrupted:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused due "
+ "to interrupt. Connect to Observatory to debug.\n", name);
+ break;
+ case ServiceEvent::kPauseBreakpoint:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused. "
+ "Connect to Observatory to debug.\n", name);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+
void Service::HandleEvent(ServiceEvent* event) {
if (event->isolate() != NULL &&
ServiceIsolate::IsServiceIsolateDescendant(event->isolate())) {
return;
}
+ if (FLAG_warn_on_pause_with_no_debugger &&
+ event->IsPause() && !Service::debug_stream.enabled()) {
+ // If we are about to pause a running program which has no
+ // debugger connected, tell the user about it.
+ ReportPauseOnConsole(event);
+ }
if (!ServiceIsolate::IsRunning()) {
return;
}
« runtime/bin/main.cc ('K') | « runtime/vm/isolate.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698