From ef53c07bec341d5660c097956ff4a73e7a68bd1e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 12 Apr 2004 01:47:17 +0000 Subject: [PATCH] sm_crash: pass reason to the crash handler in Windows --- stepmania/src/global.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/stepmania/src/global.cpp b/stepmania/src/global.cpp index 3f7312f342..931ee21de4 100644 --- a/stepmania/src/global.cpp +++ b/stepmania/src/global.cpp @@ -1,14 +1,19 @@ #include "global.h" #if defined(_WINDOWS) +#define _WIN32_WINDOWS 0x0410 // include Win98 stuff #include "windows.h" +#include "archutils/Win32/Crash.h" void NORETURN sm_crash( const char *reason ) { - // throws an exception that gets caught by the exception handler - DebugBreak(); + /* If we're being debugged, throw a debug break so it'll suspend the process. */ + if( IsDebuggerPresent() ) + DebugBreak(); + else + ForceCrashHandler( reason ); - /* Do something after calling DebugBreak, so the call/return isn't optimized - * to a jmp; that way, this function will appear in backtrace stack traces. */ + /* 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; } #elif defined(LINUX) || defined(DARWIN)