Do use _CrtDbgReport() in a _DEBUG (enable-dbgutil, non-pro) build

This commit is contained in:
Tor Lillqvist 2011-08-17 18:33:04 +03:00
parent 7f3a944146
commit 2495f15abb
2 changed files with 17 additions and 9 deletions

View file

@ -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;

View file

@ -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)