Fix CrashReporter poping up when PPC is not emulated on pre-10.5 systems.

This commit is contained in:
asvitkine 2011-12-30 20:37:30 +00:00
parent 78ea64bbd9
commit 1a2566b58e
2 changed files with 20 additions and 0 deletions

View File

@ -39,6 +39,10 @@
#include <limits.h>
#include "vm_alloc.h"
#if defined(__APPLE__) && defined(__MACH__)
#include <sys/utsname.h>
#endif
#ifdef HAVE_MACH_VM
#ifndef HAVE_MACH_TASK_SELF
#ifdef HAVE_TASK_SELF
@ -181,6 +185,21 @@ int vm_init(void)
return -1;
#endif
#endif
// On 10.4 and earlier, reset CrashReporter's task signal handler to
// avoid having it show up for signals that get handled.
#if defined(__APPLE__) && defined(__MACH__)
struct utsname info;
if (!uname(&info) && atoi(info.release) <= 8) {
task_set_exception_ports(mach_task_self(),
EXC_MASK_BAD_ACCESS | EXC_MASK_ARITHMETIC,
MACH_PORT_NULL,
EXCEPTION_STATE_IDENTITY,
MACHINE_THREAD_STATE);
}
#endif
return 0;
}

View File

@ -32,6 +32,7 @@
#ifdef HAVE_MACH_VM
extern "C" {
#include <mach/mach.h>
#include <mach/task.h>
}
#endif