mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-23 03:49:23 +00:00
Enabled SEH for MSVC builds
This commit is contained in:
parent
f4d709c0dd
commit
781606bec5
3 changed files with 7 additions and 5 deletions
|
@ -67,7 +67,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||||
set(GENERAL_FLAGS "/MP")
|
set(GENERAL_FLAGS "/MP /EHa")
|
||||||
set(WARNING_FLAGS "/Wall /WX /sdl")
|
set(WARNING_FLAGS "/Wall /WX /sdl")
|
||||||
set(SECURITY_FLAGS "/GS /guard:cf")
|
set(SECURITY_FLAGS "/GS /guard:cf")
|
||||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#pragma warning(disable : 4005 4061 4324 4365 4464 4619 4625 4626 4668 4710 4711 4804 4820 5039 5045 5220 5246 5264)
|
#pragma warning(disable : 4005 4061 4324 4365 4464 4619 4625 4626 4668 4710 4711 4714 4804 4820 5039 5045 5220 5246 5264)
|
||||||
#define FORCEINLINE __forceinline
|
#define FORCEINLINE __forceinline
|
||||||
#define NOINLINE __declspec(noinline)
|
#define NOINLINE __declspec(noinline)
|
||||||
#define LIKELY(expression) expression
|
#define LIKELY(expression) expression
|
||||||
|
|
|
@ -51,7 +51,7 @@ static const HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
#pragma comment(lib, "Dbghelp.lib")
|
#pragma comment(lib, "Dbghelp.lib")
|
||||||
|
|
||||||
LONG WINAPI UnhandledExceptionFilter(_In_ _EXCEPTION_POINTERS*)
|
LONG WINAPI UnhandledExceptionFilter(_In_ _EXCEPTION_POINTERS* exception_pointers)
|
||||||
{
|
{
|
||||||
constexpr size_t MAX_FRAMES = 32;
|
constexpr size_t MAX_FRAMES = 32;
|
||||||
|
|
||||||
|
@ -70,7 +70,9 @@ LONG WINAPI UnhandledExceptionFilter(_In_ _EXCEPTION_POINTERS*)
|
||||||
|
|
||||||
const HANDLE h = GetCurrentProcess();
|
const HANDLE h = GetCurrentProcess();
|
||||||
|
|
||||||
fprintf(stderr, "\n\nUnhandled exception at:\n");
|
const uint32_t code = (exception_pointers && exception_pointers->ExceptionRecord) ? exception_pointers->ExceptionRecord->ExceptionCode : 0;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n\nUnhandled exception %X at:\n", code);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
||||||
|
@ -86,7 +88,7 @@ LONG WINAPI UnhandledExceptionFilter(_In_ _EXCEPTION_POINTERS*)
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
// Normal logging might be broken at this point, but try to log it anyway
|
// Normal logging might be broken at this point, but try to log it anyway
|
||||||
LOGERR(0, "Unhandled exception at:");
|
LOGERR(0, "Unhandled exception " << log::Hex(code) << " at:");
|
||||||
|
|
||||||
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
for (size_t j = 0; j < MAX_FRAMES; ++j) {
|
||||||
const DWORD64 address = reinterpret_cast<DWORD64>(stack_trace[j]);
|
const DWORD64 address = reinterpret_cast<DWORD64>(stack_trace[j]);
|
||||||
|
|
Loading…
Reference in a new issue