Files
itgmania212121/stepmania/src/global.cpp
T

37 lines
929 B
C++
Raw Normal View History

2003-02-16 03:56:52 +00:00
#include "global.h"
2004-03-19 07:32:06 +00:00
#if defined(_WINDOWS)
#define _WIN32_WINDOWS 0x0410 // include Win98 stuff
2004-02-25 01:35:19 +00:00
#include "windows.h"
#include "archutils/Win32/Crash.h"
2004-03-26 02:55:13 +00:00
void NORETURN sm_crash( const char *reason )
2004-02-25 01:35:19 +00:00
{
/* If we're being debugged, throw a debug break so it'll suspend the process. */
if( IsDebuggerPresent() )
DebugBreak();
else
ForceCrashHandler( reason );
2004-02-25 01:35:19 +00:00
/* 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. */
2004-02-25 01:35:19 +00:00
_asm nop;
}
2004-03-19 07:32:06 +00:00
#elif defined(LINUX) || defined(DARWIN)
#include "archutils/Unix/CrashHandler.h"
2004-03-20 09:26:54 +00:00
#include <unistd.h>
2004-03-26 02:55:13 +00:00
void NORETURN sm_crash( const char *reason )
2004-03-19 07:32:06 +00:00
{
2004-03-26 02:55:13 +00:00
ForceCrashHandler( reason );
2004-03-19 07:32:06 +00:00
_exit( 1 );
}
2004-02-25 01:35:19 +00:00
#else
2004-03-26 02:55:13 +00:00
void NORETURN sm_crash( const char *reason )
2004-02-25 01:35:19 +00:00
{
*(char*)0=0;
/* This isn't actually reached. We just do this to convince the compiler that the
* function really doesn't return. */
while(1);
}
#endif