sm_crash: pass reason to the crash handler in Windows

This commit is contained in:
Glenn Maynard
2004-04-12 01:47:17 +00:00
parent abd4b43719
commit ef53c07bec
+8 -3
View File
@@ -1,14 +1,19 @@
#include "global.h" #include "global.h"
#if defined(_WINDOWS) #if defined(_WINDOWS)
#define _WIN32_WINDOWS 0x0410 // include Win98 stuff
#include "windows.h" #include "windows.h"
#include "archutils/Win32/Crash.h"
void NORETURN sm_crash( const char *reason ) void NORETURN sm_crash( const char *reason )
{ {
// throws an exception that gets caught by the exception handler /* If we're being debugged, throw a debug break so it'll suspend the process. */
if( IsDebuggerPresent() )
DebugBreak(); DebugBreak();
else
ForceCrashHandler( reason );
/* Do something after calling DebugBreak, so the call/return isn't optimized /* Do something after the above, so the call/return isn't optimized to a jmp; that
* to a jmp; that way, this function will appear in backtrace stack traces. */ * way, this function will appear in backtrace stack traces. */
_asm nop; _asm nop;
} }
#elif defined(LINUX) || defined(DARWIN) #elif defined(LINUX) || defined(DARWIN)