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

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

Issue 6092005: Remove base/debug_util. Move the debug UI related functions to base/debug/deb... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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/mac/os_crash_dumps.h ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/mac/os_crash_dumps.h"
6
7 #include <signal.h>
8 #include <unistd.h>
9
10 #include "base/basictypes.h"
11
12 namespace base {
13 namespace mac {
14
15 namespace {
16
17 void ExitSignalHandler(int sig) {
18 // A call to exit() can call atexit() handlers. If we SIGSEGV due
19 // to a corrupt heap, and if we have an atexit handler that
20 // allocates or frees memory, we are in trouble if we do not _exit.
21 _exit(128 + sig);
22 }
23
24 } // namespace
25
26 void DisableOSCrashDumps() {
27 // These are the POSIX signals corresponding to the Mach exceptions that
28 // Apple Crash Reporter handles. See ux_exception() in xnu's
29 // bsd/uxkern/ux_exception.c and machine_exception() in xnu's
30 // bsd/dev/*/unix_signal.c.
31 const int signals_to_intercept[] = {
32 SIGILL, // EXC_BAD_INSTRUCTION
33 SIGTRAP, // EXC_BREAKPOINT
34 SIGFPE, // EXC_ARITHMETIC
35 SIGBUS, // EXC_BAD_ACCESS
36 SIGSEGV // EXC_BAD_ACCESS
37 };
38
39 // For all these signals, just wire things up so we exit immediately.
40 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i)
41 signal(signals_to_intercept[i], ExitSignalHandler);
42 }
43
44 } // namespace mac
45 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/os_crash_dumps.h ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698