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

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: code review, etc. 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 3d5739faafe5b061da2984d5f864fef3522f90f3..689bf3e5cc7ddc6c179e591d57d23a3a116c8dd9 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;
@@ -947,11 +951,60 @@ 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.", name);
+ break;
+ case ServiceEvent::kPauseExit:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused at "
+ "exit.", name);
+ break;
+ case ServiceEvent::kPauseException:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused due "
+ "to exception.", name);
+ break;
+ case ServiceEvent::kPauseInterrupted:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused due "
+ "to interrupt.", name);
+ break;
+ case ServiceEvent::kPauseBreakpoint:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused.",
+ name);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ if (!ServiceIsolate::IsRunning()) {
+ OS::PrintErr(" Start the vm-service to debug.\n");
+ } else if (ServiceIsolate::server_address() == NULL) {
+ OS::PrintErr(" Connect to Observatory to debug.\n");
+ } else {
+ OS::PrintErr(" Connect to Observatory at %s to debug.\n",
+ ServiceIsolate::server_address());
+ }
+}
+
+
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;
}
« no previous file with comments | « 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