2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-04-11 19:09:57 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
2008-04-11 12:17:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-04-11 19:09:57 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#define _TOOLS_DEBUG_HXX
|
|
|
|
|
|
|
|
#include "tools/toolsdllapi.h"
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#include <sal/log.h>
|
2007-04-11 19:09:57 +00:00
|
|
|
#include <sal/types.h>
|
|
|
|
#include <tools/solar.h>
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
/** 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
|
|
|
|
provided by sal/log.h.
|
|
|
|
|
|
|
|
Because the assertion macros (DBG_ASSERTWARNING, DBG_ASSERT, DBG_BF_ASSERT)
|
|
|
|
have been used for true assertions as well as for logged warnings, they map
|
|
|
|
to SAL_WARN instead of standard assert. The warning and error macros
|
|
|
|
(DBG_WARNING, DBG_WARNING1, ..., DBG_WARNING5, DBG_WARNINGFILE,
|
|
|
|
DBG_ERRORFILE) all map to SAL_WARN, too.
|
|
|
|
*/
|
|
|
|
|
2007-04-11 19:09:57 +00:00
|
|
|
// ------------
|
|
|
|
// - DBG_UITL -
|
|
|
|
// ------------
|
|
|
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
|
|
|
|
// --- Dbg-Daten ---
|
|
|
|
|
|
|
|
typedef void (*DbgPrintLine)( const sal_Char* pLine );
|
|
|
|
typedef const sal_Char* (*DbgUsr)(const void* pThis );
|
|
|
|
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_MEM (0x00FFF000)
|
|
|
|
#define DBG_TEST_MEM_INIT (0x00001000)
|
|
|
|
#define DBG_TEST_MEM_OVERWRITE (0x00002000)
|
|
|
|
#define DBG_TEST_MEM_OVERWRITEFREE (0x00004000)
|
|
|
|
#define DBG_TEST_MEM_POINTER (0x00008000)
|
|
|
|
#define DBG_TEST_MEM_REPORT (0x00010000)
|
|
|
|
#define DBG_TEST_MEM_TRACE (0x00020000)
|
|
|
|
#define DBG_TEST_MEM_NEWDEL (0x00040000)
|
|
|
|
#define DBG_TEST_MEM_XTOR (0x00080000)
|
|
|
|
#define DBG_TEST_MEM_SYSALLOC (0x00100000)
|
|
|
|
#define DBG_TEST_MEM_LEAKREPORT (0x00200000)
|
|
|
|
|
|
|
|
#define DBG_TEST_PROFILING (0x01000000)
|
|
|
|
#define DBG_TEST_RESOURCE (0x02000000)
|
|
|
|
#define DBG_TEST_DIALOG (0x04000000)
|
|
|
|
#define DBG_TEST_BOLDAPPFONT (0x08000000)
|
|
|
|
|
|
|
|
#define DBG_OUT_NULL 0
|
|
|
|
#define DBG_OUT_FILE 1
|
|
|
|
#define DBG_OUT_WINDOW 2
|
|
|
|
#define DBG_OUT_SHELL 3
|
|
|
|
#define DBG_OUT_MSGBOX 4
|
|
|
|
#define DBG_OUT_TESTTOOL 5
|
|
|
|
#define DBG_OUT_DEBUGGER 6
|
2011-02-20 23:09:20 +01:00
|
|
|
#define DBG_OUT_ABORT 7
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#define DBG_OUT_COUNT 8
|
|
|
|
|
|
|
|
// user (runtime) defined output channels
|
|
|
|
#define DBG_OUT_USER_CHANNEL_0 100
|
|
|
|
|
|
|
|
#define DBGGUI_RESTORE 0
|
|
|
|
#define DBGGUI_MINIMIZE 1
|
|
|
|
#define DBGGUI_MAXIMIZE 2
|
|
|
|
|
|
|
|
struct DbgData
|
|
|
|
{
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uIntPtr nTestFlags;
|
|
|
|
sal_uIntPtr bOverwrite;
|
|
|
|
sal_uIntPtr nTraceOut;
|
|
|
|
sal_uIntPtr nWarningOut;
|
|
|
|
sal_uIntPtr nErrorOut;
|
|
|
|
sal_uIntPtr bHookOSLAssert;
|
|
|
|
sal_uInt8 bMemInit;
|
|
|
|
sal_uInt8 bMemBound;
|
|
|
|
sal_uInt8 bMemFree;
|
2007-04-11 19:09:57 +00:00
|
|
|
sal_Char aDebugName[260];
|
|
|
|
sal_Char aInclFilter[512];
|
|
|
|
sal_Char aExclFilter[512];
|
|
|
|
sal_Char aInclClassFilter[512];
|
|
|
|
sal_Char aExclClassFilter[512];
|
|
|
|
sal_Char aDbgWinState[50]; // DbgGUIData for VCL
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DbgDataType
|
|
|
|
{
|
|
|
|
void* pData;
|
|
|
|
sal_Char const * pName;
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- Dbg-Prototypen ---
|
|
|
|
|
|
|
|
#define DBG_FUNC_DEBUGSTART 1
|
|
|
|
#define DBG_FUNC_DEBUGEND 2
|
|
|
|
#define DBG_FUNC_GLOBALDEBUGEND 3
|
|
|
|
#define DBG_FUNC_GETDATA 4
|
|
|
|
#define DBG_FUNC_SAVEDATA 5
|
|
|
|
#define DBG_FUNC_SETPRINTMSGBOX 6
|
|
|
|
#define DBG_FUNC_SETPRINTWINDOW 7
|
2010-01-27 16:23:59 +01:00
|
|
|
#define DBG_FUNC_SETPRINTTESTTOOL 8
|
|
|
|
#define DBG_FUNC_MEMTEST 9
|
|
|
|
#define DBG_FUNC_XTORINFO 10
|
|
|
|
#define DBG_FUNC_MEMINFO 11
|
|
|
|
#define DBG_FUNC_COREDUMP 12
|
|
|
|
#define DBG_FUNC_ALLERROROUT 13
|
|
|
|
#define DBG_FUNC_SETTESTSOLARMUTEX 14
|
|
|
|
#define DBG_FUNC_TESTSOLARMUTEX 15
|
|
|
|
#define DBG_FUNC_PRINTFILE 16
|
|
|
|
#define DBG_FUNC_GETPRINTMSGBOX 17
|
|
|
|
#define DBG_FUNC_FILTERMESSAGE 18 // new for #i38967
|
|
|
|
#define DBG_FUNC_UPDATEOSLHOOK 19
|
2011-02-20 23:09:20 +01:00
|
|
|
#define DBG_FUNC_SET_ABORT 20
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL );
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
inline void DbgUpdateOslHook( DbgData* pData )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_UPDATEOSLHOOK, pData );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgDebugStart()
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_DEBUGSTART );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgDebugEnd()
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_DEBUGEND );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgGlobalDebugEnd()
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_GLOBALDEBUGEND );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSetPrintMsgBox( DbgPrintLine pProc )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DbgPrintLine DbgGetPrintMsgBox()
|
|
|
|
{
|
|
|
|
return (DbgPrintLine)(long)DbgFunc( DBG_FUNC_GETPRINTMSGBOX );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSetPrintWindow( DbgPrintLine pProc )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSetPrintTestTool( DbgPrintLine pProc )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SETPRINTTESTTOOL, (void*)(long)pProc );
|
|
|
|
}
|
|
|
|
|
2011-02-20 23:09:20 +01:00
|
|
|
inline void DbgSetAbort( DbgPrintLine pProc )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc );
|
|
|
|
}
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
typedef sal_uInt16 DbgChannelId;
|
2007-04-11 19:09:57 +00:00
|
|
|
/** registers a user-defined channel for emitting the diagnostic messages
|
|
|
|
|
|
|
|
Note that such a user-defined channel cannot be revoked during the lifetime
|
|
|
|
of the process. Thus, it's the caller's responsibility to ensure that the
|
|
|
|
procedure to which ->pProc points remains valid.
|
|
|
|
|
|
|
|
@param pProc
|
|
|
|
the function for emitting the diagnostic messages
|
|
|
|
@return
|
|
|
|
a unique number for this channel, which can be used for ->DbgData::nErrorOut,
|
|
|
|
->DbgData::nWarningOut and ->DbgData::nTraceOut
|
|
|
|
@see DBG_OUT_USER_CHANNEL_0
|
|
|
|
|
|
|
|
(In theory, this function could replace the other hard-coded channels. Well, at least
|
|
|
|
the ones for MsgBox, Window, Shell, TestTool. Perhaps in the next life ...)
|
|
|
|
*/
|
|
|
|
TOOLS_DLLPUBLIC DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc );
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
inline sal_Bool DbgFilterMessage( const char* pMsg )
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
return (sal_Bool)(long) DbgFunc( DBG_FUNC_FILTERMESSAGE, (void*)pMsg );
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int DbgIsAllErrorOut()
|
|
|
|
{
|
|
|
|
return (DbgFunc( DBG_FUNC_ALLERROROUT ) != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline DbgData* DbgGetData()
|
|
|
|
{
|
|
|
|
return (DbgData*)DbgFunc( DBG_FUNC_GETDATA );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSaveData( const DbgData& rData )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData );
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsTraceOut()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return (pData->nTraceOut != DBG_OUT_NULL);
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsWarningOut()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return (pData->nWarningOut != DBG_OUT_NULL);
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsErrorOut()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return (pData->nErrorOut != DBG_OUT_NULL);
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgGetErrorOut() // Testtool: test wether to collect OSL_ASSERTions as well
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nErrorOut;
|
|
|
|
else
|
|
|
|
return DBG_OUT_NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsAssertWarning()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
return DbgIsWarningOut();
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsAssert()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
return DbgIsErrorOut();
|
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsResource()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_RESOURCE;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsDialog()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_DIALOG;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
inline sal_uIntPtr DbgIsBoldAppFont()
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgData* pData = DbgGetData();
|
|
|
|
if ( pData )
|
|
|
|
return pData->nTestFlags & DBG_TEST_BOLDAPPFONT;
|
|
|
|
else
|
2010-11-10 13:50:33 +08:00
|
|
|
return sal_False;
|
2007-04-11 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgXtorInfo( sal_Char* pBuf )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_XTORINFO, (void*)pBuf );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgMemInfo( sal_Char* pBuf )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_MEMINFO, (void*)pBuf );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgCoreDump()
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_COREDUMP );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgSetTestSolarMutex( DbgTestSolarMutexProc pProc )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_SETTESTSOLARMUTEX, (void*)(long)pProc );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgTestSolarMutex()
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_TESTSOLARMUTEX );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void DbgPrintFile( const sal_Char* pLine )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_PRINTFILE, (void*)(sal_Char*)pLine );
|
|
|
|
}
|
|
|
|
|
|
|
|
// --- Dbg-StackTree-Functions ---
|
|
|
|
|
|
|
|
TOOLS_DLLPUBLIC void DbgStartStackTree();
|
|
|
|
TOOLS_DLLPUBLIC void DbgEndStackTree();
|
2010-11-10 13:50:33 +08:00
|
|
|
void* DbgGetStackTree( sal_uIntPtr nAlloc = 0 );
|
|
|
|
void DbgFreeStackTree( void* p, sal_uIntPtr nAlloc = 0 );
|
2007-04-11 19:09:57 +00:00
|
|
|
void DbgPrintStackTree( void* p );
|
|
|
|
|
|
|
|
// --- Dbg-Output ---
|
|
|
|
|
|
|
|
#define DBG_OUT_TRACE 1
|
|
|
|
#define DBG_OUT_WARNING 2
|
|
|
|
#define DBG_OUT_ERROR 3
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
TOOLS_DLLPUBLIC void DbgOut( const sal_Char* pMsg, sal_uInt16 nOutType = DBG_OUT_TRACE,
|
|
|
|
const sal_Char* pFile = NULL, sal_uInt16 nLine = 0 );
|
2010-01-27 16:23:59 +01:00
|
|
|
TOOLS_DLLPUBLIC void DbgPrintShell(char const * message);
|
2010-11-10 13:50:33 +08:00
|
|
|
TOOLS_DLLPUBLIC void DbgOutTypef( sal_uInt16 nOutType, const sal_Char* pFStr, ... );
|
2007-04-11 19:09:57 +00:00
|
|
|
TOOLS_DLLPUBLIC void DbgOutf( const sal_Char* pFStr, ... );
|
|
|
|
TOOLS_DLLPUBLIC void ImpDbgOutfBuf( sal_Char* pBuf, const sal_Char* pFStr, ... );
|
|
|
|
|
|
|
|
// --- Dbg-Test-Functions ---
|
|
|
|
|
|
|
|
inline void DbgMemTest( void* p = NULL )
|
|
|
|
{
|
|
|
|
DbgFunc( DBG_FUNC_MEMTEST, p );
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DBG_PROF_START 1
|
|
|
|
#define DBG_PROF_STOP 2
|
|
|
|
#define DBG_PROF_CONTINUE 3
|
|
|
|
#define DBG_PROF_PAUSE 4
|
|
|
|
|
2010-11-10 13:50:33 +08:00
|
|
|
TOOLS_DLLPUBLIC void DbgProf( sal_uInt16 nAction, DbgDataType* );
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#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,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nAction, const void* pThis, DbgUsr fDbgUsr );
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
class DbgXtorObj
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
DbgDataType* pDbgData;
|
|
|
|
const void* pThis;
|
|
|
|
DbgUsr fDbgUsr;
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nAction;
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
DbgXtorObj( DbgDataType* pData,
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_uInt16 nAct, const void* pThs, DbgUsr fUsr )
|
2007-04-11 19:09:57 +00:00
|
|
|
{
|
|
|
|
DbgXtor( pData, nAct, pThs, fUsr );
|
|
|
|
pDbgData = pData;
|
|
|
|
nAction = nAct;
|
|
|
|
pThis = pThs;
|
|
|
|
fDbgUsr = fUsr;
|
|
|
|
}
|
|
|
|
|
|
|
|
~DbgXtorObj()
|
|
|
|
{
|
|
|
|
DbgXtor( pDbgData, nAction | DBG_XTOR_DTOROBJ,
|
|
|
|
pThis, fDbgUsr );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- Dbg-Defines (intern) ---
|
|
|
|
|
|
|
|
#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, )
|
|
|
|
|
|
|
|
// --- Dbg-Defines (extern) ---
|
|
|
|
|
|
|
|
#define DBG_DEBUGSTART() DbgDebugStart()
|
|
|
|
#define DBG_DEBUGEND() DbgDebugEnd()
|
|
|
|
#define DBG_GLOBALDEBUGEND() DbgGlobalDebugEnd()
|
|
|
|
|
|
|
|
#define DBG_STARTAPPEXECUTE() DbgStartStackTree()
|
|
|
|
#define DBG_ENDAPPEXECUTE() DbgEndStackTree()
|
|
|
|
|
|
|
|
#define DBG_MEMTEST() DbgMemTest()
|
|
|
|
#define DBG_MEMTEST_PTR( p ) DbgMemTest( (void*)p )
|
|
|
|
|
|
|
|
#define DBG_PROFSTART( aName ) \
|
|
|
|
DbgProf( DBG_PROF_START, DBG_FUNC( aName ) )
|
|
|
|
|
|
|
|
#define DBG_PROFSTOP( aName ) \
|
|
|
|
DbgProf( DBG_PROF_STOP, DBG_FUNC( aName ) )
|
|
|
|
|
|
|
|
#define DBG_PROFCONTINUE( aName ) \
|
|
|
|
DbgProf( DBG_PROF_CONTINUE, DBG_FUNC( aName ) )
|
|
|
|
|
|
|
|
#define DBG_PROFPAUSE( aName ) \
|
|
|
|
DbgProf( DBG_PROF_PAUSE, DBG_FUNC( aName ) )
|
|
|
|
|
|
|
|
#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 )
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_ASSERTWARNING( sCon, aWarning ) \
|
|
|
|
SAL_WARN_IF(!(sCon), "legacy.tools", aWarning)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_ASSERT( sCon, aError ) \
|
|
|
|
SAL_WARN_IF(!(sCon), "legacy.tools", aError)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#ifdef DBG_BINFILTER
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_BF_ASSERT( sCon, aError ) \
|
|
|
|
SAL_WARN_IF(!(sCon), "legacy.binfilter", aError)
|
2007-04-11 19:09:57 +00:00
|
|
|
#else
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_BF_ASSERT( sCon, aError ) ((void)0)
|
2007-04-11 19:09:57 +00:00
|
|
|
#endif
|
|
|
|
|
2011-11-22 09:34:46 +01:00
|
|
|
#define DBG_WARNING( aWarning ) SAL_WARN("legacy.tools", aWarning)
|
|
|
|
#define DBG_WARNING1( aWarning, x1 ) SAL_WARN("legacy.tools", aWarning, x1)
|
|
|
|
#define DBG_WARNING2( aWarning, x1, x2 ) \
|
|
|
|
SAL_WARN("legacy.tools", aWarning, x1, x2)
|
|
|
|
#define DBG_WARNING3( aWarning, x1, x2, x3 ) \
|
|
|
|
SAL_WARN("legacy.tools", aWarning, x1, x2, x3)
|
|
|
|
#define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) \
|
|
|
|
SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4)
|
|
|
|
#define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) \
|
|
|
|
SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4, x5)
|
|
|
|
#define DBG_WARNINGFILE( aWarning ) \
|
|
|
|
SAL_WARN("legacy.tools", aWarning, __FILE__, __LINE__)
|
|
|
|
|
|
|
|
#define DBG_ERRORFILE( aError ) \
|
|
|
|
SAL_WARN("legacy.tools", aError, __FILE__, __LINE__)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_TESTSOLARMUTEX() \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
DbgTestSolarMutex(); \
|
|
|
|
} while(0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
// --- Dbg-Defines (An/Ausschlaten) ---
|
|
|
|
|
|
|
|
#define DBG_INSTOUTTRACE( nOut ) \
|
2008-11-10 15:06:12 +00:00
|
|
|
do \
|
2007-04-11 19:09:57 +00:00
|
|
|
{ \
|
|
|
|
DbgGetData()->nTraceOut = nOut; \
|
2008-11-10 15:06:12 +00:00
|
|
|
} while(0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#define DBG_INSTOUTWARNING( nOut ) \
|
2008-11-10 15:06:12 +00:00
|
|
|
do \
|
2007-04-11 19:09:57 +00:00
|
|
|
{ \
|
|
|
|
DbgGetData()->nWarningOut = nOut; \
|
2008-11-10 15:06:12 +00:00
|
|
|
} while(0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#define DBG_INSTOUTERROR( nOut ) \
|
2008-11-10 15:06:12 +00:00
|
|
|
do \
|
2007-04-11 19:09:57 +00:00
|
|
|
{ \
|
|
|
|
DbgGetData()->nErrorOut = nOut; \
|
2008-11-10 15:06:12 +00:00
|
|
|
} while(0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// ---------------
|
|
|
|
// - NO DBG_UITL -
|
|
|
|
// ---------------
|
|
|
|
|
|
|
|
struct DbgData;
|
|
|
|
struct DbgGUIData;
|
|
|
|
struct DbgDataType;
|
|
|
|
|
|
|
|
typedef void (*DbgPrintLine)( const sal_Char* pLine );
|
|
|
|
typedef const sal_Char* (*DbgUsr)(const void* pThis );
|
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_DEBUGSTART() ((void)0)
|
|
|
|
#define DBG_DEBUGEND() ((void)0)
|
|
|
|
#define DBG_GLOBALDEBUGEND() ((void)0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_STARTAPPEXECUTE() ((void)0)
|
|
|
|
#define DBG_ENDAPPEXECUTE() ((void)0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_MEMTEST() ((void)0)
|
|
|
|
#define DBG_MEMTEST_PTR( p ) ((void)0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#define DBG_NAME( aName )
|
|
|
|
#define DBG_NAMEEX( aName )
|
|
|
|
#define DBG_NAMEEX_VISIBILITY( aName, vis )
|
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
#define DBG_PROFSTART( aName ) ((void)0)
|
|
|
|
#define DBG_PROFSTOP( aName ) ((void)0)
|
|
|
|
#define DBG_PROFCONTINUE( aName ) ((void)0)
|
|
|
|
#define DBG_PROFPAUSE( aName ) ((void)0)
|
|
|
|
|
|
|
|
#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_BF_ASSERT( sCon, aError ) ((void)0)
|
|
|
|
#define DBG_WARNING( aWarning ) ((void)0)
|
|
|
|
#define DBG_WARNING1( aWarning, x1 ) ((void)0)
|
|
|
|
#define DBG_WARNING2( aWarning, x1, x2 ) ((void)0)
|
|
|
|
#define DBG_WARNING3( aWarning, x1, x2, x3 ) ((void)0)
|
|
|
|
#define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) ((void)0)
|
|
|
|
#define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) ((void)0)
|
|
|
|
#define DBG_WARNINGFILE( aWarning ) ((void)0)
|
|
|
|
#define DBG_ERRORFILE( aError ) ((void)0)
|
|
|
|
|
|
|
|
#define DBG_TESTSOLARMUTEX() ((void)0)
|
|
|
|
|
|
|
|
#define DBG_INSTOUTTRACE( nOut ) ((void)0)
|
|
|
|
#define DBG_INSTOUTWARNING( nOut ) ((void)0)
|
|
|
|
#define DBG_INSTOUTERROR( nOut ) ((void)0)
|
2007-04-11 19:09:57 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _TOOLS_DEBUG_HXX
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|