summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/debug_util.h2
-rw-r--r--chrome/app/chrome_dll_main.cc16
2 files changed, 17 insertions, 1 deletions
diff --git a/base/debug_util.h b/base/debug_util.h
index 8ae0a2b..de49c43 100644
--- a/base/debug_util.h
+++ b/base/debug_util.h
@@ -44,7 +44,7 @@ class DebugUtil {
// Are we running under a debugger?
// On OS X, the underlying mechanism doesn't work when the sandbox is enabled.
- // To get around this, this function caches it's value.
+ // To get around this, this function caches its value.
// WARNING: Because of this, on OS X, a call MUST be made to this function
// BEFORE the sandbox is enabled.
static bool BeingDebugged();
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 8cc1e93..5281553 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -15,6 +15,8 @@
#include <atlapp.h>
#include <malloc.h>
#include <new.h>
+#elif defined(OS_POSIX)
+#include <signal.h>
#endif
#if defined(OS_LINUX)
@@ -315,6 +317,20 @@ int ChromeMain(int argc, const char** argv) {
browser_pid = StringToInt(WideToASCII(channel_name));
DCHECK(browser_pid != 0);
+
+#if defined(OS_POSIX)
+ // When you hit Ctrl-C in a terminal running the browser
+ // process, a SIGINT is delivered to the entire process group.
+ // When debugging the browser process via gdb, gdb catches the
+ // SIGINT for the browser process (and dumps you back to the gdb
+ // console) but doesn't for the child processes, killing them.
+ // The fix is to have child processes ignore SIGINT; they'll die
+ // on their own when the browser process goes away.
+ // Note that we *can't* rely on DebugUtil::BeingDebugged to catch this
+ // case because we are the child process, which is not being debugged.
+ if (!DebugUtil::BeingDebugged())
+ signal(SIGINT, SIG_IGN);
+#endif
}
SetupCRT(parsed_command_line);