summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:20:15 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:20:15 +0000
commit6ecb97b1ce16a00dcce6d800ea7670dd58355d59 (patch)
treef6040924539214c31d824f0a9a947f572188012f
parentbdbcd8a06ccc7b903ed224a311315d7f3ba8e227 (diff)
downloadchromium_src-6ecb97b1ce16a00dcce6d800ea7670dd58355d59.zip
chromium_src-6ecb97b1ce16a00dcce6d800ea7670dd58355d59.tar.gz
chromium_src-6ecb97b1ce16a00dcce6d800ea7670dd58355d59.tar.bz2
Linux: make --renderer-startup-dialog work on Linux.
This is needed, along with --enable-sandbox-debugging, to debug SUID sandboxed renderers. With this patch, one can run: ./out/Debug/chrome --enable-sandbox-debugging --renderer-startup-dialog Then, in GDB, attach to the PID which is printed to stderr and continue. Then send SIGUSR1 to the PID to resume the renderer. http://codereview.chromium.org/159211 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21303 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/renderer_main.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index 2dfe061..f5d7811 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -29,6 +29,12 @@
#include "chrome/app/breakpad_linux.h"
#endif
+#if defined(OS_POSIX)
+#include <signal.h>
+
+static void SigUSR1Handler(int signal) { }
+#endif
+
// This function provides some ways to test crash and assertion handling
// behavior of the renderer.
static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
@@ -51,15 +57,21 @@ static void HandleRendererErrorTestParameters(const CommandLine& command_line) {
title += L" renderer"; // makes attaching to process easier
::MessageBox(NULL, message.c_str(), title.c_str(),
MB_OK | MB_SETFOREGROUND);
-#elif defined(OS_MACOSX)
+#elif defined(OS_POSIX)
// TODO(playmobil): In the long term, overriding this flag doesn't seem
// right, either use our own flag or open a dialog we can use.
// This is just to ease debugging in the interim.
LOG(WARNING) << "Renderer ("
<< getpid()
<< ") paused waiting for debugger to attach @ pid";
+ // Install a signal handler so that pause can be woken.
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SigUSR1Handler;
+ sigaction(SIGUSR1, &sa, NULL);
+
pause();
-#endif // defined(OS_MACOSX)
+#endif // defined(OS_POSIX)
}
}