Files
itgmania212121/stepmania/src/global.cpp
T

44 lines
965 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-05-06 09:13:37 +00:00
#endif
2004-02-25 01:35:19 +00:00
2004-05-06 09:13:37 +00:00
#if defined(CRASH_HANDLER) && (defined(LINUX) || defined(DARWIN))
2004-03-19 07:32:06 +00:00
#include "archutils/Unix/CrashHandler.h"
2004-03-20 09:26:54 +00:00
#include <unistd.h>
2004-05-06 09:13:37 +00:00
#endif
2004-03-26 02:55:13 +00:00
void NORETURN sm_crash( const char *reason )
2004-03-19 07:32:06 +00:00
{
2004-05-06 09:13:37 +00:00
#if defined(_WINDOWS)
/* If we're being debugged, throw a debug break so it'll suspend the process. */
if( IsDebuggerPresent() )
{
DebugBreak();
2004-05-06 09:18:15 +00:00
while(1); /* don't return */
2004-05-06 09:13:37 +00:00
}
#endif
#if defined(CRASH_HANDLER)
2004-03-26 02:55:13 +00:00
ForceCrashHandler( reason );
2004-02-25 01:35:19 +00:00
#else
*(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);
2004-05-06 09:13:37 +00:00
#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;
2004-05-07 00:40:02 +00:00
#else
_exit( 1 );
2004-05-06 09:13:37 +00:00
#endif
2004-02-25 01:35:19 +00:00
}
2004-05-06 09:13:37 +00:00