Remove Exceptions since OS X does not catch them. Instead, it waits for the signal.
This commit is contained in:
@@ -385,12 +385,6 @@ typedef struct Frame
|
|||||||
void *linkReg;
|
void *linkReg;
|
||||||
} *FramePtr;
|
} *FramePtr;
|
||||||
|
|
||||||
void GetExceptionBacktraceContext( BacktraceContext *ctx, const ExceptionInformation *exception )
|
|
||||||
{
|
|
||||||
ctx->PC = (void *) exception->machineState->PC.lo;
|
|
||||||
ctx->FramePtr = (void *) exception->registerImage->R1.lo;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc )
|
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc )
|
||||||
{
|
{
|
||||||
ctx->PC = (void *) uc->uc_mcontext->ss.srr0;
|
ctx->PC = (void *) uc->uc_mcontext->ss.srr0;
|
||||||
|
|||||||
@@ -36,14 +36,6 @@ bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx );
|
|||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc );
|
void GetSignalBacktraceContext( BacktraceContext *ctx, const ucontext_t *uc );
|
||||||
|
|
||||||
#if defined(DARWIN)
|
|
||||||
#include <MachineExceptions.h>
|
|
||||||
|
|
||||||
/* Set up a BacktraceContext to get a backtrace after receiving an exception, given
|
|
||||||
* an ExceptionInformation*. */
|
|
||||||
void GetExceptionBacktraceContext( BacktraceContext *ctx, const ExceptionInformation *exception );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BACKTRACE_METHOD_NOT_AVAILABLE ((void*) -1)
|
#define BACKTRACE_METHOD_NOT_AVAILABLE ((void*) -1)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -218,38 +218,6 @@ static void parent_process( int to_child, const CrashData *crash )
|
|||||||
* signal trampolines. The result is that it doesn't properly show the
|
* signal trampolines. The result is that it doesn't properly show the
|
||||||
* function that actually caused the signal--which is the most important
|
* function that actually caused the signal--which is the most important
|
||||||
* one! So, we have to do it all ourself. */
|
* one! So, we have to do it all ourself. */
|
||||||
#if defined(DARWIN)
|
|
||||||
const char *ExceptionName( int signo )
|
|
||||||
{
|
|
||||||
#define X(code) case k##code: return #code;
|
|
||||||
switch( signo )
|
|
||||||
{
|
|
||||||
X(UnknownException)
|
|
||||||
X(IllegalInstructionException)
|
|
||||||
X(TrapException)
|
|
||||||
X(AccessException)
|
|
||||||
X(UnmappedMemoryException)
|
|
||||||
X(ExcludedMemoryException)
|
|
||||||
X(ReadOnlyMemoryException)
|
|
||||||
X(UnresolvablePageFaultException)
|
|
||||||
X(PrivilegeViolationException)
|
|
||||||
X(TraceException)
|
|
||||||
X(InstructionBreakpointException)
|
|
||||||
X(DataBreakpointException)
|
|
||||||
X(FloatingPointException)
|
|
||||||
X(StackOverflowException)
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
static char buf[128];
|
|
||||||
strcpy( buf, "Unknown exception " );
|
|
||||||
strcat( buf, itoa(signo) );
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#undef X
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char *SignalName( int signo )
|
const char *SignalName( int signo )
|
||||||
{
|
{
|
||||||
#define X(a) case a: return #a;
|
#define X(a) case a: return #a;
|
||||||
@@ -316,11 +284,6 @@ static void RunCrashHandler( const CrashData *crash )
|
|||||||
safe_print( fileno(stderr), "Deadlock (", crash->reason, ")", NULL );
|
safe_print( fileno(stderr), "Deadlock (", crash->reason, ")", NULL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(DARWIN)
|
|
||||||
case CrashData::OSX_EXCEPTION:
|
|
||||||
safe_print( fileno(stderr), "Fatal exception (", ExceptionName( crash->kind ), ")", NULL );
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case CrashData::FORCE_CRASH_THIS_THREAD:
|
case CrashData::FORCE_CRASH_THIS_THREAD:
|
||||||
safe_print( fileno(stderr), "Crash handler failed an assertion: \"", crash->reason, "\"", NULL );
|
safe_print( fileno(stderr), "Crash handler failed an assertion: \"", crash->reason, "\"", NULL );
|
||||||
break;
|
break;
|
||||||
@@ -465,24 +428,6 @@ void CrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc )
|
|||||||
RunCrashHandler( &crash );
|
RunCrashHandler( &crash );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DARWIN)
|
|
||||||
OSStatus CrashExceptionHandler( ExceptionInformation *e )
|
|
||||||
{
|
|
||||||
CrashData crash;
|
|
||||||
memset( &crash, 0, sizeof(crash) );
|
|
||||||
|
|
||||||
crash.type = CrashData::OSX_EXCEPTION;
|
|
||||||
crash.kind = e->theKind;
|
|
||||||
|
|
||||||
BacktraceContext ctx;
|
|
||||||
GetExceptionBacktraceContext( &ctx, e );
|
|
||||||
GetBacktrace( crash.BacktracePointers, BACKTRACE_MAX_SIZE, &ctx );
|
|
||||||
|
|
||||||
RunCrashHandler( &crash );
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void InitializeCrashHandler()
|
void InitializeCrashHandler()
|
||||||
{
|
{
|
||||||
InitializeBacktrace();
|
InitializeBacktrace();
|
||||||
|
|||||||
@@ -12,11 +12,6 @@ void InitializeCrashHandler();
|
|||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
void CrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc );
|
void CrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc );
|
||||||
|
|
||||||
#if defined(DARWIN)
|
|
||||||
#include <MachineExceptions.h>
|
|
||||||
OSStatus CrashExceptionHandler( ExceptionInformation *e );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -307,13 +307,6 @@ static void child_process()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DARWIN)
|
|
||||||
case CrashData::OSX_EXCEPTION:
|
|
||||||
reason = ExceptionName( crash.kind );
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case CrashData::FORCE_CRASH_THIS_THREAD:
|
case CrashData::FORCE_CRASH_THIS_THREAD:
|
||||||
case CrashData::FORCE_CRASH_DEADLOCK:
|
case CrashData::FORCE_CRASH_DEADLOCK:
|
||||||
crash.reason[ sizeof(crash.reason)-1] = 0;
|
crash.reason[ sizeof(crash.reason)-1] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user