Skip to content

Commit

Permalink
engine: crashhandler: few improvements for win32 crashhandler
Browse files Browse the repository at this point in the history
* Larger message buffer
* Print version at first line
* Tell SDL2 to ungrab mouse
  • Loading branch information
a1batross committed Jul 8, 2024
1 parent 02cb12e commit 166bed7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion engine/common/crashhandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static int Sys_ModuleName( HANDLE process, char *name, void *address, int len )

static void Sys_StackTrace( PEXCEPTION_POINTERS pInfo )
{
char message[1024];
char message[8192]; // match *nix Sys_Crash
int len = 0;
size_t i;
HANDLE process = GetCurrentProcess();
Expand Down Expand Up @@ -148,6 +148,10 @@ static void Sys_StackTrace( PEXCEPTION_POINTERS pInfo )
#elif
#error
#endif

len = Q_snprintf( message, sizeof( message ), "Ver: " XASH_ENGINE_NAME " " XASH_VERSION " (build %i-%s, %s-%s)\n",
Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );

len += Q_snprintf( message + len, 1024 - len, "Sys_Crash: address %p, code %p\n",
pInfo->ExceptionRecord->ExceptionAddress, (void*)pInfo->ExceptionRecord->ExceptionCode );
if( SymGetLineFromAddr64( process, (DWORD64)pInfo->ExceptionRecord->ExceptionAddress, &dline, &line ) )
Expand Down Expand Up @@ -275,6 +279,10 @@ static long _stdcall Sys_Crash( PEXCEPTION_POINTERS pInfo )
// check to avoid recursive call
host.crashed = true;

#ifdef XASH_SDL
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
#endif // XASH_SDL

#if DBGHELP
Sys_StackTrace( pInfo );
#else
Expand Down

0 comments on commit 166bed7

Please sign in to comment.