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

Unified Diff: mojo/shell/child_process.cc

Issue 1107633002: Improve multi-process debugging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 8 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 | « no previous file | mojo/shell/child_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/child_process.cc
diff --git a/mojo/shell/child_process.cc b/mojo/shell/child_process.cc
index eecb98cb66f3534d0a6885393b1a8a7611909e5e..df5eb498e565124c5346b36154dec395c83645d5 100644
--- a/mojo/shell/child_process.cc
+++ b/mojo/shell/child_process.cc
@@ -4,9 +4,11 @@
#include "mojo/shell/child_process.h"
+#include "base/base_switches.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
+#include "base/debug/debugger.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
@@ -279,6 +281,19 @@ int ChildProcessMain() {
DVLOG(2) << "ChildProcessMain()";
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kWaitForDebugger)) {
+ std::string app = command_line.GetSwitchValueASCII(switches::kApp);
+#if defined(OS_WIN)
+ MessageBox(NULL, command_line.GetSwitchValueNative(switches::kApp).c_str(),
+ command_line.GetSwitchValueNative(switches::kApp).c_str(),
+ MB_OK | MB_SETFOREGROUND);
+#else
+ LOG(ERROR) << command_line.GetSwitchValueASCII(switches::kApp)
+ << " waiting for GDB. pid: " << getpid();
+ base::debug::WaitForDebugger(60, true);
+#endif
+ }
+
embedder::ScopedPlatformHandle platform_channel =
embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
command_line);
« no previous file with comments | « no previous file | mojo/shell/child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698