From 96b4d0d597bd732c0de238eb2b46fa6f651ce86f Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 9 Sep 2021 17:49:39 -0700 Subject: [PATCH v1 1/6] ci: backend: windows: DONTMERGE: crash reporting (backend). --- src/backend/main/main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend/main/main.c b/src/backend/main/main.c index ad84a45e28c..65a325723fd 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -26,6 +26,10 @@ #include #endif +#if defined(WIN32) +#include +#endif + #if defined(_M_AMD64) && _MSC_VER == 1800 #include #include @@ -238,7 +242,15 @@ startup_hacks(const char *progname) } /* In case of general protection fault, don't show GUI popup box */ - SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); + SetErrorMode(SEM_FAILCRITICALERRORS /* | SEM_NOGPFAULTERRORBOX */); + + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); +#ifndef __MINGW64__ + _set_abort_behavior(_CALL_REPORTFAULT | _WRITE_ABORT_MSG, _CALL_REPORTFAULT | _WRITE_ABORT_MSG); +#endif #if defined(_M_AMD64) && _MSC_VER == 1800 -- 2.32.0.rc2