Kaydet (Commit) 2fc5a65a authored tarafından Michael Stahl's avatar Michael Stahl

sal: add SAL_NO_ASSERT_DIALOGS variable to redirect...

... the dialogs that pop up on assert() and abort() to stderr, which
should work better in CI builds.

Change-Id: I80ec95bae6cc21b8ac27f68ca93aa6c6cce707f4
üst 71511385
......@@ -23,6 +23,9 @@
#include <windows.h>
#ifdef _MSC_VER
#pragma warning(pop)
#ifdef _DEBUG
#include <crtdbg.h>
#endif
#endif
#include <tlhelp32.h>
#include <systools/win32/uwinapi.h>
......@@ -148,6 +151,21 @@ static BOOL WINAPI RawDllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvRe
{
case DLL_PROCESS_ATTACH:
{
#ifdef _DEBUG
WCHAR buf[64];
DWORD const res = GetEnvironmentVariableW(L"SAL_NO_ASSERT_DIALOGS", buf, sizeof(buf));
if (res && res < sizeof(buf))
{
// disable the dialog on abort()
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ERROR, (_CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE));
// not sure which assertions this affects
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, (_CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE));
// disable the dialog on assert(false)
_set_error_mode(_OUT_TO_STDERR);
}
#endif
#endif
#if OSL_DEBUG_LEVEL < 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment