1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

full crash dump

This commit is contained in:
Andrii Danylchenko 2020-12-02 08:28:57 +02:00 committed by Andrii Danylchenko
parent 2fc7cf02b0
commit e220918230
3 changed files with 28 additions and 2 deletions

View File

@ -66,6 +66,10 @@
"notifications" : { "notifications" : {
"type" : "boolean", "type" : "boolean",
"default" : false "default" : false
},
"extraDump" : {
"type" : "boolean",
"default" : false
} }
} }
}, },

View File

@ -9,6 +9,7 @@
*/ */
#include "StdInc.h" #include "StdInc.h"
#include "CConsoleHandler.h" #include "CConsoleHandler.h"
#include "CConfigHandler.h"
#include "CThreadHelper.h" #include "CThreadHelper.h"
@ -135,7 +136,27 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
strcat(mname, "_crashinfo.dmp"); strcat(mname, "_crashinfo.dmp");
HANDLE dfile = CreateFileA(mname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); HANDLE dfile = CreateFileA(mname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
logGlobal->error("Crash info will be put in %s", mname); logGlobal->error("Crash info will be put in %s", mname);
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dfile, MiniDumpWithDataSegs, &meinfo, 0, 0);
// flush loggers
std::string padding(1000, '@');
logGlobal->error(padding);
logAi->error(padding);
logNetwork->error(padding);
auto dumpType = MiniDumpWithDataSegs;
if(settings["general"]["extraDump"].Bool())
{
dumpType = (MINIDUMP_TYPE)(
MiniDumpWithFullMemory
| MiniDumpWithFullMemoryInfo
| MiniDumpWithHandleData
| MiniDumpWithUnloadedModules
| MiniDumpWithThreadInfo);
}
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dfile, dumpType, &meinfo, 0, 0);
MessageBoxA(0, "VCMI has crashed. We are sorry. File with information about encountered problem has been created.", "VCMI Crashhandler", MB_OK | MB_ICONERROR); MessageBoxA(0, "VCMI has crashed. We are sorry. File with information about encountered problem has been created.", "VCMI Crashhandler", MB_OK | MB_ICONERROR);
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }

View File

@ -334,6 +334,7 @@ void CVCMIServer::threadHandleClient(std::shared_ptr<CConnection> c)
if(state != EServerState::LOBBY) if(state != EServerState::LOBBY)
gh->handleClientDisconnection(c); gh->handleClientDisconnection(c);
} }
/*
catch(const std::exception & e) catch(const std::exception & e)
{ {
(void)e; (void)e;
@ -345,7 +346,7 @@ void CVCMIServer::threadHandleClient(std::shared_ptr<CConnection> c)
state = EServerState::SHUTDOWN; state = EServerState::SHUTDOWN;
handleException(); handleException();
throw; throw;
} }*/
boost::unique_lock<boost::recursive_mutex> queueLock(mx); boost::unique_lock<boost::recursive_mutex> queueLock(mx);
// if(state != ENDING_AND_STARTING_GAME) // if(state != ENDING_AND_STARTING_GAME)