sm_crash: take a reason
when failing an assertion, pass the reason to sm_crash, in case we don't make it to logging checkpoints
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
#include "windows.h"
|
||||
void NORETURN sm_crash()
|
||||
void NORETURN sm_crash( const char *reason )
|
||||
{
|
||||
// throws an exception that gets caught by the exception handler
|
||||
DebugBreak();
|
||||
@@ -14,13 +14,13 @@ void NORETURN sm_crash()
|
||||
#elif defined(LINUX) || defined(DARWIN)
|
||||
#include "archutils/Unix/CrashHandler.h"
|
||||
#include <unistd.h>
|
||||
void NORETURN sm_crash()
|
||||
void NORETURN sm_crash( const char *reason )
|
||||
{
|
||||
ForceCrashHandler( "Internal error" );
|
||||
ForceCrashHandler( reason );
|
||||
_exit( 1 );
|
||||
}
|
||||
#else
|
||||
void NORETURN sm_crash()
|
||||
void NORETURN sm_crash( const char *reason )
|
||||
{
|
||||
*(char*)0=0;
|
||||
|
||||
|
||||
@@ -88,13 +88,13 @@ namespace Checkpoints
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
void NORETURN sm_crash();
|
||||
void NORETURN sm_crash( const char *reason = "Internal error" );
|
||||
|
||||
/* Assertion that sets an optional message and brings up the crash handler, so
|
||||
* we get a backtrace. This should probably be used instead of throwing an
|
||||
* exception in most cases we expect never to happen (but not in cases that
|
||||
* we do expect, such as DSound init failure.) */
|
||||
#define FAIL_M(MESSAGE) { CHECKPOINT_M(MESSAGE); sm_crash(); }
|
||||
#define FAIL_M(MESSAGE) { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); }
|
||||
#define ASSERT_M(COND, MESSAGE) { if(!(COND)) { FAIL_M(MESSAGE); } }
|
||||
#define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user