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

Side by Side Diff: base/mac/os_crash_dumps.cc

Issue 347803004: Ensure the OSX crash catcher does not trigger on SIGABRT when disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Edit Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/test/data/nacl/bad/ppapi_bad.html » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/mac/os_crash_dumps.h" 5 #include "base/mac/os_crash_dumps.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 void DisableOSCrashDumps() { 27 void DisableOSCrashDumps() {
28 // These are the POSIX signals corresponding to the Mach exceptions that 28 // These are the POSIX signals corresponding to the Mach exceptions that
29 // Apple Crash Reporter handles. See ux_exception() in xnu's 29 // Apple Crash Reporter handles. See ux_exception() in xnu's
30 // bsd/uxkern/ux_exception.c and machine_exception() in xnu's 30 // bsd/uxkern/ux_exception.c and machine_exception() in xnu's
31 // bsd/dev/*/unix_signal.c. 31 // bsd/dev/*/unix_signal.c.
32 const int signals_to_intercept[] = { 32 const int signals_to_intercept[] = {
33 // Hardware faults
33 SIGILL, // EXC_BAD_INSTRUCTION 34 SIGILL, // EXC_BAD_INSTRUCTION
34 SIGTRAP, // EXC_BREAKPOINT 35 SIGTRAP, // EXC_BREAKPOINT
35 SIGFPE, // EXC_ARITHMETIC 36 SIGFPE, // EXC_ARITHMETIC
36 SIGBUS, // EXC_BAD_ACCESS 37 SIGBUS, // EXC_BAD_ACCESS
37 SIGSEGV // EXC_BAD_ACCESS 38 SIGSEGV, // EXC_BAD_ACCESS
39 // Not a hardware fault
40 SIGABRT
38 }; 41 };
39 42
40 // For all these signals, just wire things up so we exit immediately. 43 // For all these signals, just wire things up so we exit immediately.
41 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) { 44 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) {
42 struct sigaction act = {}; 45 struct sigaction act = {};
43 act.sa_handler = ExitSignalHandler; 46 act.sa_handler = ExitSignalHandler;
44 47
45 // It is better to allow the signal handler to run on the stack 48 // It is better to allow the signal handler to run on the stack
46 // registered with sigaltstack(), if one is present. 49 // registered with sigaltstack(), if one is present.
47 act.sa_flags = SA_ONSTACK; 50 act.sa_flags = SA_ONSTACK;
48 51
49 if (sigemptyset(&act.sa_mask) != 0) 52 if (sigemptyset(&act.sa_mask) != 0)
50 DPLOG(FATAL) << "sigemptyset() failed"; 53 DPLOG(FATAL) << "sigemptyset() failed";
51 if (sigaction(signals_to_intercept[i], &act, NULL) != 0) 54 if (sigaction(signals_to_intercept[i], &act, NULL) != 0)
52 DPLOG(FATAL) << "sigaction() failed"; 55 DPLOG(FATAL) << "sigaction() failed";
53 } 56 }
54 } 57 }
55 58
56 } // namespace mac 59 } // namespace mac
57 } // namespace base 60 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/nacl/bad/ppapi_bad.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698