summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-01 16:08:52 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-01 16:08:52 +0000
commitd028296ec1c0fdfbd40e2390ca3121de7055295d (patch)
treeda32e476d290074ceaaaaee65659e54a2dae822f /base/mac
parent1e3d150462ba6d3f9952e2ee976cb26396e3452c (diff)
downloadchromium_src-d028296ec1c0fdfbd40e2390ca3121de7055295d.zip
chromium_src-d028296ec1c0fdfbd40e2390ca3121de7055295d.tar.gz
chromium_src-d028296ec1c0fdfbd40e2390ca3121de7055295d.tar.bz2
Remove base/debug_util. Move the debug UI related functions to base/debug/debugger.h
Move the OS X specific crash report changing function to base/mac/os_crash_dumps TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6092005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70358 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/os_crash_dumps.cc45
-rw-r--r--base/mac/os_crash_dumps.h20
2 files changed, 65 insertions, 0 deletions
diff --git a/base/mac/os_crash_dumps.cc b/base/mac/os_crash_dumps.cc
new file mode 100644
index 0000000..e82fd73
--- /dev/null
+++ b/base/mac/os_crash_dumps.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/mac/os_crash_dumps.h"
+
+#include <signal.h>
+#include <unistd.h>
+
+#include "base/basictypes.h"
+
+namespace base {
+namespace mac {
+
+namespace {
+
+void ExitSignalHandler(int sig) {
+ // A call to exit() can call atexit() handlers. If we SIGSEGV due
+ // to a corrupt heap, and if we have an atexit handler that
+ // allocates or frees memory, we are in trouble if we do not _exit.
+ _exit(128 + sig);
+}
+
+} // namespace
+
+void DisableOSCrashDumps() {
+ // These are the POSIX signals corresponding to the Mach exceptions that
+ // Apple Crash Reporter handles. See ux_exception() in xnu's
+ // bsd/uxkern/ux_exception.c and machine_exception() in xnu's
+ // bsd/dev/*/unix_signal.c.
+ const int signals_to_intercept[] = {
+ SIGILL, // EXC_BAD_INSTRUCTION
+ SIGTRAP, // EXC_BREAKPOINT
+ SIGFPE, // EXC_ARITHMETIC
+ SIGBUS, // EXC_BAD_ACCESS
+ SIGSEGV // EXC_BAD_ACCESS
+ };
+
+ // For all these signals, just wire things up so we exit immediately.
+ for (size_t i = 0; i < arraysize(signals_to_intercept); ++i)
+ signal(signals_to_intercept[i], ExitSignalHandler);
+}
+
+} // namespace mac
+} // namespace base
diff --git a/base/mac/os_crash_dumps.h b/base/mac/os_crash_dumps.h
new file mode 100644
index 0000000..9758575
--- /dev/null
+++ b/base/mac/os_crash_dumps.h
@@ -0,0 +1,20 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_MAC_OS_CRASH_DUMPS_H_
+#define BASE_MAC_OS_CRASH_DUMPS_H_
+
+namespace base {
+namespace mac {
+
+// On Mac OS X, it can take a really long time for the OS crash handler to
+// process a Chrome crash when debugging symbols are available. This
+// translates into a long wait until the process actually dies. This call
+// disables Apple Crash Reporter entirely.
+void DisableOSCrashDumps();
+
+} // namespace mac
+} // namespace base
+
+#endif // BASE_MAC_OS_CRASH_DUMPS_H_