CRASH_HANDLER is always defined for OS X. Make sure that we _exit() after fatal signals. (Initialize the crash handler while I'm at it since that's likely to be needed for the x86 crash handler, which I can't really write without an x86.)

This commit is contained in:
Steve Checkoway
2007-05-16 08:07:49 +00:00
parent 11262ae912
commit 66894d80ed
@@ -37,7 +37,6 @@ static bool DoCleanShutdown( int signal, siginfo_t *si, const ucontext_t *uc )
return true;
}
#if defined(CRASH_HANDLER)
static bool DoCrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *uc )
{
/* Don't dump a debug file if the user just hit ^C. */
@@ -47,17 +46,22 @@ static bool DoCrashSignalHandler( int signal, siginfo_t *si, const ucontext_t *u
CrashHandler::CrashSignalHandler( signal, si, uc );
return true; // Unreached
}
#endif
static bool DoEmergencyShutdown( int signal, siginfo_t *si, const ucontext_t *us )
{
if( IsFatalSignal(signal) )
_exit( 1 ); // We ran the crash handler already
return false;
}
void ArchHooks_darwin::Init()
{
/* First, handle non-fatal termination signals. */
SignalHandler::OnClose( DoCleanShutdown );
#if defined(CRASH_HANDLER)
CrashHandler::CrashHandlerHandleArgs( g_argc, g_argv );
CrashHandler::InitializeCrashHandler();
SignalHandler::OnClose( DoCrashSignalHandler );
#endif
SignalHandler::OnClose( DoEmergencyShutdown );
// CF*Copy* functions' return values need to be released, CF*Get* functions' do not.
CFStringRef key = CFSTR( "ApplicationBundlePath" );