debuglevels: #i116845# replace the 'CoreDump' output channel for assertions with 'Debug'

The former was implemented on Windows only, and then effectively the same as the 'Debugger' option.
So, it was removed in favour of a new 'Abort' channel which, well, aborts when an assertion fires.
This commit is contained in:
Frank Schoenheit [fs] 2011-02-20 23:09:20 +01:00
parent 9abbe475a4
commit 192c891e56
3 changed files with 36 additions and 12 deletions

View file

@ -80,7 +80,7 @@ typedef void (*DbgTestSolarMutexProc)();
#define DBG_OUT_MSGBOX 4
#define DBG_OUT_TESTTOOL 5
#define DBG_OUT_DEBUGGER 6
#define DBG_OUT_COREDUMP 7
#define DBG_OUT_ABORT 7
#define DBG_OUT_COUNT 8
@ -137,6 +137,7 @@ struct DbgDataType
#define DBG_FUNC_GETPRINTMSGBOX 17
#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967
#define DBG_FUNC_UPDATEOSLHOOK 19
#define DBG_FUNC_SET_ABORT 20
TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
@ -180,6 +181,11 @@ inline void DbgSetPrintTestTool( DbgPrintLine pProc )
DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc );
}
inline void DbgSetAbort( DbgPrintLine pProc )
{
DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc );
}
typedef sal_uInt16 DbgChannelId;
/** registers a user-defined channel for emitting the diagnostic messages

View file

@ -152,6 +152,7 @@ struct DebugData
DbgPrintLine pDbgPrintMsgBox;
DbgPrintLine pDbgPrintWindow;
DbgPrintLine pDbgPrintTestTool;
DbgPrintLine pDbgAbort;
::std::vector< DbgPrintLine >
aDbgPrintUserChannels;
PointerList* pProfList;
@ -163,9 +164,10 @@ struct DebugData
DebugData()
:bInit( sal_False )
,pDbgPrintMsgBox( sal_False )
,pDbgPrintMsgBox( NULL )
,pDbgPrintWindow( NULL )
,pDbgPrintTestTool( NULL )
,pDbgAbort( NULL )
,pProfList( NULL )
,pXtorList( NULL )
,pDbgTestSolarMutex( NULL )
@ -420,7 +422,7 @@ namespace
{
const sal_Char* names[ DBG_OUT_COUNT ] =
{
"dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "coredump"
"dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort"
};
lcl_writeConfigString( _pFile, _pKeyName, names[ _nValue ] );
}
@ -475,7 +477,7 @@ namespace
{
const sal_Char* names[ DBG_OUT_COUNT ] =
{
"dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "coredump"
"dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort"
};
sal_Char aBuf[20];
size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) );
@ -1199,6 +1201,10 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
pDebugData->pDbgPrintTestTool = (DbgPrintLine)(long)pParam;
break;
case DBG_FUNC_SET_ABORT:
pDebugData->pDbgAbort = (DbgPrintLine)(long)pParam;
break;
case DBG_FUNC_SAVEDATA:
{
const DbgData* pData = static_cast< const DbgData* >( pParam );
@ -1706,10 +1712,12 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut, const sal_Char* pFile, sa
nOut = DBG_OUT_DEBUGGER;
}
if ( nOut == DBG_OUT_COREDUMP )
if ( nOut == DBG_OUT_ABORT )
{
if ( !ImplCoreDump() )
nOut = DBG_OUT_DEBUGGER;
if ( pData->pDbgAbort != NULL )
pData->pDbgAbort( aBufOut );
abort();
nOut = DBG_OUT_DEBUGGER;
}
if ( nOut == DBG_OUT_DEBUGGER )

View file

@ -346,8 +346,8 @@ static const sal_Char* pDbgHelpText[] =
"Attempt to activate the debugger and produce the message there, in order to "
"always obtain the corresponding stack trace in the debugger.\n",
"\n",
"CoreDump\n",
"Causes a crash\n",
"Abort\n",
"Aborts the application\n",
"\n",
"\n",
"Reroute osl messages - Checkbox\n",
@ -1083,7 +1083,7 @@ DbgDialog::DbgDialog() :
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
maTraceBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maTraceBox );
ImplSelectChannel( maTraceBox, pData->nTraceOut, 0 );
maTraceBox.Show();
@ -1106,7 +1106,7 @@ DbgDialog::DbgDialog() :
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
maWarningBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maWarningBox );
ImplSelectChannel( maWarningBox, pData->nWarningOut, 0 );
maWarningBox.Show();
@ -1135,7 +1135,7 @@ DbgDialog::DbgDialog() :
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "MessageBox" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "TestTool" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Debugger" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "CoreDump" ) ) );
maErrorBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) ) );
ImplAppendUserDefinedChannels( maErrorBox );
ImplSelectChannel( maErrorBox, pData->nErrorOut, mnErrorOff );
maErrorBox.Show();
@ -1962,6 +1962,14 @@ void DbgPrintWindow( const char* pLine )
bIn = sal_False;
}
// -----------------------------------------------------------------------
void DbgAbort( char const * i_message )
{
::rtl::OUString const message( i_message, strlen( i_message ), osl_getThreadTextEncoding() );
Application::Abort( message );
}
// =======================================================================
void ImplDbgTestSolarMutex()
@ -1977,6 +1985,7 @@ void DbgGUIInit()
DbgSetPrintMsgBox( DbgPrintMsgBox );
DbgSetPrintWindow( DbgPrintWindow );
DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
DbgSetAbort( DbgAbort );
}
// -----------------------------------------------------------------------
@ -1986,6 +1995,7 @@ void DbgGUIDeInit()
DbgSetPrintMsgBox( NULL );
DbgSetPrintWindow( NULL );
DbgSetTestSolarMutex( NULL );
DbgSetAbort( NULL );
DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
if ( pDbgWindow )