mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Add auto dmp file genration
This commit is contained in:
@@ -68,6 +68,7 @@ option(USE_LTO "Use link-time optimization" OFF)
|
|||||||
option(WITH_BETTER_RENDERER "Experimental multi-backend renderer based on NVRHI" ON)
|
option(WITH_BETTER_RENDERER "Experimental multi-backend renderer based on NVRHI" ON)
|
||||||
option(GENERATE_PDB "Generate executable with program debugging symbols" ON)
|
option(GENERATE_PDB "Generate executable with program debugging symbols" ON)
|
||||||
option(ENABLE_MCC "Enable multicore compilation" ON)
|
option(ENABLE_MCC "Enable multicore compilation" ON)
|
||||||
|
option(WITHDUMPGEN "Enable generating DMP files on crash" ON)
|
||||||
|
|
||||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
@@ -265,6 +266,10 @@ if (WITH_LUA)
|
|||||||
set(SOURCES ${SOURCES} "lua.cpp")
|
set(SOURCES ${SOURCES} "lua.cpp")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITHDUMPGEN)
|
||||||
|
set(DEFINITIONS ${DEFINITIONS} "WITHDUMPGEN")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WITH_OPENGL_MODERN)
|
if (WITH_OPENGL_MODERN)
|
||||||
set(SOURCES ${SOURCES}
|
set(SOURCES ${SOURCES}
|
||||||
"opengl33geometrybank.cpp"
|
"opengl33geometrybank.cpp"
|
||||||
|
|||||||
28
EU07.cpp
28
EU07.cpp
@@ -21,6 +21,10 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "Logs.h"
|
#include "Logs.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#ifdef WITHDUMPGEN
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <DbgHelp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
|
||||||
@@ -28,8 +32,32 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
|||||||
|
|
||||||
void export_e3d_standalone(std::string in, std::string out, int flags, bool dynamic);
|
void export_e3d_standalone(std::string in, std::string out, int flags, bool dynamic);
|
||||||
|
|
||||||
|
#ifdef WITHDUMPGEN
|
||||||
|
LONG WINAPI CrashHandler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||||
|
{
|
||||||
|
HANDLE hFile = CreateFileA("crash.dmp", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||||
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
|
||||||
|
dumpInfo.ThreadId = GetCurrentThreadId();
|
||||||
|
dumpInfo.ExceptionPointers = ExceptionInfo;
|
||||||
|
dumpInfo.ClientPointers = FALSE;
|
||||||
|
|
||||||
|
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithDataSegs, &dumpInfo, nullptr, nullptr);
|
||||||
|
CloseHandle(hFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
#ifdef WITHDUMPGEN
|
||||||
|
SetUnhandledExceptionFilter(CrashHandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
// quick short-circuit for standalone e3d export
|
// quick short-circuit for standalone e3d export
|
||||||
if (argc == 6 && std::string(argv[1]) == "-e3d") {
|
if (argc == 6 && std::string(argv[1]) == "-e3d") {
|
||||||
std::string in(argv[2]);
|
std::string in(argv[2]);
|
||||||
|
|||||||
Reference in New Issue
Block a user