aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2008-04-12 00:47:46 +0000
committerNate Begeman <natebegeman@mac.com>2008-04-12 00:47:46 +0000
commit703a4f83c7e7b974ebed2b85f726fa7a2ea98070 (patch)
tree1f077a1fc4a6823c0e113722d2b26ed6a5b0f6b6 /lib/System
parent71c5887a787add262ddf068d913d6eaa53691708 (diff)
downloadexternal_llvm-703a4f83c7e7b974ebed2b85f726fa7a2ea98070.zip
external_llvm-703a4f83c7e7b974ebed2b85f726fa7a2ea98070.tar.gz
external_llvm-703a4f83c7e7b974ebed2b85f726fa7a2ea98070.tar.bz2
Restore code to disable crash catcher on older OS X systems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Unix/Process.inc26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc
index a2db4c6..8a2598b 100644
--- a/lib/System/Unix/Process.inc
+++ b/lib/System/Unix/Process.inc
@@ -123,6 +123,10 @@ int Process::GetCurrentGroupId() {
return getgid();
}
+#ifdef HAVE_MACH_MACH_H
+#include <mach/mach.h>
+#endif
+
// Some LLVM programs such as bugpoint produce core files as a normal part of
// their operation. To prevent the disk from filling up, this function
// does what's necessary to prevent their generation.
@@ -134,7 +138,27 @@ void Process::PreventCoreFiles() {
#endif
#ifdef HAVE_MACH_MACH_H
- // Disable crash reporting on Mac OS X.
+ // Disable crash reporting on Mac OS X 10.0-10.4
+
+ // get information about the original set of exception ports for the task
+ mach_msg_type_number_t Count = 0;
+ exception_mask_t OriginalMasks[EXC_TYPES_COUNT];
+ exception_port_t OriginalPorts[EXC_TYPES_COUNT];
+ exception_behavior_t OriginalBehaviors[EXC_TYPES_COUNT];
+ thread_state_flavor_t OriginalFlavors[EXC_TYPES_COUNT];
+ kern_return_t err =
+ task_get_exception_ports(mach_task_self(), EXC_MASK_ALL, OriginalMasks,
+ &Count, OriginalPorts, OriginalBehaviors,
+ OriginalFlavors);
+ if (err == KERN_SUCCESS) {
+ // replace each with MACH_PORT_NULL.
+ for (unsigned i = 0; i != Count; ++i)
+ task_set_exception_ports(mach_task_self(), OriginalMasks[i],
+ MACH_PORT_NULL, OriginalBehaviors[i],
+ OriginalFlavors[i]);
+ }
+
+ // Disable crash reporting on Mac OS X 10.5
signal(SIGABRT, _exit);
signal(SIGILL, _exit);
signal(SIGFPE, _exit);