summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/debug.hxx111
-rw-r--r--tools/source/debug/debug.cxx511
-rw-r--r--vcl/source/app/dbggui.cxx166
3 files changed, 20 insertions, 768 deletions
diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx
index de606a1bd4d3..2583d7f3544b 100644
--- a/include/tools/debug.hxx
+++ b/include/tools/debug.hxx
@@ -28,8 +28,7 @@
/** The facilities provided by this header are deprecated. True assertions
(that detect broken program logic) should use standard assert (which aborts
if an assertion fails, and is controlled by the standard NDEBUG macro).
- Logging of warnings (e.g., about malformed input) and traces (e.g., about
- steps taken while executing some protocol) should use the facilities
+ Logging of warnings (e.g., about malformed input) should use the facilities
provided by sal/log.hxx.
Because the assertion macro (DBG_ASSERT) has been used for
@@ -47,13 +46,6 @@ typedef void (*DbgTestSolarMutexProc)();
#define DBG_BUF_MAXLEN 16384
-#define DBG_TEST_XTOR (0x00000FFF)
-#define DBG_TEST_XTOR_THIS (0x00000001)
-#define DBG_TEST_XTOR_FUNC (0x00000002)
-#define DBG_TEST_XTOR_EXIT (0x00000004)
-#define DBG_TEST_XTOR_REPORT (0x00000008)
-#define DBG_TEST_XTOR_TRACE (0x00000010)
-
#define DBG_TEST_RESOURCE (0x02000000)
#define DBG_TEST_DIALOG (0x04000000)
#define DBG_TEST_BOLDAPPFONT (0x08000000)
@@ -76,7 +68,6 @@ struct DbgData
{
sal_uIntPtr nTestFlags;
bool bOverwrite;
- sal_uIntPtr nTraceOut;
sal_uIntPtr nErrorOut;
sal_Char aDebugName[260];
sal_Char aInclFilter[512];
@@ -99,7 +90,6 @@ struct DbgDataType
#define DBG_FUNC_SAVEDATA 5
#define DBG_FUNC_SETPRINTMSGBOX 6
#define DBG_FUNC_SETPRINTWINDOW 7
-#define DBG_FUNC_XTORINFO 10
#define DBG_FUNC_COREDUMP 12
#define DBG_FUNC_ALLERROROUT 13
#define DBG_FUNC_SETTESTSOLARMUTEX 14
@@ -146,7 +136,6 @@ typedef sal_uInt16 DbgChannelId;
the function for emitting the diagnostic messages
@return
a unique number for this channel, which can be used for ->DbgData::nErrorOut
- and ->DbgData::nTraceOut
@see DBG_OUT_USER_CHANNEL_0
(In theory, this function could replace the other hard-coded channels. Well, at least
@@ -205,11 +194,6 @@ inline sal_uIntPtr DbgIsBoldAppFont()
return sal_False;
}
-inline void DbgXtorInfo( sal_Char* pBuf )
-{
- DbgFunc( DBG_FUNC_XTORINFO, (void*)pBuf );
-}
-
inline void DbgCoreDump()
{
DbgFunc( DBG_FUNC_COREDUMP );
@@ -230,85 +214,12 @@ inline void DbgPrintFile( const sal_Char* pLine )
DbgFunc( DBG_FUNC_PRINTFILE, (void*)(sal_Char*)pLine );
}
-// Dbg output
-#define DBG_OUT_TRACE 1
-#define DBG_OUT_ERROR 2
-
TOOLS_DLLPUBLIC void DbgPrintShell(char const * message);
-TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ... );
-
-// Dbg test functions
-
-#define DBG_XTOR_CTOR 1
-#define DBG_XTOR_DTOR 2
-#define DBG_XTOR_CHKTHIS 3
-#define DBG_XTOR_CHKOBJ 4
-#define DBG_XTOR_DTOROBJ 0x8000
-
-TOOLS_DLLPUBLIC void DbgXtor( DbgDataType* pDbgData,
- sal_uInt16 nAction, const void* pThis, DbgUsr fDbgUsr );
-
-class DbgXtorObj
-{
-private:
- DbgDataType* pDbgData;
- const void* pThis;
- DbgUsr fDbgUsr;
- sal_uInt16 nAction;
-
-public:
- DbgXtorObj( DbgDataType* pData,
- sal_uInt16 nAct, const void* pThs, DbgUsr fUsr )
- {
- DbgXtor( pData, nAct, pThs, fUsr );
- pDbgData = pData;
- nAction = nAct;
- pThis = pThs;
- fDbgUsr = fUsr;
- }
-
- ~DbgXtorObj()
- {
- DbgXtor( pDbgData, nAction | DBG_XTOR_DTOROBJ,
- pThis, fDbgUsr );
- }
-};
-
-// (internally used) defines
-
-#define DBG_FUNC( aName ) DbgName_##aName()
-#define DBG_NAME( aName ) static DbgDataType aImpDbgData_##aName = { 0, #aName }; \
- DbgDataType* DBG_FUNC( aName ) { return &aImpDbgData_##aName; }
-#define DBG_NAMEEX_VISIBILITY( aName, vis ) vis DbgDataType* DBG_FUNC( aName );
-#define DBG_NAMEEX( aName ) DBG_NAMEEX_VISIBILITY( aName, )
-
-// (externally used) defines
+TOOLS_DLLPUBLIC void DbgOutTypef( const sal_Char* pFStr, ... );
#define DBG_DEBUGSTART() DbgDebugStart()
#define DBG_DEBUGEND() DbgDebugEnd()
-#define DBG_CTOR( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \
- DBG_XTOR_CTOR, \
- (const void*)this, \
- fTest )
-
-#define DBG_DTOR( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \
- DBG_XTOR_DTOR, \
- (const void*)this, \
- fTest )
-
-#define DBG_CHKTHIS( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( DBG_FUNC( aName ), \
- DBG_XTOR_CHKTHIS, \
- (const void*)this, \
- fTest )
-
-#define DBG_CHKOBJ( pObj, aName, fTest ) \
- DbgXtor( DBG_FUNC( aName ), DBG_XTOR_CHKOBJ, \
- (const void*)pObj, (DbgUsr)fTest )
-
#define DBG_ASSERTWARNING( sCon, aWarning ) \
SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", aWarning)
@@ -327,14 +238,6 @@ do \
DbgTestSolarMutex(); \
} while(false)
-// en-/disable debug defines
-
-#define DBG_INSTOUTTRACE( nOut ) \
-do \
-{ \
- DbgGetData()->nTraceOut = nOut; \
-} while(false)
-
#define DBG_INSTOUTERROR( nOut ) \
do \
{ \
@@ -353,15 +256,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis );
#define DBG_DEBUGSTART() ((void)0)
#define DBG_DEBUGEND() ((void)0)
-#define DBG_NAME( aName )
-#define DBG_NAMEEX( aName )
-#define DBG_NAMEEX_VISIBILITY( aName, vis )
-
-#define DBG_CTOR( aName, fTest ) ((void)0)
-#define DBG_DTOR( aName, fTest ) ((void)0)
-#define DBG_CHKTHIS( aName, fTest ) ((void)0)
-#define DBG_CHKOBJ( pObj, aName, fTest ) ((void)0)
-
#define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0)
#define DBG_ASSERT( sCon, aError ) ((void)0)
#define DBG_WARNING( aWarning ) ((void)0)
@@ -369,7 +263,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis );
#define DBG_TESTSOLARMUTEX() ((void)0)
-#define DBG_INSTOUTTRACE( nOut ) ((void)0)
#define DBG_INSTOUTERROR( nOut ) ((void)0)
#endif
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index 08364597f738..6ef827fb206b 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -47,54 +47,6 @@
#ifdef DBG_UTIL
-void DbgOutf( const sal_Char* pFStr, ... );
-
-// PointerList
-
-#define PBLOCKCOUNT 1024
-
-struct PBlock
-{
- void* aData[PBLOCKCOUNT];
- sal_uInt16 nCount;
- PBlock* pPrev;
- PBlock* pNext;
-};
-
-class PointerList
-{
-private:
- PBlock* pFirst;
- PBlock* pLast;
- sal_uIntPtr nCount;
-
-public:
- PointerList() { pFirst = NULL; pLast = NULL; nCount = 0; }
- ~PointerList();
-
- void Add( const void* p );
- bool Remove( const void* p );
-
- const void* Get( sal_uIntPtr nPos ) const;
- bool IsIn( const void* p ) const;
- sal_uIntPtr Count() const { return nCount; }
-};
-
-// data types
-
-#define DBG_MAXNAME 28
-
-struct XtorType
-{
- sal_uIntPtr nCtorCalls;
- sal_uIntPtr nDtorCalls;
- sal_uIntPtr nMaxCount;
- sal_uIntPtr nStatics;
- sal_Char aName[DBG_MAXNAME+1];
- bool bTest;
- PointerList aThisList;
-};
-
struct DebugData
{
DbgData aDbgData;
@@ -104,7 +56,6 @@ struct DebugData
DbgPrintLine pDbgAbort;
::std::vector< DbgPrintLine >
aDbgPrintUserChannels;
- PointerList* pXtorList;
DbgTestSolarMutexProc pDbgTestSolarMutex;
DebugData()
@@ -112,12 +63,10 @@ struct DebugData
,pDbgPrintMsgBox( NULL )
,pDbgPrintWindow( NULL )
,pDbgAbort( NULL )
- ,pXtorList( NULL )
,pDbgTestSolarMutex( NULL )
{
aDbgData.nTestFlags = DBG_TEST_RESOURCE;
aDbgData.bOverwrite = true;
- aDbgData.nTraceOut = DBG_OUT_NULL;
#ifdef UNX
aDbgData.nErrorOut = DBG_OUT_SHELL;
#else
@@ -132,11 +81,6 @@ struct DebugData
}
};
-#define DBG_TEST_XTOR_EXTRA (DBG_TEST_XTOR_THIS | DBG_TEST_XTOR_FUNC | \
- DBG_TEST_XTOR_EXIT | DBG_TEST_XTOR_REPORT )
-
-// static maintenance variables
-
static DebugData aDebugData;
static sal_Char aCurPath[260];
static bool bDbgImplInMain = false;
@@ -224,7 +168,6 @@ namespace
eOutput,
eMemory,
eGUI,
- eObjects,
eTest,
eUnknown
@@ -243,7 +186,6 @@ namespace
case eOutput : pSectionName = "output"; break;
case eMemory : pSectionName = "memory"; break;
case eGUI : pSectionName = "gui"; break;
- case eObjects : pSectionName = "objects"; break;
case eTest : pSectionName = "test"; break;
case eUnknown:
OSL_ASSERT(false);
@@ -260,8 +202,6 @@ namespace
return eMemory;
if ( strncmp( _pSectionName, "gui", _nSectionNameLength < 3 ? _nSectionNameLength : 3 ) == 0 )
return eGUI;
- if ( strncmp( _pSectionName, "objects", _nSectionNameLength < 7 ? _nSectionNameLength : 7 ) == 0 )
- return eObjects;
if ( strncmp( _pSectionName, "test", _nSectionNameLength < 4 ? _nSectionNameLength : 4 ) == 0 )
return eTest;
return eUnknown;
@@ -377,144 +317,6 @@ namespace
}
}
-PointerList::~PointerList()
-{
- PBlock* pBlock = pFirst;
- while ( pBlock )
- {
- PBlock* pNextBlock = pBlock->pNext;
- delete pBlock;
- pBlock = pNextBlock;
- }
-}
-
-void PointerList::Add( const void* p )
-{
- if ( !pFirst )
- {
- pFirst = new PBlock;
- memset( pFirst->aData, 0, PBLOCKCOUNT * sizeof( void* ) );
- pFirst->nCount = 0;
- pFirst->pPrev = NULL;
- pFirst->pNext = NULL;
- pLast = pFirst;
- }
-
- PBlock* pBlock = pFirst;
- while ( pBlock && (pBlock->nCount == PBLOCKCOUNT) )
- pBlock = pBlock->pNext;
-
- if ( !pBlock )
- {
- pBlock = new PBlock;
- memset( pBlock->aData, 0, PBLOCKCOUNT * sizeof( void* ) );
- pBlock->nCount = 0;
- pBlock->pPrev = pLast;
- pBlock->pNext = NULL;
- pLast->pNext = pBlock;
- pLast = pBlock;
- }
-
- sal_uInt16 i = 0;
- while ( pBlock->aData[i] )
- i++;
-
- pBlock->aData[i] = (void*)p;
- pBlock->nCount++;
- nCount++;
-}
-
-bool PointerList::Remove( const void* p )
-{
- if ( !p )
- return false;
-
- PBlock* pBlock = pFirst;
- while ( pBlock )
- {
- sal_uInt16 i = 0;
- while ( i < PBLOCKCOUNT )
- {
- if ( ((sal_uIntPtr)p) == ((sal_uIntPtr)pBlock->aData[i]) )
- {
- pBlock->aData[i] = NULL;
- pBlock->nCount--;
- nCount--;
-
- if ( !pBlock->nCount )
- {
- if ( pBlock->pPrev )
- pBlock->pPrev->pNext = pBlock->pNext;
- if ( pBlock->pNext )
- pBlock->pNext->pPrev = pBlock->pPrev;
- if ( pBlock == pFirst )
- pFirst = pBlock->pNext;
- if ( pBlock == pLast )
- pLast = pBlock->pPrev;
- delete pBlock;
- }
-
- return true;
- }
- i++;
- }
-
- pBlock = pBlock->pNext;
- }
-
- return false;
-}
-
-const void* PointerList::Get( sal_uIntPtr nPos ) const
-{
- if ( nCount <= nPos )
- return NULL;
-
- PBlock* pBlock = pFirst;
- sal_uIntPtr nStart = 0;
- while ( pBlock )
- {
- sal_uInt16 i = 0;
- while ( i < PBLOCKCOUNT )
- {
- if ( pBlock->aData[i] )
- {
- nStart++;
- if ( (nStart-1) == nPos )
- return pBlock->aData[i];
- }
-
- i++;
- }
-
- pBlock = pBlock->pNext;
- }
-
- return NULL;
-}
-
-bool PointerList::IsIn( const void* p ) const
-{
- if ( !p )
- return false;
-
- PBlock* pBlock = pFirst;
- while ( pBlock )
- {
- sal_uInt16 i = 0;
- while ( i < PBLOCKCOUNT )
- {
- if ( ((sal_uIntPtr)p) == ((sal_uIntPtr)pBlock->aData[i]) )
- return true;
- i++;
- }
-
- pBlock = pBlock->pNext;
- }
-
- return false;
-}
-
static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen )
{
#if defined( UNX )
@@ -589,7 +391,6 @@ static DebugData* GetDebugData()
lcl_tryReadConfigString( pLine, nLineLength, "exclude", aDebugData.aDbgData.aExclFilter, sizeof( aDebugData.aDbgData.aExclFilter ) );
lcl_tryReadConfigString( pLine, nLineLength, "include_class", aDebugData.aDbgData.aInclClassFilter, sizeof( aDebugData.aDbgData.aInclClassFilter ) );
lcl_tryReadConfigString( pLine, nLineLength, "exclude_class", aDebugData.aDbgData.aExclClassFilter, sizeof( aDebugData.aDbgData.aExclClassFilter ) );
- lcl_tryReadOutputChannel( pLine, nLineLength, "trace", &aDebugData.aDbgData.nTraceOut );
lcl_tryReadOutputChannel( pLine, nLineLength, "error", &aDebugData.aDbgData.nErrorOut );
}
@@ -599,16 +400,6 @@ static DebugData* GetDebugData()
lcl_tryReadConfigString( pLine, nLineLength, "debug_window_state", aDebugData.aDbgData.aDbgWinState, sizeof( aDebugData.aDbgData.aDbgWinState ) );
}
- // elements of the [objects] section
- if ( eCurrentSection == eObjects )
- {
- lcl_tryReadConfigFlag( pLine, nLineLength, "check_this", &aDebugData.aDbgData.nTestFlags, DBG_TEST_XTOR_THIS );
- lcl_tryReadConfigFlag( pLine, nLineLength, "check_function", &aDebugData.aDbgData.nTestFlags, DBG_TEST_XTOR_FUNC );
- lcl_tryReadConfigFlag( pLine, nLineLength, "check_exit", &aDebugData.aDbgData.nTestFlags, DBG_TEST_XTOR_EXIT );
- lcl_tryReadConfigFlag( pLine, nLineLength, "generate_report", &aDebugData.aDbgData.nTestFlags, DBG_TEST_XTOR_REPORT );
- lcl_tryReadConfigFlag( pLine, nLineLength, "trace", &aDebugData.aDbgData.nTestFlags, DBG_TEST_XTOR_TRACE );
- }
-
// elements of the [test] section
if ( eCurrentSection == eTest )
{
@@ -624,7 +415,6 @@ static DebugData* GetDebugData()
}
else
{
- lcl_matchOutputChannel( getenv( "DBGSV_TRACE_OUT" ), &aDebugData.aDbgData.nTraceOut );
lcl_matchOutputChannel( getenv( "DBGSV_ERROR_OUT" ), &aDebugData.aDbgData.nErrorOut );
}
@@ -634,10 +424,6 @@ static DebugData* GetDebugData()
{
OSL_TRACE( "getcwd failed with error %s", strerror(errno) );
}
-
- // initialize debug data
- if ( aDebugData.aDbgData.nTestFlags & DBG_TEST_XTOR )
- aDebugData.pXtorList = new PointerList;
}
return &aDebugData;
@@ -773,113 +559,18 @@ static void DebugInit()
static void DebugDeInit()
{
- DebugData* pData = GetDebugData();
- sal_uIntPtr i;
- sal_uIntPtr nCount;
- sal_uIntPtr nOldOut;
-
- // Output statistics trace data to file
- nOldOut = pData->aDbgData.nTraceOut;
- pData->aDbgData.nTraceOut = DBG_OUT_FILE;
-
- // output Xtor list
- if ( pData->pXtorList && pData->pXtorList->Count() &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_REPORT) )
- {
- DbgOutf( "------------------------------------------------------------------------------" );
- DbgOutf( "Object Report" );
- DbgOutf( "------------------------------------------------------------------------------" );
- DbgOutf( "%-27s : %-9s : %-9s : %-7s : %-3s : %-6s :",
- "XTor-List", "Ctor", "Dtor", "MaxInst", "St.", "Diff." );
- DbgOutf( "----------------------------:-----------:-----------:---------:----:---------:" );
- for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
- {
- XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
- if ( pXtorData->bTest )
- {
- // Add static objects
- pXtorData->nDtorCalls += pXtorData->nStatics;
- if ( pXtorData->nStatics && (pXtorData->nDtorCalls > pXtorData->nCtorCalls) )
- pXtorData->nDtorCalls = pXtorData->nCtorCalls;
- DbgOutf( "%-27s : %9lu : %9lu : %7lu : %3lu : %4lu %-1s :",
- pXtorData->aName, pXtorData->nCtorCalls, pXtorData->nDtorCalls,
- pXtorData->nMaxCount, pXtorData->nStatics,
- pXtorData->nCtorCalls - pXtorData->nDtorCalls,
- (pXtorData->nCtorCalls - pXtorData->nDtorCalls) ? "!" : " " );
- }
- }
- DbgOutf( "==============================================================================" );
- }
-
- // free XtorList
- if ( pData->pXtorList )
- {
- for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
- {
- XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
- delete pXtorData;
- }
- delete pData->pXtorList;
- pData->pXtorList = NULL;
- }
-
// Set everything to false, as global variables
// may cause a system crash otherwise.
// Maintain memory flags, as otherwise new/delete calls
// for global variables will crash,
// as pointer alignment won't work then.
- pData->aDbgData.nTraceOut = nOldOut;
+ DebugData* pData = GetDebugData();
pData->aDbgData.nTestFlags = 0;
pData->aDbgPrintUserChannels.clear();
pData->pDbgPrintWindow = NULL;
ImplDbgDeInitLock();
}
-void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... )
-{
- va_list pList;
-
- va_start( pList, pFStr );
- sal_Char aBuf[DBG_BUF_MAXLEN];
- vsprintf( aBuf, pFStr, pList );
- va_end( pList );
-
- strcat( pBuf, aBuf );
- strcat( pBuf, "\n" );
-}
-
-static void DebugXTorInfo( sal_Char* pBuf )
-{
- DebugData* pData = GetDebugData();
- sal_uIntPtr i;
- sal_uIntPtr nCount;
-
- // output Xtor list
- if ( pData->pXtorList && pData->pXtorList->Count() &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_REPORT) )
- {
- ImpDbgOutfBuf( pBuf, "------------------------------------------------------------------------------" );
- ImpDbgOutfBuf( pBuf, "Object Report" );
- ImpDbgOutfBuf( pBuf, "------------------------------------------------------------------------------" );
- ImpDbgOutfBuf( pBuf, "%-27s : %-9s : %-9s : %-7s : %-3s : %-6s :",
- "XTor-List", "Ctor", "Dtor", "MaxInst", "St.", "Diff." );
- ImpDbgOutfBuf( pBuf, "----------------------------:-----------:-----------:---------:----:---------:" );
- for( i = 0, nCount = pData->pXtorList->Count(); i < nCount; i++ )
- {
- XtorType* pXtorData = (XtorType*)pData->pXtorList->Get( i );
- if ( pXtorData->bTest )
- {
- ImpDbgOutfBuf( pBuf, "%-27s : %9lu : %9lu : %7lu : %3lu : %6lu :",
- pXtorData->aName, pXtorData->nCtorCalls, pXtorData->nDtorCalls,
- pXtorData->nMaxCount, pXtorData->nStatics,
- pXtorData->nCtorCalls - pXtorData->nDtorCalls );
- }
- }
- ImpDbgOutfBuf( pBuf, "==============================================================================" );
- ImpDbgOutfBuf( pBuf, "" );
- }
-}
-
bool ImplDbgFilterMessage( const sal_Char* pMsg )
{
DebugData* pData = GetDebugData();
@@ -937,7 +628,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
lcl_writeConfigString( pIniFile, "exclude", pData->aExclFilter );
lcl_writeConfigString( pIniFile, "include_class", pData->aInclClassFilter );
lcl_writeConfigString( pIniFile, "exclude_class", pData->aExclClassFilter );
- lcl_writeConfigOutChannel( pIniFile, "trace", pData->nTraceOut );
lcl_writeConfigOutChannel( pIniFile, "error", pData->nErrorOut );
lcl_lineFeed( pIniFile );
@@ -945,14 +635,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
lcl_writeConfigString( pIniFile, "debug_window_state", pData->aDbgWinState );
lcl_lineFeed( pIniFile );
- lcl_startSection( pIniFile, eObjects );
- lcl_writeConfigFlag( pIniFile, "check_this", pData->nTestFlags, DBG_TEST_XTOR_THIS );
- lcl_writeConfigFlag( pIniFile, "check_function", pData->nTestFlags, DBG_TEST_XTOR_FUNC );
- lcl_writeConfigFlag( pIniFile, "check_exit", pData->nTestFlags, DBG_TEST_XTOR_EXIT );
- lcl_writeConfigFlag( pIniFile, "generate_report", pData->nTestFlags, DBG_TEST_XTOR_REPORT );
- lcl_writeConfigFlag( pIniFile, "trace", pData->nTestFlags, DBG_TEST_XTOR_TRACE );
-
- lcl_lineFeed( pIniFile );
lcl_startSection( pIniFile, eTest );
lcl_writeConfigFlag( pIniFile, "resources", pData->nTestFlags, DBG_TEST_RESOURCE );
lcl_writeConfigFlag( pIniFile, "dialog", pData->nTestFlags, DBG_TEST_DIALOG );
@@ -962,10 +644,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
}
break;
- case DBG_FUNC_XTORINFO:
- DebugXTorInfo( (sal_Char*)pParam );
- break;
-
case DBG_FUNC_COREDUMP:
ImplCoreDump();
break;
@@ -1001,160 +679,7 @@ DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc )
return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 );
}
-void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
- DbgUsr fDbgUsr )
-{
- DebugData* pData = ImplGetDebugData();
-
- // quick test
- if ( !(pData->aDbgData.nTestFlags & DBG_TEST_XTOR) )
- return;
-
- XtorType* pXtorData = (XtorType*)pDbgData->pData;
- if ( !pXtorData )
- {
- pDbgData->pData = (void*)new XtorType;
- pXtorData = (XtorType*)pDbgData->pData;
- strncpy( pXtorData->aName, pDbgData->pName, DBG_MAXNAME );
- pXtorData->aName[DBG_MAXNAME] = '\0';
- pXtorData->nCtorCalls = 0;
- pXtorData->nDtorCalls = 0;
- pXtorData->nMaxCount = 0;
- pXtorData->nStatics = 0;
- pXtorData->bTest = true;
- pData->pXtorList->Add( (void*)pXtorData );
-
- if ( !ImplDbgFilter( pData->aDbgData.aInclClassFilter, pXtorData->aName, true ) )
- pXtorData->bTest = false;
- if ( ImplDbgFilter( pData->aDbgData.aExclClassFilter, pXtorData->aName, false ) )
- pXtorData->bTest = false;
- }
- if ( !pXtorData->bTest )
- return;
-
- sal_uInt16 nAct = nAction & ~DBG_XTOR_DTOROBJ;
-
- SAL_INFO_IF(
- ((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE)
- && !(nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ),
- "tools.debug",
- (nAct == DBG_XTOR_CTOR ? "Enter Ctor from class "
- : nAct == DBG_XTOR_DTOR ? "Enter Dtor from class "
- : "Enter method from class ") << pDbgData->pName);
-
- // If some Xtor-tests are still tracing
- if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXTRA )
- {
- // call DBG_CTOR before all other DBG_XTOR calls
- if ( ((nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR) && !pDbgData->pData )
- {
- SAL_WARN(
- "tools.debug",
- "DBG_DTOR() or DBG_CHKTHIS() without DBG_CTOR(): "
- << pDbgData->pName);
- return;
- }
-
- // Test if the pointer is still valid
- if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
- {
- if ( (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) ||
- !(nAction & DBG_XTOR_DTOROBJ) )
- {
- // This-Pointer == NULL
- if ( !pThis )
- {
- SAL_WARN(
- "tools.debug",
- "this == NULL in class " << pDbgData->pName);
- return;
- }
-
- if ( (nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR )
- {
- SAL_WARN_IF(
- !pXtorData->aThisList.IsIn(pThis), "tools.debug",
- "invalid this-Pointer %p in class " << pDbgData->pName);
- }
- }
- }
-
- // execute function test and update maintenance data
- const sal_Char* pMsg = NULL;
- switch ( nAction & ~DBG_XTOR_DTOROBJ )
- {
- case DBG_XTOR_CTOR:
- if ( nAction & DBG_XTOR_DTOROBJ )
- {
- if ( fDbgUsr &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
- pMsg = fDbgUsr( pThis );
- }
- else
- {
- pXtorData->nCtorCalls++;
- if ( !bDbgImplInMain )
- pXtorData->nStatics++;
- if ( (pXtorData->nCtorCalls-pXtorData->nDtorCalls) > pXtorData->nMaxCount )
- pXtorData->nMaxCount = pXtorData->nCtorCalls - pXtorData->nDtorCalls;
-
- if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
- pXtorData->aThisList.Add( pThis );
- }
- break;
-
- case DBG_XTOR_DTOR:
- if ( nAction & DBG_XTOR_DTOROBJ )
- {
- pXtorData->nDtorCalls++;
- if ( pData->aDbgData.nTestFlags & DBG_TEST_XTOR_THIS )
- pXtorData->aThisList.Remove( pThis );
- }
- else
- {
- if ( fDbgUsr &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
- pMsg = fDbgUsr( pThis );
- }
- break;
-
- case DBG_XTOR_CHKTHIS:
- case DBG_XTOR_CHKOBJ:
- if ( nAction & DBG_XTOR_DTOROBJ )
- {
- if ( fDbgUsr &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_EXIT) &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
- pMsg = fDbgUsr( pThis );
- }
- else
- {
- if ( fDbgUsr &&
- (pData->aDbgData.nTestFlags & DBG_TEST_XTOR_FUNC) )
- pMsg = fDbgUsr( pThis );
- }
- break;
- }
-
- SAL_WARN_IF(
- pMsg, "tools.debug",
- "Error-Msg from Object " << pThis << " in class "
- << pDbgData->pName << ": " << pMsg);
- }
-
- SAL_INFO_IF(
- ((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE)
- && (nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ),
- "tools.debug",
- (nAct == DBG_XTOR_CTOR
- ? "Leave Ctor from class "
- : nAct == DBG_XTOR_DTOR
- ? "Leave Dtor from class "
- : "Leave method from class ") << pDbgData->pName);
-}
-
-void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut )
+void DbgOut( const sal_Char* pMsg )
{
static bool bIn = false;
if ( bIn )
@@ -1166,16 +691,8 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut )
sal_uIntPtr nOut;
int nBufLen = 0;
- if ( nDbgOut == DBG_OUT_ERROR )
- {
- nOut = pData->aDbgData.nErrorOut;
- pStr = "Error: ";
- }
- else
- {
- nOut = pData->aDbgData.nTraceOut;
- pStr = NULL;
- }
+ nOut = pData->aDbgData.nErrorOut;
+ pStr = "Error: ";
if ( nOut == DBG_OUT_NULL )
{
@@ -1275,7 +792,7 @@ void DbgPrintShell(char const * message) {
#endif
}
-void DbgOutTypef( sal_uInt16 nDbgOut, const sal_Char* pFStr, ... )
+void DbgOutTypef( const sal_Char* pFStr, ... )
{
va_list pList;
@@ -1284,28 +801,14 @@ void DbgOutTypef( sal_uInt16 nDbgOut, const sal_Char* pFStr, ... )
vsprintf( aBuf, pFStr, pList );
va_end( pList );
- DbgOut( aBuf, nDbgOut );
-}
-
-void DbgOutf( const sal_Char* pFStr, ... )
-{
- va_list pList;
-
- va_start( pList, pFStr );
- sal_Char aBuf[DBG_BUF_MAXLEN];
- vsprintf( aBuf, pFStr, pList );
- va_end( pList );
-
- DbgOut( aBuf, DBG_OUT_TRACE );
+ DbgOut( aBuf );
}
#else
void* DbgFunc( sal_uInt16, void* ) { return NULL; }
-void DbgXtor( DbgDataType*, sal_uInt16, const void*, DbgUsr ) {}
-
-void DbgOutTypef( sal_uInt16, const sal_Char*, ... ) {}
+void DbgOutTypef( const sal_Char*, ... ) {}
#endif
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 88489efde49b..50b74c531b02 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -100,13 +100,6 @@ static const sal_Char* pDbgHelpText[] =
"sufficient for other systems or other system settings. With very narrow "
"fonts the dialogs are made wider because they otherwise appear too narrow.\n",
"\n",
-"Trace output\n",
-"DBG_TRACE() can be use to produce TRACE output. DBG_TRACEFILE() also outputs "
-"the file and line number where the macro is located. DBG_TRACE1() to "
-"DBG_TRACE5() can be used to produce formatted output (printf format string) "
-"Trace output is enabled when the corresponding option is selected in the "
-"dropdown list.\n"
-"\n",
"Warnings\n",
"DBG_WARNING() can be used to output warnings. DBG_WARNING1() to "
"DBG_WARNING3() can be used to produce formatted output (printf format string). "
@@ -356,13 +349,6 @@ public:
class DbgDialog : public ModalDialog
{
private:
- CheckBox maXtorThis;
- CheckBox maXtorFunc;
- CheckBox maXtorExit;
- CheckBox maXtorReport;
- CheckBox maXtorTrace;
- GroupBox maBox1;
-
CheckBox maRes;
CheckBox maDialog;
CheckBox maBoldAppFont;
@@ -378,15 +364,12 @@ private:
Edit maInclFilter;
FixedText maExclText;
Edit maExclFilter;
- FixedText maTraceText;
- ListBox maTraceBox;
FixedText maErrorText;
ListBox maErrorBox;
GroupBox maBox4;
OKButton maOKButton;
CancelButton maCancelButton;
- PushButton maInfoButton;
HelpButton maHelpButton;
sal_uInt16 mnErrorOff;
@@ -397,7 +380,6 @@ public:
void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
};
-static sal_Char aDbgInfoBuf[12288];
static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN];
DbgWindow::DbgWindow() :
@@ -540,12 +522,6 @@ void DbgWindow::InsertLine( const OUString& rLine )
DbgDialog::DbgDialog() :
ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ),
- maXtorThis( this ),
- maXtorFunc( this ),
- maXtorExit( this ),
- maXtorReport( this ),
- maXtorTrace( this ),
- maBox1( this ),
maRes( this ),
maDialog( this ),
maBoldAppFont( this ),
@@ -560,14 +536,11 @@ DbgDialog::DbgDialog() :
maInclFilter( this ),
maExclText( this ),
maExclFilter( this ),
- maTraceText( this ),
- maTraceBox( this, WB_DROPDOWN ),
maErrorText( this ),
maErrorBox( this, WB_DROPDOWN ),
maBox4( this ),
maOKButton( this, WB_DEFBUTTON ),
maCancelButton( this ),
- maInfoButton( this ),
maHelpButton( this )
{
DbgData* pData = DbgGetData();
@@ -575,58 +548,6 @@ DbgDialog::DbgDialog() :
Size aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap );
{
- maXtorThis.Show();
- maXtorThis.SetText("T~his");
- if ( pData->nTestFlags & DBG_TEST_XTOR_THIS )
- maXtorThis.Check( true );
- maXtorThis.SetPosSizePixel( LogicToPixel( Point( 10, 15 ), aAppMap ),
- aButtonSize );
- }
-
- {
- maXtorFunc.Show();
- maXtorFunc.SetText("~Function");
- if ( pData->nTestFlags & DBG_TEST_XTOR_FUNC )
- maXtorFunc.Check( true );
- maXtorFunc.SetPosSizePixel( LogicToPixel( Point( 75, 15 ), aAppMap ),
- aButtonSize );
- }
-
- {
- maXtorExit.Show();
- maXtorExit.SetText("E~xit");
- if ( pData->nTestFlags & DBG_TEST_XTOR_EXIT )
- maXtorExit.Check( true );
- maXtorExit.SetPosSizePixel( LogicToPixel( Point( 140, 15 ), aAppMap ),
- aButtonSize );
- }
-
- {
- maXtorReport.Show();
- maXtorReport.SetText("~Report");
- if ( pData->nTestFlags & DBG_TEST_XTOR_REPORT )
- maXtorReport.Check( true );
- maXtorReport.SetPosSizePixel( LogicToPixel( Point( 205, 15 ), aAppMap ),
- aButtonSize );
- }
-
- {
- maXtorTrace.Show();
- maXtorTrace.SetText("~Trace");
- if ( pData->nTestFlags & DBG_TEST_XTOR_TRACE )
- maXtorTrace.Check( true );
- maXtorTrace.SetPosSizePixel( LogicToPixel( Point( 270, 15 ), aAppMap ),
- aButtonSize );
- }
-
- {
- maBox1.Show();
- maBox1.SetText("Object Tests");
- maBox1.SetPosSizePixel( LogicToPixel( Point( 5, 5 ), aAppMap ),
- LogicToPixel( Size( 330, 30 ), aAppMap ) );
- }
-
- {
maRes.Show();
maRes.SetText("~Resourcen");
if ( pData->nTestFlags & DBG_TEST_RESOURCE )
@@ -739,29 +660,6 @@ DbgDialog::DbgDialog() :
}
{
- maTraceText.Show();
- maTraceText.SetText("~Trace");
- maTraceText.SetPosSizePixel( LogicToPixel( Point( 10, 210 ), aAppMap ),
- LogicToPixel( Size( 95, 9 ), aAppMap ) );
- }
-
- {
- maTraceBox.InsertEntry(OUString("None"));
- maTraceBox.InsertEntry(OUString("File"));
- maTraceBox.InsertEntry(OUString("Window"));
- maTraceBox.InsertEntry(OUString("Shell"));
- maTraceBox.InsertEntry(OUString("MessageBox"));
- maTraceBox.InsertEntry(OUString("TestTool"));
- maTraceBox.InsertEntry(OUString("Debugger"));
- maTraceBox.InsertEntry(OUString("Abort"));
- ImplAppendUserDefinedChannels( maTraceBox );
- ImplSelectChannel( maTraceBox, pData->nTraceOut, 0 );
- maTraceBox.Show();
- maTraceBox.SetPosSizePixel( LogicToPixel( Point( 10, 220 ), aAppMap ),
- LogicToPixel( Size( 95, 80 ), aAppMap ) );
- }
-
- {
maErrorText.Show();
maErrorText.SetText("~Error");
maErrorText.SetPosSizePixel( LogicToPixel( Point( 220, 210 ), aAppMap ),
@@ -809,13 +707,6 @@ DbgDialog::DbgDialog() :
LogicToPixel( Size( 50, 15 ), aAppMap ) );
}
{
- maInfoButton.Show();
- maInfoButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) );
- maInfoButton.SetText("~Info...");
- maInfoButton.SetPosSizePixel( LogicToPixel( Point( 130, 260 ), aAppMap ),
- LogicToPixel( Size( 50, 15 ), aAppMap ) );
- }
- {
maHelpButton.Show();
maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) );
@@ -836,7 +727,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
aData.nTestFlags = 0;
- aData.nTraceOut = ImplGetChannelId( maTraceBox, 0 );
aData.nErrorOut = ImplGetChannelId( maErrorBox, mnErrorOff );
strncpy( aData.aDebugName, OUStringToOString(maDebugName.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aDebugName ) );
@@ -852,21 +742,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
aData.bOverwrite = maOverwrite.IsChecked() ? true : false;
- if ( maXtorThis.IsChecked() )
- aData.nTestFlags |= DBG_TEST_XTOR_THIS;
-
- if ( maXtorFunc.IsChecked() )
- aData.nTestFlags |= DBG_TEST_XTOR_FUNC;
-
- if ( maXtorExit.IsChecked() )
- aData.nTestFlags |= DBG_TEST_XTOR_EXIT;
-
- if ( maXtorReport.IsChecked() )
- aData.nTestFlags |= DBG_TEST_XTOR_REPORT;
-
- if ( maXtorTrace.IsChecked() )
- aData.nTestFlags |= DBG_TEST_XTOR_TRACE;
-
if ( maRes.IsChecked() )
aData.nTestFlags |= DBG_TEST_RESOURCE;
@@ -880,7 +755,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
DbgSaveData( aData );
// Umschalten der Laufzeitwerte
- DBG_INSTOUTTRACE( aData.nTraceOut );
DBG_INSTOUTERROR( aData.nErrorOut );
DbgData* pData = DbgGetData();
@@ -914,16 +788,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
}
EndDialog( RET_OK );
}
- else if ( pButton == &maInfoButton )
- {
- DbgInfoDialog aInfoDialog( this );
- aDbgInfoBuf[0] = '\0';
- DbgXtorInfo( aDbgInfoBuf );
- OUString aInfoText( aDbgInfoBuf, strlen(aDbgInfoBuf), RTL_TEXTENCODING_UTF8 );
- aInfoDialog.SetText( "Debug InfoReport" );
- aInfoDialog.SetInfoText( aInfoText );
- aInfoDialog.Execute();
- }
return 0;
}
@@ -1095,7 +959,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->IsVisible() )
{
if ( aAccelBuf[cAccel] )
- DbgOutTypef( DBG_OUT_ERROR, "Double mnemonic char: %c", cAccel );
+ DbgOutTypef( "Double mnemonic char: %c", cAccel );
else
aAccelBuf[cAccel] = true;
}
@@ -1121,7 +985,7 @@ void DbgDialogTest( Window* pWindow )
else
pClass = "Dontknow";
if( !cAccel )
- DbgOutTypef( DBG_OUT_ERROR,
+ DbgOutTypef(
"%s should have a mnemonic char (~): %s",
pClass,
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
@@ -1143,7 +1007,7 @@ void DbgDialogTest( Window* pWindow )
default: break;
}
if( pChild->IsVisible() && pChild->GetSizePixel().Width() < aWidth )
- DbgOutTypef( DBG_OUT_ERROR,
+ DbgOutTypef(
"%s exceeds window width: %s",
pClass,
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
@@ -1153,8 +1017,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->GetType() == WINDOW_FIXEDLINE )
{
if ( pChild->GetSizePixel().Width() < pChild->GetTextWidth( aText ) )
- DbgOutTypef( DBG_OUT_ERROR,
- "FixedLine exceeds window width: %s",
+ DbgOutTypef( "FixedLine exceeds window width: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
@@ -1163,8 +1026,7 @@ void DbgDialogTest( Window* pWindow )
if ( (pChild->GetSizePixel().Height() >= pChild->GetTextHeight()*2) &&
!(pChild->GetStyle() & WB_WORDBREAK) )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "FixedText greater than one line, but WordBreak is not set: %s",
+ DbgOutTypef( "FixedText greater than one line, but WordBreak is not set: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
@@ -1181,8 +1043,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->GetSizePixel().Width() < aWidth && !(pChild->GetStyle() & WB_WORDBREAK) )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "FixedText exceeds window width: %s",
+ DbgOutTypef( "FixedText exceeds window width: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
}
@@ -1211,14 +1072,12 @@ void DbgDialogTest( Window* pWindow )
{
if ( !cAccel )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
+ DbgOutTypef( "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
if ( !pTempChild->IsEnabled() && pChild->IsEnabled() )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
+ DbgOutTypef( "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
}
@@ -1305,8 +1164,7 @@ void DbgDialogTest( Window* pWindow )
}
if ( bMaxWarning )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "No Max-Value is set: %s",
+ DbgOutTypef( "No Max-Value is set: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
@@ -1346,8 +1204,7 @@ void DbgDialogTest( Window* pWindow )
{
if ( (aNewPos.X() <= aTabPos.X()) && (aNewPos.Y() <= aTabPos.Y()) )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "Possible wrong childorder for dialogcontrol: %s",
+ DbgOutTypef( "Possible wrong childorder for dialogcontrol: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
aTabPos = aNewPos;
@@ -1358,8 +1215,7 @@ void DbgDialogTest( Window* pWindow )
if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) &&
aChildRect.IsOver( pRectAry[j] ) )
{
- DbgOutTypef( DBG_OUT_ERROR,
- "Window overlaps with sibling window: %s",
+ DbgOutTypef( "Window overlaps with sibling window: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
}
}