From 166bed732e40f91549926c945b1a655aaf64d45b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 8 Jul 2024 05:56:17 +0300 Subject: [PATCH] engine: crashhandler: few improvements for win32 crashhandler * Larger message buffer * Print version at first line * Tell SDL2 to ungrab mouse --- engine/common/crashhandler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engine/common/crashhandler.c b/engine/common/crashhandler.c index c0136028..1edc4618 100644 --- a/engine/common/crashhandler.c +++ b/engine/common/crashhandler.c @@ -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(); @@ -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 ) ) @@ -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