diff options
author | Tor Lillqvist <tlillqvist@novell.com> | 2011-08-17 18:33:04 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@novell.com> | 2011-08-17 20:59:45 +0300 |
commit | 2495f15abb72cfcaea07fc20151b574e4d254df0 (patch) | |
tree | 1b67ea2506cdda5e9b0ab0d46d95119937fcc39e /sal | |
parent | 7f3a944146879d2f0e6ee3f69cf721eb14f18689 (diff) |
Do use _CrtDbgReport() in a _DEBUG (enable-dbgutil, non-pro) build
Diffstat (limited to 'sal')
-rw-r--r-- | sal/cppunittester/cppunittester.cxx | 8 | ||||
-rwxr-xr-x | sal/osl/w32/diagnose.c | 18 |
2 files changed, 17 insertions, 9 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index b351870b6a22..78da5dd9cf7c 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -126,6 +126,14 @@ SAL_IMPLEMENT_MAIN() { //windows DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX); SetErrorMode(SEM_NOGPFAULTERRORBOX|dwMode); +#ifdef _DEBUG // These functions are present only in the debgging runtime + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG|_CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); +#endif #endif CppUnit::TestResult result; diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c index 30356ee9af8c..f8fc997fff40 100755 --- a/sal/osl/w32/diagnose.c +++ b/sal/osl/w32/diagnose.c @@ -28,15 +28,11 @@ #include "system.h" -#define NO_DEBUG_CRT - #include <osl/diagnose.h> #include <osl/thread.h> #include "printtrace.h" -#define NO_DEBUG_CRT - static pfunc_osl_printDebugMessage _pPrintDebugMessage = NULL; static pfunc_osl_printDetailedDebugMessage _pPrintDetailedDebugMessage = NULL; @@ -61,7 +57,10 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf void SAL_CALL osl_breakDebug(void) { - DebugBreak(); + if ( IsDebuggerPresent() ) + DebugBreak(); + else + abort (); } void osl_trace(char const * pszFormat, ...) { @@ -84,8 +83,10 @@ void osl_trace(char const * pszFormat, ...) { sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nLine, const sal_Char* pszMessage) { -#ifndef NO_DEBUG_CRT - return (_CrtDbgReport(_CRT_ASSERT, pszFileName, nLine, NULL, pszMessage)); + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); +#if defined(_DEBUG) && !defined(NO_DEBUG_CRT) + _CrtDbgReport(_CRT_ASSERT, pszFileName, nLine, NULL, pszMessage); + return ( ( env != NULL ) && ( *env != '\0' ) ); #else HWND hWndParent; UINT nFlags; @@ -93,7 +94,6 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL /* get app name or NULL if unknown (don't call assert) */ LPCSTR lpszAppName = "Error"; sal_Char szMessage[512]; - char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); /* format message into buffer */ szMessage[sizeof(szMessage)-1] = '\0'; /* zero terminate always */ @@ -144,7 +144,7 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL } return sal_False; -#endif /* NO_DEBUG_CRT */ +#endif /* _DEBUG && !NO_DEBUG_CRT */ } sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszMessage) |