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

Side by Side Diff: base/debug_util_mac.cc

Issue 3945002: Move debug-related stuff from base to the base/debug directory and use the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/debug_util.cc ('k') | base/debug_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug_util.h" 5 #include "base/debug_util.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <unistd.h>
8 9
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 11
11 static void ExitSignalHandler(int sig) { 12 static void ExitSignalHandler(int sig) {
12 // A call to exit() can call atexit() handlers. If we SIGSEGV due 13 // A call to exit() can call atexit() handlers. If we SIGSEGV due
13 // to a corrupt heap, and if we have an atexit handler that 14 // to a corrupt heap, and if we have an atexit handler that
14 // allocates or frees memory, we are in trouble if we do not _exit. 15 // allocates or frees memory, we are in trouble if we do not _exit.
15 _exit(128 + sig); 16 _exit(128 + sig);
16 } 17 }
17 18
18 // static 19 // static
19 void DebugUtil::DisableOSCrashDumps() { 20 void DebugUtil::DisableOSCrashDumps() {
20 // These are the POSIX signals corresponding to the Mach exceptions that 21 // These are the POSIX signals corresponding to the Mach exceptions that
21 // Apple Crash Reporter handles. See ux_exception() in xnu's 22 // Apple Crash Reporter handles. See ux_exception() in xnu's
22 // bsd/uxkern/ux_exception.c and machine_exception() in xnu's 23 // bsd/uxkern/ux_exception.c and machine_exception() in xnu's
23 // bsd/dev/*/unix_signal.c. 24 // bsd/dev/*/unix_signal.c.
24 const int signals_to_intercept[] = { 25 const int signals_to_intercept[] = {
25 SIGILL, // EXC_BAD_INSTRUCTION 26 SIGILL, // EXC_BAD_INSTRUCTION
26 SIGTRAP, // EXC_BREAKPOINT 27 SIGTRAP, // EXC_BREAKPOINT
27 SIGFPE, // EXC_ARITHMETIC 28 SIGFPE, // EXC_ARITHMETIC
28 SIGBUS, // EXC_BAD_ACCESS 29 SIGBUS, // EXC_BAD_ACCESS
29 SIGSEGV // EXC_BAD_ACCESS 30 SIGSEGV // EXC_BAD_ACCESS
30 }; 31 };
31 32
32 // For all these signals, just wire things up so we exit immediately. 33 // For all these signals, just wire things up so we exit immediately.
33 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) { 34 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) {
34 signal(signals_to_intercept[i], ExitSignalHandler); 35 signal(signals_to_intercept[i], ExitSignalHandler);
35 } 36 }
36 } 37 }
OLDNEW
« no previous file with comments | « base/debug_util.cc ('k') | base/debug_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698