Remove now unused DBG_CTOR etc. feature

Change-Id: Id5e3191ea1a505bd7d46af355edb99e184b5fcb1
This commit is contained in:
Stephan Bergmann
2014-03-28 16:32:23 +01:00
parent 6ef2df7b9b
commit f26b981aa2
3 changed files with 20 additions and 768 deletions

View File

@@ -28,8 +28,7 @@
/** The facilities provided by this header are deprecated. True assertions /** The facilities provided by this header are deprecated. True assertions
(that detect broken program logic) should use standard assert (which aborts (that detect broken program logic) should use standard assert (which aborts
if an assertion fails, and is controlled by the standard NDEBUG macro). 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 Logging of warnings (e.g., about malformed input) should use the facilities
steps taken while executing some protocol) should use the facilities
provided by sal/log.hxx. provided by sal/log.hxx.
Because the assertion macro (DBG_ASSERT) has been used for Because the assertion macro (DBG_ASSERT) has been used for
@@ -47,13 +46,6 @@ typedef void (*DbgTestSolarMutexProc)();
#define DBG_BUF_MAXLEN 16384 #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_RESOURCE (0x02000000)
#define DBG_TEST_DIALOG (0x04000000) #define DBG_TEST_DIALOG (0x04000000)
#define DBG_TEST_BOLDAPPFONT (0x08000000) #define DBG_TEST_BOLDAPPFONT (0x08000000)
@@ -76,7 +68,6 @@ struct DbgData
{ {
sal_uIntPtr nTestFlags; sal_uIntPtr nTestFlags;
bool bOverwrite; bool bOverwrite;
sal_uIntPtr nTraceOut;
sal_uIntPtr nErrorOut; sal_uIntPtr nErrorOut;
sal_Char aDebugName[260]; sal_Char aDebugName[260];
sal_Char aInclFilter[512]; sal_Char aInclFilter[512];
@@ -99,7 +90,6 @@ struct DbgDataType
#define DBG_FUNC_SAVEDATA 5 #define DBG_FUNC_SAVEDATA 5
#define DBG_FUNC_SETPRINTMSGBOX 6 #define DBG_FUNC_SETPRINTMSGBOX 6
#define DBG_FUNC_SETPRINTWINDOW 7 #define DBG_FUNC_SETPRINTWINDOW 7
#define DBG_FUNC_XTORINFO 10
#define DBG_FUNC_COREDUMP 12 #define DBG_FUNC_COREDUMP 12
#define DBG_FUNC_ALLERROROUT 13 #define DBG_FUNC_ALLERROROUT 13
#define DBG_FUNC_SETTESTSOLARMUTEX 14 #define DBG_FUNC_SETTESTSOLARMUTEX 14
@@ -146,7 +136,6 @@ typedef sal_uInt16 DbgChannelId;
the function for emitting the diagnostic messages the function for emitting the diagnostic messages
@return @return
a unique number for this channel, which can be used for ->DbgData::nErrorOut a unique number for this channel, which can be used for ->DbgData::nErrorOut
and ->DbgData::nTraceOut
@see DBG_OUT_USER_CHANNEL_0 @see DBG_OUT_USER_CHANNEL_0
(In theory, this function could replace the other hard-coded channels. Well, at least (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; return sal_False;
} }
inline void DbgXtorInfo( sal_Char* pBuf )
{
DbgFunc( DBG_FUNC_XTORINFO, (void*)pBuf );
}
inline void DbgCoreDump() inline void DbgCoreDump()
{ {
DbgFunc( DBG_FUNC_COREDUMP ); DbgFunc( DBG_FUNC_COREDUMP );
@@ -230,85 +214,12 @@ inline void DbgPrintFile( const sal_Char* pLine )
DbgFunc( DBG_FUNC_PRINTFILE, (void*)(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 DbgPrintShell(char const * message);
TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ... ); TOOLS_DLLPUBLIC void DbgOutTypef( 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
#define DBG_DEBUGSTART() DbgDebugStart() #define DBG_DEBUGSTART() DbgDebugStart()
#define DBG_DEBUGEND() DbgDebugEnd() #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 ) \ #define DBG_ASSERTWARNING( sCon, aWarning ) \
SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", aWarning) SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", aWarning)
@@ -327,14 +238,6 @@ do \
DbgTestSolarMutex(); \ DbgTestSolarMutex(); \
} while(false) } while(false)
// en-/disable debug defines
#define DBG_INSTOUTTRACE( nOut ) \
do \
{ \
DbgGetData()->nTraceOut = nOut; \
} while(false)
#define DBG_INSTOUTERROR( nOut ) \ #define DBG_INSTOUTERROR( nOut ) \
do \ do \
{ \ { \
@@ -353,15 +256,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis );
#define DBG_DEBUGSTART() ((void)0) #define DBG_DEBUGSTART() ((void)0)
#define DBG_DEBUGEND() ((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_ASSERTWARNING( sCon, aWarning ) ((void)0)
#define DBG_ASSERT( sCon, aError ) ((void)0) #define DBG_ASSERT( sCon, aError ) ((void)0)
#define DBG_WARNING( aWarning ) ((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_TESTSOLARMUTEX() ((void)0)
#define DBG_INSTOUTTRACE( nOut ) ((void)0)
#define DBG_INSTOUTERROR( nOut ) ((void)0) #define DBG_INSTOUTERROR( nOut ) ((void)0)
#endif #endif

View File

@@ -47,54 +47,6 @@
#ifdef DBG_UTIL #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 struct DebugData
{ {
DbgData aDbgData; DbgData aDbgData;
@@ -104,7 +56,6 @@ struct DebugData
DbgPrintLine pDbgAbort; DbgPrintLine pDbgAbort;
::std::vector< DbgPrintLine > ::std::vector< DbgPrintLine >
aDbgPrintUserChannels; aDbgPrintUserChannels;
PointerList* pXtorList;
DbgTestSolarMutexProc pDbgTestSolarMutex; DbgTestSolarMutexProc pDbgTestSolarMutex;
DebugData() DebugData()
@@ -112,12 +63,10 @@ struct DebugData
,pDbgPrintMsgBox( NULL ) ,pDbgPrintMsgBox( NULL )
,pDbgPrintWindow( NULL ) ,pDbgPrintWindow( NULL )
,pDbgAbort( NULL ) ,pDbgAbort( NULL )
,pXtorList( NULL )
,pDbgTestSolarMutex( NULL ) ,pDbgTestSolarMutex( NULL )
{ {
aDbgData.nTestFlags = DBG_TEST_RESOURCE; aDbgData.nTestFlags = DBG_TEST_RESOURCE;
aDbgData.bOverwrite = true; aDbgData.bOverwrite = true;
aDbgData.nTraceOut = DBG_OUT_NULL;
#ifdef UNX #ifdef UNX
aDbgData.nErrorOut = DBG_OUT_SHELL; aDbgData.nErrorOut = DBG_OUT_SHELL;
#else #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 DebugData aDebugData;
static sal_Char aCurPath[260]; static sal_Char aCurPath[260];
static bool bDbgImplInMain = false; static bool bDbgImplInMain = false;
@@ -224,7 +168,6 @@ namespace
eOutput, eOutput,
eMemory, eMemory,
eGUI, eGUI,
eObjects,
eTest, eTest,
eUnknown eUnknown
@@ -243,7 +186,6 @@ namespace
case eOutput : pSectionName = "output"; break; case eOutput : pSectionName = "output"; break;
case eMemory : pSectionName = "memory"; break; case eMemory : pSectionName = "memory"; break;
case eGUI : pSectionName = "gui"; break; case eGUI : pSectionName = "gui"; break;
case eObjects : pSectionName = "objects"; break;
case eTest : pSectionName = "test"; break; case eTest : pSectionName = "test"; break;
case eUnknown: case eUnknown:
OSL_ASSERT(false); OSL_ASSERT(false);
@@ -260,8 +202,6 @@ namespace
return eMemory; return eMemory;
if ( strncmp( _pSectionName, "gui", _nSectionNameLength < 3 ? _nSectionNameLength : 3 ) == 0 ) if ( strncmp( _pSectionName, "gui", _nSectionNameLength < 3 ? _nSectionNameLength : 3 ) == 0 )
return eGUI; return eGUI;
if ( strncmp( _pSectionName, "objects", _nSectionNameLength < 7 ? _nSectionNameLength : 7 ) == 0 )
return eObjects;
if ( strncmp( _pSectionName, "test", _nSectionNameLength < 4 ? _nSectionNameLength : 4 ) == 0 ) if ( strncmp( _pSectionName, "test", _nSectionNameLength < 4 ? _nSectionNameLength : 4 ) == 0 )
return eTest; return eTest;
return eUnknown; 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 ) static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen )
{ {
#if defined( UNX ) #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, "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, "include_class", aDebugData.aDbgData.aInclClassFilter, sizeof( aDebugData.aDbgData.aInclClassFilter ) );
lcl_tryReadConfigString( pLine, nLineLength, "exclude_class", aDebugData.aDbgData.aExclClassFilter, sizeof( aDebugData.aDbgData.aExclClassFilter ) ); 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 ); 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 ) ); 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 // elements of the [test] section
if ( eCurrentSection == eTest ) if ( eCurrentSection == eTest )
{ {
@@ -624,7 +415,6 @@ static DebugData* GetDebugData()
} }
else else
{ {
lcl_matchOutputChannel( getenv( "DBGSV_TRACE_OUT" ), &aDebugData.aDbgData.nTraceOut );
lcl_matchOutputChannel( getenv( "DBGSV_ERROR_OUT" ), &aDebugData.aDbgData.nErrorOut ); 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) ); 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; return &aDebugData;
@@ -773,113 +559,18 @@ static void DebugInit()
static void DebugDeInit() 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 // Set everything to false, as global variables
// may cause a system crash otherwise. // may cause a system crash otherwise.
// Maintain memory flags, as otherwise new/delete calls // Maintain memory flags, as otherwise new/delete calls
// for global variables will crash, // for global variables will crash,
// as pointer alignment won't work then. // as pointer alignment won't work then.
pData->aDbgData.nTraceOut = nOldOut; DebugData* pData = GetDebugData();
pData->aDbgData.nTestFlags = 0; pData->aDbgData.nTestFlags = 0;
pData->aDbgPrintUserChannels.clear(); pData->aDbgPrintUserChannels.clear();
pData->pDbgPrintWindow = NULL; pData->pDbgPrintWindow = NULL;
ImplDbgDeInitLock(); 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 ) bool ImplDbgFilterMessage( const sal_Char* pMsg )
{ {
DebugData* pData = GetDebugData(); DebugData* pData = GetDebugData();
@@ -937,21 +628,12 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
lcl_writeConfigString( pIniFile, "exclude", pData->aExclFilter ); lcl_writeConfigString( pIniFile, "exclude", pData->aExclFilter );
lcl_writeConfigString( pIniFile, "include_class", pData->aInclClassFilter ); lcl_writeConfigString( pIniFile, "include_class", pData->aInclClassFilter );
lcl_writeConfigString( pIniFile, "exclude_class", pData->aExclClassFilter ); lcl_writeConfigString( pIniFile, "exclude_class", pData->aExclClassFilter );
lcl_writeConfigOutChannel( pIniFile, "trace", pData->nTraceOut );
lcl_writeConfigOutChannel( pIniFile, "error", pData->nErrorOut ); lcl_writeConfigOutChannel( pIniFile, "error", pData->nErrorOut );
lcl_lineFeed( pIniFile ); lcl_lineFeed( pIniFile );
lcl_startSection( pIniFile, eGUI ); lcl_startSection( pIniFile, eGUI );
lcl_writeConfigString( pIniFile, "debug_window_state", pData->aDbgWinState ); 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_lineFeed( pIniFile );
lcl_startSection( pIniFile, eTest ); lcl_startSection( pIniFile, eTest );
lcl_writeConfigFlag( pIniFile, "resources", pData->nTestFlags, DBG_TEST_RESOURCE ); lcl_writeConfigFlag( pIniFile, "resources", pData->nTestFlags, DBG_TEST_RESOURCE );
@@ -962,10 +644,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam )
} }
break; break;
case DBG_FUNC_XTORINFO:
DebugXTorInfo( (sal_Char*)pParam );
break;
case DBG_FUNC_COREDUMP: case DBG_FUNC_COREDUMP:
ImplCoreDump(); ImplCoreDump();
break; break;
@@ -1001,160 +679,7 @@ DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc )
return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 ); return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 );
} }
void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis, void DbgOut( const sal_Char* pMsg )
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 )
{ {
static bool bIn = false; static bool bIn = false;
if ( bIn ) if ( bIn )
@@ -1166,16 +691,8 @@ void DbgOut( const sal_Char* pMsg, sal_uInt16 nDbgOut )
sal_uIntPtr nOut; sal_uIntPtr nOut;
int nBufLen = 0; int nBufLen = 0;
if ( nDbgOut == DBG_OUT_ERROR )
{
nOut = pData->aDbgData.nErrorOut; nOut = pData->aDbgData.nErrorOut;
pStr = "Error: "; pStr = "Error: ";
}
else
{
nOut = pData->aDbgData.nTraceOut;
pStr = NULL;
}
if ( nOut == DBG_OUT_NULL ) if ( nOut == DBG_OUT_NULL )
{ {
@@ -1275,7 +792,7 @@ void DbgPrintShell(char const * message) {
#endif #endif
} }
void DbgOutTypef( sal_uInt16 nDbgOut, const sal_Char* pFStr, ... ) void DbgOutTypef( const sal_Char* pFStr, ... )
{ {
va_list pList; va_list pList;
@@ -1284,28 +801,14 @@ void DbgOutTypef( sal_uInt16 nDbgOut, const sal_Char* pFStr, ... )
vsprintf( aBuf, pFStr, pList ); vsprintf( aBuf, pFStr, pList );
va_end( pList ); va_end( pList );
DbgOut( aBuf, nDbgOut ); DbgOut( aBuf );
}
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 );
} }
#else #else
void* DbgFunc( sal_uInt16, void* ) { return NULL; } void* DbgFunc( sal_uInt16, void* ) { return NULL; }
void DbgXtor( DbgDataType*, sal_uInt16, const void*, DbgUsr ) {} void DbgOutTypef( const sal_Char*, ... ) {}
void DbgOutTypef( sal_uInt16, const sal_Char*, ... ) {}
#endif #endif

View File

@@ -100,13 +100,6 @@ static const sal_Char* pDbgHelpText[] =
"sufficient for other systems or other system settings. With very narrow " "sufficient for other systems or other system settings. With very narrow "
"fonts the dialogs are made wider because they otherwise appear too narrow.\n", "fonts the dialogs are made wider because they otherwise appear too narrow.\n",
"\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", "Warnings\n",
"DBG_WARNING() can be used to output warnings. DBG_WARNING1() to " "DBG_WARNING() can be used to output warnings. DBG_WARNING1() to "
"DBG_WARNING3() can be used to produce formatted output (printf format string). " "DBG_WARNING3() can be used to produce formatted output (printf format string). "
@@ -356,13 +349,6 @@ public:
class DbgDialog : public ModalDialog class DbgDialog : public ModalDialog
{ {
private: private:
CheckBox maXtorThis;
CheckBox maXtorFunc;
CheckBox maXtorExit;
CheckBox maXtorReport;
CheckBox maXtorTrace;
GroupBox maBox1;
CheckBox maRes; CheckBox maRes;
CheckBox maDialog; CheckBox maDialog;
CheckBox maBoldAppFont; CheckBox maBoldAppFont;
@@ -378,15 +364,12 @@ private:
Edit maInclFilter; Edit maInclFilter;
FixedText maExclText; FixedText maExclText;
Edit maExclFilter; Edit maExclFilter;
FixedText maTraceText;
ListBox maTraceBox;
FixedText maErrorText; FixedText maErrorText;
ListBox maErrorBox; ListBox maErrorBox;
GroupBox maBox4; GroupBox maBox4;
OKButton maOKButton; OKButton maOKButton;
CancelButton maCancelButton; CancelButton maCancelButton;
PushButton maInfoButton;
HelpButton maHelpButton; HelpButton maHelpButton;
sal_uInt16 mnErrorOff; sal_uInt16 mnErrorOff;
@@ -397,7 +380,6 @@ public:
void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
}; };
static sal_Char aDbgInfoBuf[12288];
static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN]; static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN];
DbgWindow::DbgWindow() : DbgWindow::DbgWindow() :
@@ -540,12 +522,6 @@ void DbgWindow::InsertLine( const OUString& rLine )
DbgDialog::DbgDialog() : DbgDialog::DbgDialog() :
ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ), ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ),
maXtorThis( this ),
maXtorFunc( this ),
maXtorExit( this ),
maXtorReport( this ),
maXtorTrace( this ),
maBox1( this ),
maRes( this ), maRes( this ),
maDialog( this ), maDialog( this ),
maBoldAppFont( this ), maBoldAppFont( this ),
@@ -560,72 +536,17 @@ DbgDialog::DbgDialog() :
maInclFilter( this ), maInclFilter( this ),
maExclText( this ), maExclText( this ),
maExclFilter( this ), maExclFilter( this ),
maTraceText( this ),
maTraceBox( this, WB_DROPDOWN ),
maErrorText( this ), maErrorText( this ),
maErrorBox( this, WB_DROPDOWN ), maErrorBox( this, WB_DROPDOWN ),
maBox4( this ), maBox4( this ),
maOKButton( this, WB_DEFBUTTON ), maOKButton( this, WB_DEFBUTTON ),
maCancelButton( this ), maCancelButton( this ),
maInfoButton( this ),
maHelpButton( this ) maHelpButton( this )
{ {
DbgData* pData = DbgGetData(); DbgData* pData = DbgGetData();
MapMode aAppMap( MAP_APPFONT ); MapMode aAppMap( MAP_APPFONT );
Size aButtonSize = LogicToPixel( Size( 60, 12 ), aAppMap ); 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.Show();
maRes.SetText("~Resourcen"); maRes.SetText("~Resourcen");
@@ -738,29 +659,6 @@ DbgDialog::DbgDialog() :
LogicToPixel( Size( 95, 14 ), aAppMap ) ); LogicToPixel( Size( 95, 14 ), aAppMap ) );
} }
{
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.Show();
maErrorText.SetText("~Error"); maErrorText.SetText("~Error");
@@ -809,13 +707,6 @@ DbgDialog::DbgDialog() :
LogicToPixel( Size( 50, 15 ), aAppMap ) ); 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.Show();
maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ), maHelpButton.SetPosSizePixel( LogicToPixel( Point( 190, 260 ), aAppMap ),
LogicToPixel( Size( 50, 15 ), aAppMap ) ); LogicToPixel( Size( 50, 15 ), aAppMap ) );
@@ -836,7 +727,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
memcpy( &aData, DbgGetData(), sizeof( DbgData ) ); memcpy( &aData, DbgGetData(), sizeof( DbgData ) );
aData.nTestFlags = 0; aData.nTestFlags = 0;
aData.nTraceOut = ImplGetChannelId( maTraceBox, 0 );
aData.nErrorOut = ImplGetChannelId( maErrorBox, mnErrorOff ); aData.nErrorOut = ImplGetChannelId( maErrorBox, mnErrorOff );
strncpy( aData.aDebugName, OUStringToOString(maDebugName.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aDebugName ) ); 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; 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() ) if ( maRes.IsChecked() )
aData.nTestFlags |= DBG_TEST_RESOURCE; aData.nTestFlags |= DBG_TEST_RESOURCE;
@@ -880,7 +755,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
DbgSaveData( aData ); DbgSaveData( aData );
// Umschalten der Laufzeitwerte // Umschalten der Laufzeitwerte
DBG_INSTOUTTRACE( aData.nTraceOut );
DBG_INSTOUTERROR( aData.nErrorOut ); DBG_INSTOUTERROR( aData.nErrorOut );
DbgData* pData = DbgGetData(); DbgData* pData = DbgGetData();
@@ -914,16 +788,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
} }
EndDialog( RET_OK ); 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; return 0;
} }
@@ -1095,7 +959,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->IsVisible() ) if ( pChild->IsVisible() )
{ {
if ( aAccelBuf[cAccel] ) if ( aAccelBuf[cAccel] )
DbgOutTypef( DBG_OUT_ERROR, "Double mnemonic char: %c", cAccel ); DbgOutTypef( "Double mnemonic char: %c", cAccel );
else else
aAccelBuf[cAccel] = true; aAccelBuf[cAccel] = true;
} }
@@ -1121,7 +985,7 @@ void DbgDialogTest( Window* pWindow )
else else
pClass = "Dontknow"; pClass = "Dontknow";
if( !cAccel ) if( !cAccel )
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef(
"%s should have a mnemonic char (~): %s", "%s should have a mnemonic char (~): %s",
pClass, pClass,
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
@@ -1143,7 +1007,7 @@ void DbgDialogTest( Window* pWindow )
default: break; default: break;
} }
if( pChild->IsVisible() && pChild->GetSizePixel().Width() < aWidth ) if( pChild->IsVisible() && pChild->GetSizePixel().Width() < aWidth )
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef(
"%s exceeds window width: %s", "%s exceeds window width: %s",
pClass, pClass,
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
@@ -1153,8 +1017,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->GetType() == WINDOW_FIXEDLINE ) if ( pChild->GetType() == WINDOW_FIXEDLINE )
{ {
if ( pChild->GetSizePixel().Width() < pChild->GetTextWidth( aText ) ) if ( pChild->GetSizePixel().Width() < pChild->GetTextWidth( aText ) )
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "FixedLine exceeds window width: %s",
"FixedLine exceeds window width: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
@@ -1163,8 +1026,7 @@ void DbgDialogTest( Window* pWindow )
if ( (pChild->GetSizePixel().Height() >= pChild->GetTextHeight()*2) && if ( (pChild->GetSizePixel().Height() >= pChild->GetTextHeight()*2) &&
!(pChild->GetStyle() & WB_WORDBREAK) ) !(pChild->GetStyle() & WB_WORDBREAK) )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "FixedText greater than one line, but WordBreak is not set: %s",
"FixedText greater than one line, but WordBreak is not set: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
@@ -1181,8 +1043,7 @@ void DbgDialogTest( Window* pWindow )
if ( pChild->GetSizePixel().Width() < aWidth && !(pChild->GetStyle() & WB_WORDBREAK) ) if ( pChild->GetSizePixel().Width() < aWidth && !(pChild->GetStyle() & WB_WORDBREAK) )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "FixedText exceeds window width: %s",
"FixedText exceeds window width: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
} }
@@ -1211,14 +1072,12 @@ void DbgDialogTest( Window* pWindow )
{ {
if ( !cAccel ) if ( !cAccel )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
"Labels befor Fields (Edit,ListBox,...) should have a mnemonic char (~): %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
if ( !pTempChild->IsEnabled() && pChild->IsEnabled() ) if ( !pTempChild->IsEnabled() && pChild->IsEnabled() )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
"Labels befor Fields (Edit,ListBox,...) should be disabled, when the field is disabled: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
} }
@@ -1305,8 +1164,7 @@ void DbgDialogTest( Window* pWindow )
} }
if ( bMaxWarning ) if ( bMaxWarning )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "No Max-Value is set: %s",
"No Max-Value is set: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
@@ -1346,8 +1204,7 @@ void DbgDialogTest( Window* pWindow )
{ {
if ( (aNewPos.X() <= aTabPos.X()) && (aNewPos.Y() <= aTabPos.Y()) ) if ( (aNewPos.X() <= aTabPos.X()) && (aNewPos.Y() <= aTabPos.Y()) )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "Possible wrong childorder for dialogcontrol: %s",
"Possible wrong childorder for dialogcontrol: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
aTabPos = aNewPos; aTabPos = aNewPos;
@@ -1358,8 +1215,7 @@ void DbgDialogTest( Window* pWindow )
if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) && if ( ((pRectAry[j].Right() != 0) || (pRectAry[j].Bottom() != 0)) &&
aChildRect.IsOver( pRectAry[j] ) ) aChildRect.IsOver( pRectAry[j] ) )
{ {
DbgOutTypef( DBG_OUT_ERROR, DbgOutTypef( "Window overlaps with sibling window: %s",
"Window overlaps with sibling window: %s",
OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() ); OUStringToOString(aErrorText, RTL_TEXTENCODING_UTF8).getStr() );
} }
} }