Browse Source

Enable crashhandler for mingw. It works for mingw 4.0.

AlexVinS 10 years ago
parent
commit
017b4c308c
2 changed files with 4 additions and 3 deletions
  1. 1 3
      lib/CConsoleHandler.cpp
  2. 3 0
      lib/VCMI_lib.cbp

+ 1 - 3
lib/CConsoleHandler.cpp

@@ -28,8 +28,8 @@ DLL_LINKAGE CConsoleHandler * console = nullptr;
 	#define CONSOLE_TEAL "\x1b[1;36m"
 #else
 	#include <Windows.h>
+	#include <dbghelp.h>	
 #ifndef __MINGW32__
-	#include <dbghelp.h>
 	#pragma comment(lib, "dbghelp.lib")
 #endif
 	typedef WORD TColor;
@@ -121,7 +121,6 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
 	const DWORD threadId = ::GetCurrentThreadId();
     logGlobal->errorStream() << "Thread ID: " << threadId << " [" << std::dec << std::setw(0) << threadId << "]";
 
-#ifndef __MINGW32__
 	//exception info to be placed in the dump
 	MINIDUMP_EXCEPTION_INFORMATION meinfo = {threadId, exception, TRUE};
 
@@ -140,7 +139,6 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
 	HANDLE dfile = CreateFileA(mname, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
     logGlobal->errorStream() << "Crash info will be put in " << mname;
 	MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), dfile, MiniDumpWithDataSegs, &meinfo, 0, 0);
-#endif
 	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;
 }

+ 3 - 0
lib/VCMI_lib.cbp

@@ -31,6 +31,7 @@
 					<Add option="-lboost_chrono$(#boost.libsuffix)" />
 					<Add option="-lboost_locale$(#boost.libsuffix)" />
 					<Add option="-liconv" />
+					<Add option="-ldbghelp" />
 					<Add directory="$(#sdl2.lib)" />
 					<Add directory="$(#boost.lib32)" />
 					<Add directory="$(#zlib.lib)" />
@@ -59,6 +60,7 @@
 					<Add option="-lboost_chrono$(#boost.libsuffix)" />
 					<Add option="-lboost_locale$(#boost.libsuffix)" />
 					<Add option="-liconv" />
+					<Add option="-ldbghelp" />
 					<Add directory="$(#sdl2.lib)" />
 					<Add directory="$(#boost.lib32)" />
 					<Add directory="$(#zlib.lib)" />
@@ -88,6 +90,7 @@
 					<Add option="-lboost_chrono$(#boost.libsuffix)" />
 					<Add option="-lboost_locale$(#boost.libsuffix)" />
 					<Add option="-liconv" />
+					<Add option="-ldbghelp" />
 					<Add directory="$(#sdl2.lib64)" />
 					<Add directory="$(#boost.lib64)" />
 					<Add directory="$(#zlib64.lib)" />