cleanup
This commit is contained in:
+22
-17
@@ -4,33 +4,38 @@
|
|||||||
#define _WIN32_WINDOWS 0x0410 // include Win98 stuff
|
#define _WIN32_WINDOWS 0x0410 // include Win98 stuff
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "archutils/Win32/Crash.h"
|
#include "archutils/Win32/Crash.h"
|
||||||
void NORETURN sm_crash( const char *reason )
|
#endif
|
||||||
{
|
|
||||||
/* If we're being debugged, throw a debug break so it'll suspend the process. */
|
|
||||||
if( IsDebuggerPresent() )
|
|
||||||
DebugBreak();
|
|
||||||
else
|
|
||||||
ForceCrashHandler( reason );
|
|
||||||
|
|
||||||
/* Do something after the above, so the call/return isn't optimized to a jmp; that
|
#if defined(CRASH_HANDLER) && (defined(LINUX) || defined(DARWIN))
|
||||||
* way, this function will appear in backtrace stack traces. */
|
|
||||||
_asm nop;
|
|
||||||
}
|
|
||||||
#elif defined(LINUX) || defined(DARWIN)
|
|
||||||
#include "archutils/Unix/CrashHandler.h"
|
#include "archutils/Unix/CrashHandler.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void NORETURN sm_crash( const char *reason )
|
void NORETURN sm_crash( const char *reason )
|
||||||
{
|
{
|
||||||
ForceCrashHandler( reason );
|
#if defined(_WINDOWS)
|
||||||
_exit( 1 );
|
/* If we're being debugged, throw a debug break so it'll suspend the process. */
|
||||||
|
if( IsDebuggerPresent() )
|
||||||
|
{
|
||||||
|
DebugBreak();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CRASH_HANDLER)
|
||||||
|
ForceCrashHandler( reason );
|
||||||
#else
|
#else
|
||||||
void NORETURN sm_crash( const char *reason )
|
|
||||||
{
|
|
||||||
*(char*)0=0;
|
*(char*)0=0;
|
||||||
|
|
||||||
/* This isn't actually reached. We just do this to convince the compiler that the
|
/* This isn't actually reached. We just do this to convince the compiler that the
|
||||||
* function really doesn't return. */
|
* function really doesn't return. */
|
||||||
while(1);
|
while(1);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WINDOWS)
|
||||||
|
/* Do something after the above, so the call/return isn't optimized to a jmp; that
|
||||||
|
* way, this function will appear in backtrace stack traces. */
|
||||||
|
_asm nop;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user