diff options
-rw-r--r-- | include/tools/debug.hxx | 145 | ||||
-rw-r--r-- | include/tools/tools.h | 31 | ||||
-rw-r--r-- | solenv/gbuild/CppunitTest.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/JunitTest.mk | 5 | ||||
-rw-r--r-- | tools/Library_tl.mk | 1 | ||||
-rw-r--r-- | tools/source/debug/debug.cxx | 502 | ||||
-rw-r--r-- | tools/source/generic/bigint.cxx | 1 | ||||
-rw-r--r-- | tools/source/generic/toolsin.cxx | 34 | ||||
-rw-r--r-- | vcl/inc/dbggui.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/pch/precompiled_vcl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 1 | ||||
-rw-r--r-- | vcl/source/app/dbggui.cxx | 484 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 1 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 12 | ||||
-rw-r--r-- | vcl/source/app/svmainhook.cxx | 2 |
15 files changed, 18 insertions, 1218 deletions
diff --git a/include/tools/debug.hxx b/include/tools/debug.hxx index 2583d7f3544b..62c40e0ca769 100644 --- a/include/tools/debug.hxx +++ b/include/tools/debug.hxx @@ -40,114 +40,26 @@ #ifdef DBG_UTIL -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_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 -#define DBG_OUT_ABORT 7 - -#define DBG_OUT_COUNT 8 - -// user (runtime) defined output channels -#define DBG_OUT_USER_CHANNEL_0 100 - struct DbgData { sal_uIntPtr nTestFlags; - bool bOverwrite; - sal_uIntPtr nErrorOut; - 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 prototypes -#define DBG_FUNC_DEBUGSTART 1 -#define DBG_FUNC_DEBUGEND 2 -#define DBG_FUNC_GETDATA 4 -#define DBG_FUNC_SAVEDATA 5 -#define DBG_FUNC_SETPRINTMSGBOX 6 -#define DBG_FUNC_SETPRINTWINDOW 7 -#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_SET_ABORT 20 +#define DBG_FUNC_GETDATA 0 +#define DBG_FUNC_SAVEDATA 1 +#define DBG_FUNC_SETTESTSOLARMUTEX 2 +#define DBG_FUNC_TESTSOLARMUTEX 3 TOOLS_DLLPUBLIC void* DbgFunc( sal_uInt16 nAction, void* pData = NULL ); -inline void DbgDebugStart() -{ - DbgFunc( DBG_FUNC_DEBUGSTART ); -} - -inline void DbgDebugEnd() -{ - DbgFunc( DBG_FUNC_DEBUGEND ); -} - -inline void DbgSetPrintMsgBox( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTMSGBOX, (void*)(long)pProc ); -} - -inline void DbgSetPrintWindow( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SETPRINTWINDOW, (void*)(long)pProc ); -} - -inline void DbgSetAbort( DbgPrintLine pProc ) -{ - DbgFunc( DBG_FUNC_SET_ABORT, (void*)(long)pProc ); -} - -typedef sal_uInt16 DbgChannelId; - -/** registers a user-defined channel for emitting the diagnostic messages - - 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 - @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 ); - -inline bool DbgIsAllErrorOut() -{ - return (DbgFunc( DBG_FUNC_ALLERROROUT ) != 0); -} - inline DbgData* DbgGetData() { return (DbgData*)DbgFunc( DBG_FUNC_GETDATA ); @@ -158,15 +70,6 @@ inline void DbgSaveData( const DbgData& rData ) DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData ); } -inline sal_uIntPtr DbgGetErrorOut() // Testtool: test whether to collect OSL_ASSERTions as well -{ - DbgData* pData = DbgGetData(); - if ( pData ) - return pData->nErrorOut; - else - return DBG_OUT_NULL; -} - inline sal_uIntPtr DbgIsResource() { DbgData* pData = DbgGetData(); @@ -194,32 +97,11 @@ inline sal_uIntPtr DbgIsBoldAppFont() return sal_False; } -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 ); -} - -TOOLS_DLLPUBLIC void DbgPrintShell(char const * message); -TOOLS_DLLPUBLIC void DbgOutTypef( const sal_Char* pFStr, ... ); - -#define DBG_DEBUGSTART() DbgDebugStart() -#define DBG_DEBUGEND() DbgDebugEnd() - #define DBG_ASSERTWARNING( sCon, aWarning ) \ SAL_DETAIL_INFO_IF_FORMAT(!(sCon), "legacy.tools", aWarning) @@ -235,27 +117,12 @@ TOOLS_DLLPUBLIC void DbgOutTypef( const sal_Char* pFStr, ... ); #define DBG_TESTSOLARMUTEX() \ do \ { \ - DbgTestSolarMutex(); \ -} while(false) - -#define DBG_INSTOUTERROR( nOut ) \ -do \ -{ \ - DbgGetData()->nErrorOut = nOut; \ + DbgFunc(DBG_FUNC_TESTSOLARMUTEX); \ } while(false) #else // NO DBG_UITL -struct DbgData; -struct DbgDataType; - -typedef void (*DbgPrintLine)( const sal_Char* pLine ); -typedef const sal_Char* (*DbgUsr)(const void* pThis ); - -#define DBG_DEBUGSTART() ((void)0) -#define DBG_DEBUGEND() ((void)0) - #define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0) #define DBG_ASSERT( sCon, aError ) ((void)0) #define DBG_WARNING( aWarning ) ((void)0) @@ -263,8 +130,6 @@ typedef const sal_Char* (*DbgUsr)(const void* pThis ); #define DBG_TESTSOLARMUTEX() ((void)0) -#define DBG_INSTOUTERROR( nOut ) ((void)0) - #endif #endif diff --git a/include/tools/tools.h b/include/tools/tools.h deleted file mode 100644 index bf0eb32a0167..000000000000 --- a/include/tools/tools.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_TOOLS_TOOLS_H -#define INCLUDED_TOOLS_TOOLS_H - -#include <tools/toolsdllapi.h> -#include <tools/solar.h> - -// Methoden, die von VCL gerufen werden muessen -TOOLS_DLLPUBLIC void InitTools(); -TOOLS_DLLPUBLIC void DeInitTools(); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index a227540bcfc8..9b012bcf753f 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -37,7 +37,6 @@ endif # defined by platform # gb_CppunitTest_TARGETTYPE # gb_CppunitTest_get_filename -# DBGSV_ERROR_OUT => in non-product builds, ensure that tools-based assertions do not pop up as message box, but are routed to the shell gb_CppunitTest_CPPTESTDEPS := $(call gb_Executable_get_runtime_dependencies,cppunittester) gb_CppunitTest_CPPTESTCOMMAND := $(call gb_Executable_get_target_for_build,cppunittester) @@ -78,8 +77,6 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_CPPTESTDEPS) ($(gb_CppunitTest_CPPTESTPRECOMMAND) \ $(if $(G_SLICE),G_SLICE=$(G_SLICE)) \ $(if $(GLIBCXX_FORCE_NEW),GLIBCXX_FORCE_NEW=$(GLIBCXX_FORCE_NEW)) \ - $(if $(DBGSV_ERROR_OUT),DBGSV_ERROR_OUT=$(DBGSV_ERROR_OUT)) \ - DISABLE_SAL_DBGBOX=t \ $(if $(SAL_DIAGNOSE_ABORT),SAL_DIAGNOSE_ABORT=$(SAL_DIAGNOSE_ABORT)) \ $(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \ $(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$*)) \ @@ -121,7 +118,6 @@ $(call gb_CppunitTest_get_target,$(1)) : CONFIGURATION_LAYERS := $(call gb_CppunitTest_get_target,$(1)) : URE := $(false) $(call gb_CppunitTest_get_target,$(1)) : UNO_SERVICES := $(call gb_CppunitTest_get_target,$(1)) : UNO_TYPES := -$(call gb_CppunitTest_get_target,$(1)) : DBGSV_ERROR_OUT := shell $(call gb_CppunitTest_get_target,$(1)) : SAL_DIAGNOSE_ABORT := $(call gb_CppunitTest_get_target,$(1)) : HEADLESS := --headless $$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1)))) @@ -130,7 +126,6 @@ $(call gb_Helper_make_userfriendly_targets,$(1),CppunitTest) endef define gb_CppunitTest_abort_on_assertion -$(call gb_CppunitTest_get_target,$(1)) : DBGSV_ERROR_OUT := abort $(call gb_CppunitTest_get_target,$(1)) : SAL_DIAGNOSE_ABORT := TRUE endef diff --git a/solenv/gbuild/JunitTest.mk b/solenv/gbuild/JunitTest.mk index aee3edfdbd4d..9801ed2c8ab1 100644 --- a/solenv/gbuild/JunitTest.mk +++ b/solenv/gbuild/JunitTest.mk @@ -30,16 +30,13 @@ $(call gb_JunitTest_get_clean_target,%) : $(call gb_JavaClassSet_get_clean_targe ifneq (,$(strip $(OOO_JUNIT_JAR))) -# DBGSV_ERROR_OUT => in non-product builds, ensure that tools-based assertions do not pop up as message box, but are routed to the shell -# DISABLE_SAL_DBGBOX is the same, for osl/diagnose.h on Windows only .PHONY : $(call gb_JunitTest_get_target,%) $(call gb_JunitTest_get_target,%) : $(call gb_Output_announce,$*,$(true),JUT,2) $(call gb_Helper_abbreviate_dirs,\ rm -rf $(call gb_JunitTest_get_userdir,$*) && \ mkdir -p $(call gb_JunitTest_get_userdir,$*) && \ - (DBGSV_ERROR_OUT=shell DISABLE_SAL_DBGBOX=t \ - $(gb_JunitTest_JAVACOMMAND) \ + ($(gb_JunitTest_JAVACOMMAND) \ -classpath "$(T_CP)" \ $(DEFS) \ org.junit.runner.JUnitCore \ diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index 93f32c7cc303..098f38e9ce72 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -61,7 +61,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/generic/poly \ tools/source/generic/poly2 \ tools/source/generic/svborder \ - tools/source/generic/toolsin \ tools/source/inet/inetmime \ tools/source/inet/inetmsg \ tools/source/inet/inetstrm \ diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index 6ef827fb206b..9a77d27b2709 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -51,110 +51,21 @@ struct DebugData { DbgData aDbgData; bool bInit; - DbgPrintLine pDbgPrintMsgBox; - DbgPrintLine pDbgPrintWindow; - DbgPrintLine pDbgAbort; - ::std::vector< DbgPrintLine > - aDbgPrintUserChannels; DbgTestSolarMutexProc pDbgTestSolarMutex; DebugData() :bInit( false ) - ,pDbgPrintMsgBox( NULL ) - ,pDbgPrintWindow( NULL ) - ,pDbgAbort( NULL ) ,pDbgTestSolarMutex( NULL ) { aDbgData.nTestFlags = DBG_TEST_RESOURCE; - aDbgData.bOverwrite = true; -#ifdef UNX - aDbgData.nErrorOut = DBG_OUT_SHELL; -#else - aDbgData.nErrorOut = DBG_OUT_MSGBOX; -#endif - aDbgData.aDebugName[0] = 0; - aDbgData.aInclFilter[0] = 0; - aDbgData.aExclFilter[0] = 0; - aDbgData.aInclClassFilter[0] = 0; - aDbgData.aExclClassFilter[0] = 0; aDbgData.aDbgWinState[0] = 0; } }; static DebugData aDebugData; -static sal_Char aCurPath[260]; -static bool bDbgImplInMain = false; - -#if defined( WNT ) -static CRITICAL_SECTION aImplCritDbgSection; -#endif - -static bool bImplCritDbgSectionInit = false; - -void ImplDbgInitLock() -{ -#if defined( WNT ) - InitializeCriticalSection( &aImplCritDbgSection ); -#endif - bImplCritDbgSectionInit = true; -} - -void ImplDbgDeInitLock() -{ -#if defined( WNT ) - DeleteCriticalSection( &aImplCritDbgSection ); -#endif - bImplCritDbgSectionInit = false; -} - -void ImplDbgLock() -{ - if ( !bImplCritDbgSectionInit ) - return; - -#if defined( WNT ) - EnterCriticalSection( &aImplCritDbgSection ); -#endif -} - -void ImplDbgUnlock() -{ - if ( !bImplCritDbgSectionInit ) - return; - -#if defined( WNT ) - LeaveCriticalSection( &aImplCritDbgSection ); -#endif -} #define FILE_LINEEND "\n" -static bool ImplActivateDebugger( const sal_Char* pMsg ) -{ -#if defined( WNT ) - static sal_Char aImplDbgOutBuf[DBG_BUF_MAXLEN]; - strcpy( aImplDbgOutBuf, pMsg ); - strcat( aImplDbgOutBuf, "\r\n" ); - OutputDebugString( aImplDbgOutBuf ); - DebugBreak(); - return true; -#else - (void) pMsg; // avoid warning about unused parameter - return false; -#endif -} - -static bool ImplCoreDump() -{ -#if defined( WNT ) - DebugBreak(); -#else - long* pTemp = 0; - *pTemp = 0xCCCC; -#endif - return true; -} - typedef FILE* FILETYPE; #define FileOpen fopen #define FileRead fread @@ -165,8 +76,6 @@ namespace { enum ConfigSection { - eOutput, - eMemory, eGUI, eTest, @@ -183,8 +92,6 @@ namespace const sal_Char* pSectionName = NULL; switch ( _eSection ) { - case eOutput : pSectionName = "output"; break; - case eMemory : pSectionName = "memory"; break; case eGUI : pSectionName = "gui"; break; case eTest : pSectionName = "test"; break; case eUnknown: @@ -196,10 +103,6 @@ namespace ConfigSection lcl_getSectionFromName( const sal_Char* _pSectionName, size_t _nSectionNameLength ) { - if ( strncmp( _pSectionName, "output", _nSectionNameLength < 6 ? _nSectionNameLength : 6 ) == 0 ) - return eOutput; - if ( strncmp( _pSectionName, "memory", _nSectionNameLength < 6 ? _nSectionNameLength : 6 ) == 0 ) - return eMemory; if ( strncmp( _pSectionName, "gui", _nSectionNameLength < 3 ? _nSectionNameLength : 3 ) == 0 ) return eGUI; if ( strncmp( _pSectionName, "test", _nSectionNameLength < 4 ? _nSectionNameLength : 4 ) == 0 ) @@ -227,15 +130,6 @@ namespace lcl_writeConfigBoolean( _pFile, _pKeyName, ( _nAllFlags & _nCheckFlag ) != 0 ); } - void lcl_writeConfigOutChannel( FILETYPE _pFile, const sal_Char* _pKeyName, sal_uIntPtr _nValue ) - { - const sal_Char* names[ DBG_OUT_COUNT ] = - { - "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort" - }; - lcl_writeConfigString( _pFile, _pKeyName, names[ _nValue ] ); - } - bool lcl_isConfigSection( const sal_Char* _pLine, size_t _nLineLen ) { if ( _nLineLen < 2 ) @@ -269,40 +163,6 @@ namespace return strlen( _pValue ); } - void lcl_tryReadConfigBoolean( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, bool* _out_pnValue ) - { - sal_Char aBuf[2]; - size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) ); - if ( nValueLen ) - *_out_pnValue = strcmp( aBuf, "1" ) == 0 ? true : false; - } - - void lcl_matchOutputChannel( sal_Char const * i_buffer, sal_uIntPtr* o_value ) - { - if ( i_buffer == NULL ) - return; - const sal_Char* names[ DBG_OUT_COUNT ] = - { - "dev/null", "file", "window", "shell", "messagebox", "testtool", "debugger", "abort" - }; - for ( size_t name = 0; name < SAL_N_ELEMENTS( names ); ++name ) - { - if ( strcmp( i_buffer, names[ name ] ) == 0 ) - { - *o_value = name; - return; - } - } - } - - void lcl_tryReadOutputChannel( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnValue ) - { - sal_Char aBuf[20]; - size_t nValueLen = lcl_tryReadConfigString( _pLine, _nLineLen, _pKeyName, aBuf, sizeof( aBuf ) ); - if ( nValueLen ) - lcl_matchOutputChannel( aBuf, _out_pnValue ); - } - void lcl_tryReadConfigFlag( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnAllFlags, sal_uIntPtr _nCheckFlag ) { sal_Char aBuf[2]; @@ -336,33 +196,12 @@ static void DbgGetDbgFileName( sal_Char* pStr, sal_Int32 nMaxLen ) pStr[ nMaxLen - 1 ] = 0; } -static void DbgGetLogFileName( sal_Char* pStr ) -{ -#if defined( UNX ) - const sal_Char* pName = getenv("DBGSV_LOG"); - if ( !pName ) - pName = "dbgsv.log"; - strcpy( pStr, pName ); -#elif defined( WNT ) - const sal_Char* pName = getenv("DBGSV_LOG"); - if ( pName ) - strcpy( pStr, pName ); - else - GetProfileStringA( "sv", "dbgsvlog", "dbgsv.log", pStr, 200 ); -#else - strcpy( pStr, "dbgsv.log" ); -#endif -} - static DebugData* GetDebugData() { if ( !aDebugData.bInit ) { aDebugData.bInit = true; - // set default debug names - DbgGetLogFileName( aDebugData.aDbgData.aDebugName ); - // DEBUG.INI-File sal_Char aBuf[ 4096 ]; DbgGetDbgFileName( aBuf, sizeof( aBuf ) ); @@ -382,18 +221,6 @@ static DebugData* GetDebugData() if ( lcl_isConfigSection( pLine, nLineLength ) ) eCurrentSection = lcl_getSectionFromName( pLine + 1, nLineLength - 2 ); - // elements of the [output] section - if ( eCurrentSection == eOutput ) - { - lcl_tryReadConfigString( pLine, nLineLength, "log_file", aDebugData.aDbgData.aDebugName, sizeof( aDebugData.aDbgData.aDebugName ) ); - lcl_tryReadConfigBoolean( pLine, nLineLength, "overwrite", &aDebugData.aDbgData.bOverwrite ); - lcl_tryReadConfigString( pLine, nLineLength, "include", aDebugData.aDbgData.aInclFilter, sizeof( aDebugData.aDbgData.aInclFilter ) ); - 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, "error", &aDebugData.aDbgData.nErrorOut ); - } - // elements of the [gui] section if ( eCurrentSection == eGUI ) { @@ -413,17 +240,6 @@ static DebugData* GetDebugData() FileClose( pIniFile ); } - else - { - lcl_matchOutputChannel( getenv( "DBGSV_ERROR_OUT" ), &aDebugData.aDbgData.nErrorOut ); - - } - - sal_Char* getcwdResult = getcwd( aCurPath, sizeof( aCurPath ) ); - if ( !getcwdResult ) - { - OSL_TRACE( "getcwd failed with error %s", strerror(errno) ); - } } return &aDebugData; @@ -437,150 +253,6 @@ inline DebugData* ImplGetDebugData() return &aDebugData; } -static FILETYPE ImplDbgInitFile() -{ - static bool bFileInit = false; - - sal_Char aBuf[4096]; - sal_Char* getcwdResult = getcwd( aBuf, sizeof( aBuf ) ); - if ( !getcwdResult ) { - OSL_TRACE( "getcwd failed with error = %s", strerror(errno) ); - return NULL; - } - - int chdirResult = chdir( aCurPath ); - if ( !chdirResult ) { - OSL_TRACE ( "chdir failed with error = %s", strerror(errno) ); - return NULL; - } - - DebugData* pData = GetDebugData(); - FILETYPE pDebugFile; - - if ( !bFileInit ) - { - bFileInit = true; - - if ( pData->aDbgData.bOverwrite ) - pDebugFile = FileOpen( pData->aDbgData.aDebugName, "w" ); - else - pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" ); - - if ( pDebugFile ) - { - time_t nTime = time( 0 ); - tm* pTime; -#ifdef UNX - tm aTime; - pTime = localtime_r( &nTime, &aTime ); -#else - pTime = localtime( &nTime ); -#endif - - // print header - FilePrintF( pDebugFile, "******************************************************************************%s", FILE_LINEEND ); - FilePrintF( pDebugFile, "%s%s", pData->aDbgData.aDebugName, FILE_LINEEND ); - if ( pTime ) - FilePrintF( pDebugFile, "%s%s", asctime( pTime ), FILE_LINEEND ); - } - } - else - pDebugFile = FileOpen( pData->aDbgData.aDebugName, "a" ); - - chdirResult = chdir( aBuf ); - if ( !chdirResult ) - { - OSL_TRACE( "chdir failed with error = %s", strerror(errno) ); - } - - return pDebugFile; -} - -static void ImplDbgPrintFile( const sal_Char* pLine ) -{ - FILETYPE pDebugFile = ImplDbgInitFile(); - - if ( pDebugFile ) - { - FilePrintF( pDebugFile, "%s%s", pLine, FILE_LINEEND ); - FileClose( pDebugFile ); - } -} - -static int ImplStrSearch( const sal_Char* pSearchStr, int nSearchLen, - const sal_Char* pStr, int nLen ) -{ - int nPos = 0; - while ( nPos+nSearchLen <= nLen ) - { - if ( strncmp( pStr+nPos, pSearchStr, nSearchLen ) == 0 ) - return 1; - nPos++; - } - - return 0; -} - -static bool ImplDbgFilter( const sal_Char* pFilter, const sal_Char* pMsg, - bool bEmpty ) -{ - int nStrLen = strlen( pFilter ); - if ( !nStrLen ) - return bEmpty; - - int nMsgLen = strlen( pMsg ); - const sal_Char* pTok = pFilter; - int nTok = 0; - while ( pTok[nTok] ) - { - if ( pTok[nTok] == ';' ) - { - if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) ) - return true; - - pTok += nTok+1; - nTok = 0; - } - - nTok++; - } - - if ( nTok && ImplStrSearch( pTok, nTok, pMsg, nMsgLen ) ) - return true; - else - return false; -} - -static void DebugInit() -{ - bDbgImplInMain = true; - ImplDbgInitLock(); -} - -static void DebugDeInit() -{ - // 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. - DebugData* pData = GetDebugData(); - pData->aDbgData.nTestFlags = 0; - pData->aDbgPrintUserChannels.clear(); - pData->pDbgPrintWindow = NULL; - ImplDbgDeInitLock(); -} - -bool ImplDbgFilterMessage( const sal_Char* pMsg ) -{ - DebugData* pData = GetDebugData(); - if ( !ImplDbgFilter( pData->aDbgData.aInclFilter, pMsg, true ) ) - return true; - if ( ImplDbgFilter( pData->aDbgData.aExclFilter, pMsg, false ) ) - return true; - return false; -} - void* DbgFunc( sal_uInt16 nAction, void* pParam ) { DebugData* pDebugData = ImplGetDebugData(); @@ -591,26 +263,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) { switch ( nAction ) { - case DBG_FUNC_DEBUGSTART: - DebugInit(); - break; - - case DBG_FUNC_DEBUGEND: - DebugDeInit(); - break; - - case DBG_FUNC_SETPRINTMSGBOX: - pDebugData->pDbgPrintMsgBox = (DbgPrintLine)(long)pParam; - break; - - case DBG_FUNC_SETPRINTWINDOW: - pDebugData->pDbgPrintWindow = (DbgPrintLine)(long)pParam; - break; - - case DBG_FUNC_SET_ABORT: - pDebugData->pDbgAbort = (DbgPrintLine)(long)pParam; - break; - case DBG_FUNC_SAVEDATA: { const DbgData* pData = static_cast< const DbgData* >( pParam ); @@ -621,15 +273,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) if ( pIniFile == NULL ) break; - lcl_startSection( pIniFile, eOutput ); - lcl_writeConfigString( pIniFile, "log_file", pData->aDebugName ); - lcl_writeConfigBoolean( pIniFile, "overwrite", pData->bOverwrite ); - lcl_writeConfigString( pIniFile, "include", pData->aInclFilter ); - lcl_writeConfigString( pIniFile, "exclude", pData->aExclFilter ); - lcl_writeConfigString( pIniFile, "include_class", pData->aInclClassFilter ); - lcl_writeConfigString( pIniFile, "exclude_class", pData->aExclClassFilter ); - lcl_writeConfigOutChannel( pIniFile, "error", pData->nErrorOut ); - lcl_lineFeed( pIniFile ); lcl_startSection( pIniFile, eGUI ); lcl_writeConfigString( pIniFile, "debug_window_state", pData->aDbgWinState ); @@ -644,13 +287,6 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) } break; - case DBG_FUNC_COREDUMP: - ImplCoreDump(); - break; - - case DBG_FUNC_ALLERROROUT: - return (void*)(sal_uIntPtr)sal_True; - case DBG_FUNC_SETTESTSOLARMUTEX: pDebugData->pDbgTestSolarMutex = (DbgTestSolarMutexProc)(long)pParam; break; @@ -662,154 +298,16 @@ void* DbgFunc( sal_uInt16 nAction, void* pParam ) if ( pDebugData->pDbgTestSolarMutex ) pDebugData->pDbgTestSolarMutex(); break; - - case DBG_FUNC_PRINTFILE: - ImplDbgPrintFile( (const sal_Char*)pParam ); - break; } return NULL; } } -DbgChannelId DbgRegisterUserChannel( DbgPrintLine pProc ) -{ - DebugData* pData = ImplGetDebugData(); - pData->aDbgPrintUserChannels.push_back( pProc ); - return (DbgChannelId)( pData->aDbgPrintUserChannels.size() - 1 + DBG_OUT_USER_CHANNEL_0 ); -} - -void DbgOut( const sal_Char* pMsg ) -{ - static bool bIn = false; - if ( bIn ) - return; - bIn = true; - - DebugData* pData = GetDebugData(); - sal_Char const * pStr; - sal_uIntPtr nOut; - int nBufLen = 0; - - nOut = pData->aDbgData.nErrorOut; - pStr = "Error: "; - - if ( nOut == DBG_OUT_NULL ) - { - bIn = false; - return; - } - - if ( ImplDbgFilterMessage( pMsg ) ) - { - bIn = false; - return; - } - - ImplDbgLock(); - - sal_Char aBufOut[DBG_BUF_MAXLEN]; - if ( pStr ) - { - strcpy( aBufOut, pStr ); - nBufLen = strlen( pStr ); - } - else - aBufOut[0] = '\0'; - - int nMsgLen = strlen( pMsg ); - if ( nBufLen+nMsgLen > DBG_BUF_MAXLEN ) - { - int nCopyLen = DBG_BUF_MAXLEN-nBufLen-4; - strncpy( &(aBufOut[nBufLen]), pMsg, nCopyLen ); - strcpy( &(aBufOut[nBufLen+nCopyLen]), "..." ); - } - else - strcpy( &(aBufOut[nBufLen]), pMsg ); - - if ( ( nOut >= DBG_OUT_USER_CHANNEL_0 ) && ( nOut - DBG_OUT_USER_CHANNEL_0 < pData->aDbgPrintUserChannels.size() ) ) - { - DbgPrintLine pPrinter = pData->aDbgPrintUserChannels[ nOut - DBG_OUT_USER_CHANNEL_0 ]; - if ( pPrinter ) - pPrinter( aBufOut ); - else - nOut = DBG_OUT_DEBUGGER; - } - - if ( nOut == DBG_OUT_ABORT ) - { - if ( pData->pDbgAbort != NULL ) - pData->pDbgAbort( aBufOut ); - abort(); - } - - if ( nOut == DBG_OUT_DEBUGGER ) - { - if ( !ImplActivateDebugger( aBufOut ) ) - nOut = DBG_OUT_TESTTOOL; - } - - if ( nOut == DBG_OUT_TESTTOOL ) - { - nOut = DBG_OUT_MSGBOX; - } - - if ( nOut == DBG_OUT_MSGBOX ) - { - if ( pData->pDbgPrintMsgBox ) - pData->pDbgPrintMsgBox( aBufOut ); - else - nOut = DBG_OUT_WINDOW; - } - - if ( nOut == DBG_OUT_WINDOW ) - { - if ( pData->pDbgPrintWindow ) - pData->pDbgPrintWindow( aBufOut ); - else - nOut = DBG_OUT_FILE; - } - - switch ( nOut ) - { - case DBG_OUT_SHELL: - DbgPrintShell( aBufOut ); - break; - case DBG_OUT_FILE: - ImplDbgPrintFile( aBufOut ); - break; - } - - ImplDbgUnlock(); - - bIn = false; -} - -void DbgPrintShell(char const * message) { - fprintf(stderr, "%s\n", message); -#if defined WNT - OutputDebugStringA(message); -#endif -} - -void DbgOutTypef( 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 ); -} - #else void* DbgFunc( sal_uInt16, void* ) { return NULL; } -void DbgOutTypef( const sal_Char*, ... ) {} - #endif diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 61e404c4930d..47fb346a7c34 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -20,7 +20,6 @@ #include <math.h> #include <rtl/ustrbuf.hxx> -#include <tools/tools.h> #include <tools/bigint.hxx> diff --git a/tools/source/generic/toolsin.cxx b/tools/source/generic/toolsin.cxx deleted file mode 100644 index e2bdf911b70c..000000000000 --- a/tools/source/generic/toolsin.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <tools/tools.h> - -#include <string.h> -#include <tools/debug.hxx> - -void InitTools() -{ - DBG_DEBUGSTART(); -} - -void DeInitTools() -{ - DBG_DEBUGEND(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/dbggui.hxx b/vcl/inc/dbggui.hxx index d0b0f7ae2d9f..b538d3a1d908 100644 --- a/vcl/inc/dbggui.hxx +++ b/vcl/inc/dbggui.hxx @@ -24,14 +24,12 @@ class Window; -void DbgGUIInit(); -void DbgGUIDeInit(); +void DbgGUIInitSolarMutexCheck(); void DbgGUIDeInitSolarMutexCheck(); void DbgGUIStart(); void DbgDialogTest( Window* pWindow ); -#define DBGGUI_INIT() DbgGUIInit() -#define DBGGUI_DEINIT() DbgGUIDeInit() +#define DBGGUI_INIT_SOLARMUTEXCHECK() DbgGUIInitSolarMutexCheck() #define DBGGUI_DEINIT_SOLARMUTEXCHECK() DbgGUIDeInitSolarMutexCheck() #define DBGGUI_START() DbgGUIStart() @@ -41,9 +39,7 @@ void DbgDialogTest( Window* pWindow ); #else - -#define DBGGUI_INIT() -#define DBGGUI_DEINIT() +#define DBGGUI_INIT_SOLARMUTEXCHECK() #define DBGGUI_DEINIT_SOLARMUTEXCHECK() #define DBGGUI_START() diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index c952a6d04937..dc11721fcab0 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -115,7 +115,6 @@ #include "tools/resmgr.hxx" #include "tools/stream.hxx" #include "tools/time.hxx" -#include "tools/tools.h" #include "tools/urlobj.hxx" #include "tools/vcompat.hxx" #include "uno/current_context.hxx" @@ -371,7 +370,6 @@ #include <tools/stream.hxx> #include <tools/tenccvt.hxx> #include <tools/time.hxx> -#include <tools/tools.h> #include <tools/urlobj.hxx> #include <tools/vcompat.hxx> #include <tools/zcodec.hxx> diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index e4d54bb363c5..2fbaa840e192 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -190,7 +190,6 @@ struct ImplSVWinData Window* mpActiveApplicationFrame; // the last active application frame, can be used as DefModalDialogParent if no focuswin set Window* mpCaptureWin; // window, that has the mouse capture Window* mpLastDeacWin; // Window, that need a deactivate (FloatingWindow-Handling) - DbgWindow* mpDbgWin; // debug window FloatingWindow* mpFirstFloat; // First FloatingWindow in PopupMode Dialog* mpLastExecuteDlg; // First Dialog that is in Execute Window* mpExtTextInputWin; // Window, which is in ExtTextInput diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index ca41286cf4fa..29067fb24a23 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -56,7 +56,6 @@ #include "com/sun/star/i18n/XCharacterClassification.hpp" -#include <map> #include <algorithm> #include <boost/scoped_array.hpp> #include <boost/scoped_ptr.hpp> @@ -100,61 +99,11 @@ 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", -"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). " -"In case you want to have conditional warnings DBG_ASSERTWARNING() can be " -"used. The warning will be produced if the condition was not met. The first " -"parameter is the condition and the second parameter is the message to be " -"produced. Warnings are enabled if the corresponding option is selected in the " -"dropdown box. When none are selected the condition with DBG_ASSERTWARNING() " -"is not evaluated.\n", -"\n", -"Errors\n", -"DBG_ERROR() can be used to produce error messages. DBG_ERRORFILE() also " -"produces the file and the line number where the macro is located. " -"DBG_ERROR1() bis DBG_ERROR5() can be used to produce formatted output " -"(print format string). " -"In case you want to have conditional warnings DBG_ASSERT() can be " -"used. The warning will be produced if the condition was not met. The first " -"parameter is the condition and the second parameter is the message to be " -"produced. Warnings are enabled if the corresponding option is selected in the " -"dropdown box. When none are selected the condition with DBG_ASSERT() " -"is not evaluated.\n", -"\n", "\n", "Output\n", "------------------------------------------\n", "\n", -"Overwrite - CheckBox\n", -"With every new program start the log file is overwritten if output has been " -"generated.\n", -"\n", -"Include ObjectTest filters\n", -"Only classes which contain one of the indicated filters are evaluated with " -"the object test. Filters are separated by ';' and are case sensitive. " -"Wildcards are not supported. If no text is indicated the filters are not " -"active.\n", -"\n", -"Exclude ObjectTest filters\n", -"Only classes which do not contain one of the indicated filters are evaluated " -"with the object test. Filters are separated by ';' and are case sensitive. " -"Wildcards are not supported. If no text is indicated the filters are not " -"active.\n", -"\n", -"Include filters\n", -"Only those texts which include the indicated filters are output. " -"Filters are separated by ';' and are case sensitive. " -"Wildcards are not supported. The filter is used for all output (except for " -"errors). If no text is indicated the filters are not active.\n", -"\n", -"Exclude filters\n", -"Only those texts which do not include the indicated filters are output. " -"Filters are separated by ';' and are case sensitive. " -"Wildcards are not supported. The filter is used for all output (except for " -"errors). If no text is indicated the filters are not active.\n", -"\n", -"Furthermore you can indicate where the data will be output:\n", +"You can indicate where the data will be output:\n", "\n", "None\n", "Output is surpressed.\n", @@ -201,27 +150,22 @@ static const sal_Char* pDbgHelpText[] = "Settings\n", "------------------------------------------\n", "\n", -"Where by default the INI and LOG file is read and written the following " +"Where by default the INI file is read and written the following " "can be set:\n", "\n", -"WIN/WNT (WIN.INI, Group SV, Default: dbgsv.ini and dbgsv.log):\n", +"WIN/WNT (WIN.INI, Group SV, Default: dbgsv.ini):\n", "INI: dbgsv\n", -"LOG: dbgsvlog\n", "\n", -"OS2 (OS2.INI, Application SV, Default: dbgsv.ini and dbgsv.log):\n", +"OS2 (OS2.INI, Application SV, Default: dbgsv.ini):\n", "INI: DBGSV\n", -"LOG: DBGSVLOG\n", "\n", -"UNIX (Environment variable, Default: .dbgsv.init and dbgsv.log):\n", +"UNIX (Environment variable, Default: .dbgsv.init):\n", "INI: DBGSV_INIT\n", -"LOG: DBGSV_LOG\n", "\n", -"MAC (Default: dbgsv.ini and dbgsv.log):\n", +"MAC (Default: dbgsv.ini):\n", "INI: not possible\n", -"LOG: only debug dialog settings\n", "\n", -"The path and file name must always be specified. The name of the log " -"file that was entered in the debug dialog has always priority.\n", +"The path and file name must always be specified.\n", "\n", "\n", "Example\n", @@ -261,56 +205,6 @@ static const sal_Char* pDbgHelpText[] = NULL }; -namespace -{ - typedef ::std::map< OUString, DbgChannelId > UserDefinedChannels; - UserDefinedChannels& ImplDbgGetUserDefinedChannels() - { - static UserDefinedChannels s_aChannels; - return s_aChannels; - } - - void ImplAppendUserDefinedChannels( ListBox& rList ) - { - const UserDefinedChannels& rChannels = ImplDbgGetUserDefinedChannels(); - for ( UserDefinedChannels::const_iterator channel = rChannels.begin(); - channel != rChannels.end(); - ++channel - ) - { - sal_uInt16 nEntryPos = rList.InsertEntry( channel->first ); - rList.SetEntryData( nEntryPos, reinterpret_cast< void* >( channel->second ) ); - } - } - - void ImplSelectChannel( ListBox& rList, sal_uLong nChannelToSelect, sal_uInt16 nPositionOffset ) - { - if ( nChannelToSelect < DBG_OUT_USER_CHANNEL_0 ) - rList.SelectEntryPos( (sal_uInt16)( nChannelToSelect - nPositionOffset ) ); - else - { - for ( sal_uInt16 pos = 0; pos < rList.GetEntryCount(); ++pos ) - { - DbgChannelId nChannelId = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( pos )) ); - if ( nChannelId == nChannelToSelect ) - { - rList.SelectEntryPos( pos ); - return; - } - } - } - } - - DbgChannelId ImplGetChannelId( const ListBox& rList, sal_uInt16 nPositionOffset ) - { - sal_uInt16 nSelectedChannelPos = rList.GetSelectEntryPos(); - DbgChannelId nSelectedChannel = static_cast< DbgChannelId >( reinterpret_cast<sal_IntPtr>(rList.GetEntryData( nSelectedChannelPos )) ); - if ( nSelectedChannel == 0) - return (DbgChannelId)( nSelectedChannelPos + nPositionOffset ); - return nSelectedChannel; - } -} - #define DBGWIN_MAXLINES 100 class DbgWindow : public WorkWindow @@ -354,24 +248,9 @@ private: CheckBox maBoldAppFont; GroupBox maBox3; - Edit maDebugName; - CheckBox maOverwrite; - FixedText maInclClassText; - Edit maInclClassFilter; - FixedText maExclClassText; - Edit maExclClassFilter; - FixedText maInclText; - Edit maInclFilter; - FixedText maExclText; - Edit maExclFilter; - FixedText maErrorText; - ListBox maErrorBox; - GroupBox maBox4; - OKButton maOKButton; CancelButton maCancelButton; HelpButton maHelpButton; - sal_uInt16 mnErrorOff; public: DbgDialog(); @@ -380,8 +259,6 @@ public: void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE; }; -static sal_Char aDbgOutBuf[DBG_BUF_MAXLEN]; - DbgWindow::DbgWindow() : WorkWindow( NULL, WB_STDWORK ), maLstBox( this, WB_AUTOHSCROLL ) @@ -416,7 +293,6 @@ bool DbgWindow::Close() DbgSaveData( *pData ); delete this; - ImplGetSVData()->maWinData.mpDbgWin = NULL; return true; } @@ -526,19 +402,6 @@ DbgDialog::DbgDialog() : maDialog( this ), maBoldAppFont( this ), maBox3( this ), - maDebugName( this ), - maOverwrite( this ), - maInclClassText( this ), - maInclClassFilter( this ), - maExclClassText( this ), - maExclClassFilter( this ), - maInclText( this ), - maInclFilter( this ), - maExclText( this ), - maExclFilter( this ), - maErrorText( this ), - maErrorBox( this, WB_DROPDOWN ), - maBox4( this ), maOKButton( this, WB_DEFBUTTON ), maCancelButton( this ), maHelpButton( this ) @@ -583,119 +446,6 @@ DbgDialog::DbgDialog() : } { - maDebugName.Show(); - maDebugName.SetText(OStringToOUString(pData->aDebugName, RTL_TEXTENCODING_UTF8)); - maDebugName.SetMaxTextLen( sizeof( pData->aDebugName ) ); - maDebugName.SetPosSizePixel( LogicToPixel( Point( 10, 130 ), aAppMap ), - LogicToPixel( Size( 185, 14 ), aAppMap ) ); - } - - { - maOverwrite.Show(); - maOverwrite.SetText("Overwrite ~File"); - if ( pData->bOverwrite ) - maOverwrite.Check( true ); - maOverwrite.SetPosSizePixel( LogicToPixel( Point( 205, 130 ), aAppMap ), - aButtonSize ); - } - - { - maInclClassText.Show(); - maInclClassText.SetText("~Include-ObjectTest-Filter"); - maInclClassText.SetPosSizePixel( LogicToPixel( Point( 10, 150 ), aAppMap ), - LogicToPixel( Size( 95, 9 ), aAppMap ) ); - } - - { - maInclClassFilter.Show(); - maInclClassFilter.SetText(OStringToOUString(pData->aInclClassFilter, RTL_TEXTENCODING_UTF8)); - maInclClassFilter.SetMaxTextLen( sizeof( pData->aInclClassFilter ) ); - maInclClassFilter.SetPosSizePixel( LogicToPixel( Point( 10, 160 ), aAppMap ), - LogicToPixel( Size( 95, 14 ), aAppMap ) ); - } - - { - maExclClassText.Show(); - maExclClassText.SetText("~Exclude-ObjectTest-Filter"); - maExclClassText.SetPosSizePixel( LogicToPixel( Point( 115, 150 ), aAppMap ), - LogicToPixel( Size( 95, 9 ), aAppMap ) ); - } - - { - maExclClassFilter.Show(); - maExclClassFilter.SetText(OStringToOUString(pData->aExclClassFilter, RTL_TEXTENCODING_UTF8)); - maExclClassFilter.SetMaxTextLen( sizeof( pData->aExclClassFilter ) ); - maExclClassFilter.SetPosSizePixel( LogicToPixel( Point( 115, 160 ), aAppMap ), - LogicToPixel( Size( 95, 14 ), aAppMap ) ); - } - - { - maInclText.Show(); - maInclText.SetText("~Include-Filter"); - maInclText.SetPosSizePixel( LogicToPixel( Point( 10, 180 ), aAppMap ), - LogicToPixel( Size( 95, 9 ), aAppMap ) ); - } - - { - maInclFilter.Show(); - maInclFilter.SetText(OStringToOUString(pData->aInclFilter, RTL_TEXTENCODING_UTF8)); - maInclFilter.SetMaxTextLen( sizeof( pData->aInclFilter ) ); - maInclFilter.SetPosSizePixel( LogicToPixel( Point( 10, 190 ), aAppMap ), - LogicToPixel( Size( 95, 14 ), aAppMap ) ); - } - - { - maExclText.Show(); - maExclText.SetText("~Exclude-Filter"); - maExclText.SetPosSizePixel( LogicToPixel( Point( 115, 180 ), aAppMap ), - LogicToPixel( Size( 95, 9 ), aAppMap ) ); - } - - { - maExclFilter.Show(); - maExclFilter.SetText(OStringToOUString(pData->aExclFilter, RTL_TEXTENCODING_UTF8)); - maExclFilter.SetMaxTextLen( sizeof( pData->aExclFilter ) ); - maExclFilter.SetPosSizePixel( LogicToPixel( Point( 115, 190 ), aAppMap ), - LogicToPixel( Size( 95, 14 ), aAppMap ) ); - } - - { - maErrorText.Show(); - maErrorText.SetText("~Error"); - maErrorText.SetPosSizePixel( LogicToPixel( Point( 220, 210 ), aAppMap ), - LogicToPixel( Size( 95, 9 ), aAppMap ) ); - } - - { - if ( DbgIsAllErrorOut() ) - { - maErrorBox.InsertEntry( OUString("None") ); - maErrorBox.InsertEntry( OUString("File") ); - maErrorBox.InsertEntry( OUString("Window") ); - maErrorBox.InsertEntry( OUString("Shell") ); - mnErrorOff = 0; - } - else - mnErrorOff = 4; - maErrorBox.InsertEntry( OUString("MessageBox") ); - maErrorBox.InsertEntry( OUString("TestTool") ); - maErrorBox.InsertEntry( OUString("Debugger") ); - maErrorBox.InsertEntry( OUString("Abort") ); - ImplAppendUserDefinedChannels( maErrorBox ); - ImplSelectChannel( maErrorBox, pData->nErrorOut, mnErrorOff ); - maErrorBox.Show(); - maErrorBox.SetPosSizePixel( LogicToPixel( Point( 220, 220 ), aAppMap ), - LogicToPixel( Size( 95, 80 ), aAppMap ) ); - } - - { - maBox4.Show(); - maBox4.SetText("Output"); - maBox4.SetPosSizePixel( LogicToPixel( Point( 5, 120 ), aAppMap ), - LogicToPixel( Size( 330, 135 ), aAppMap ) ); - } - - { maOKButton.Show(); maOKButton.SetClickHdl( LINK( this, DbgDialog, ClickHdl ) ); maOKButton.SetPosSizePixel( LogicToPixel( Point( 10, 260 ), aAppMap ), @@ -727,21 +477,6 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton ) memcpy( &aData, DbgGetData(), sizeof( DbgData ) ); aData.nTestFlags = 0; - aData.nErrorOut = ImplGetChannelId( maErrorBox, mnErrorOff ); - - strncpy( aData.aDebugName, OUStringToOString(maDebugName.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aDebugName ) ); - strncpy( aData.aInclClassFilter, OUStringToOString(maInclClassFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aInclClassFilter ) ); - strncpy( aData.aExclClassFilter, OUStringToOString(maExclClassFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aExclClassFilter ) ); - strncpy( aData.aInclFilter, OUStringToOString(maInclFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aInclFilter ) ); - strncpy( aData.aExclFilter, OUStringToOString(maExclFilter.GetText(), RTL_TEXTENCODING_UTF8).getStr(), sizeof( aData.aExclFilter ) ); - aData.aDebugName[sizeof( aData.aDebugName )-1] = '\0'; - aData.aInclClassFilter[sizeof( aData.aInclClassFilter )-1] = '\0'; - aData.aExclClassFilter[sizeof( aData.aExclClassFilter )-1] = '\0'; - aData.aInclFilter[sizeof( aData.aInclFilter )-1] = '\0'; - aData.aExclFilter[sizeof( aData.aExclFilter )-1] = '\0'; - - aData.bOverwrite = maOverwrite.IsChecked() ? true : false; - if ( maRes.IsChecked() ) aData.nTestFlags |= DBG_TEST_RESOURCE; @@ -754,17 +489,10 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton ) // Daten speichern DbgSaveData( aData ); - // Umschalten der Laufzeitwerte - DBG_INSTOUTERROR( aData.nErrorOut ); - DbgData* pData = DbgGetData(); #define IMMEDIATE_FLAGS (DBG_TEST_RESOURCE | DBG_TEST_DIALOG | DBG_TEST_BOLDAPPFONT) pData->nTestFlags &= ~IMMEDIATE_FLAGS; pData->nTestFlags |= aData.nTestFlags & IMMEDIATE_FLAGS; - strncpy( pData->aInclClassFilter, aData.aInclClassFilter, sizeof( pData->aInclClassFilter ) ); - strncpy( pData->aExclClassFilter, aData.aExclClassFilter, sizeof( pData->aExclClassFilter ) ); - strncpy( pData->aInclFilter, aData.aInclFilter, sizeof( pData->aInclFilter ) ); - strncpy( pData->aExclFilter, aData.aExclFilter, sizeof( pData->aExclFilter ) ); if ( maBoldAppFont.GetSavedValue() != TriState(maBoldAppFont.IsChecked()) ) { AllSettings aSettings = Application::GetSettings(); @@ -1220,210 +948,14 @@ void DbgDialogTest( Window* pWindow ) } } -#ifndef WNT -#define USE_VCL_MSGBOX -#define COPY_BUTTON_ID 25 - -class DbgMessageBox : public ErrorBox -{ - OUString m_aMessage; - public: - DbgMessageBox( const OUString& rMessage ) : - ErrorBox( NULL, WB_YES_NO_CANCEL | WB_DEF_NO, rMessage ), - m_aMessage( rMessage ) - { - SetText("Debug Output"); - AddButton(OUString("Copy"), COPY_BUTTON_ID, 0); - } - - virtual void Click() SAL_OVERRIDE - { - if( GetCurButtonId() == COPY_BUTTON_ID ) - vcl::unohelper::TextDataObject::CopyStringTo( m_aMessage, GetClipboard() ); - else - ErrorBox::Click(); - } -}; - -#endif - -class SolarMessageBoxExecutor : public ::vcl::SolarThreadExecutor -{ -private: - OUString m_sDebugMessage; - -public: - SolarMessageBoxExecutor( const OUString& _rDebugMessage ) - :m_sDebugMessage( _rDebugMessage ) - { - } - -protected: - virtual long doIt() SAL_OVERRIDE; -}; - -long SolarMessageBoxExecutor::doIt() -{ - long nResult = RET_NO; - - // Stop tracking and release mouse, to assure boxes do not hang - ImplSVData* pSVData = ImplGetSVData(); - if ( pSVData->maWinData.mpTrackWin ) - pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL ); - if ( pSVData->maWinData.mpCaptureWin ) - pSVData->maWinData.mpCaptureWin->ReleaseMouse(); - -#if ! defined USE_VCL_MSGBOX -#ifdef WNT - bool bOldCallTimer = pSVData->mbNoCallTimer; - pSVData->mbNoCallTimer = true; - nResult = MessageBoxW( 0, (LPWSTR)m_sDebugMessage.getStr(), L"Debug Output", - MB_TASKMODAL | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_ICONSTOP ); - pSVData->mbNoCallTimer = bOldCallTimer; - switch ( nResult ) - { - case IDYES: - nResult = RET_YES; - break; - case IDNO: - nResult = RET_NO; - break; - case IDCANCEL: - nResult = RET_CANCEL; - break; - } -#endif // WNT -#else - sal_uInt16 nOldMode = Application::GetSystemWindowMode(); - Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE ); - DbgMessageBox aBox( m_sDebugMessage ); - Application::SetSystemWindowMode( nOldMode ); - nResult = aBox.Execute(); -#endif - - return nResult; -} - -void DbgPrintMsgBox( const char* pLine ) -{ - // are modal message boxes prohibited at the moment? - if ( Application::IsDialogCancelEnabled() ) - { -#if defined( WNT ) - // TODO: Shouldn't this be a IsDebuggerPresent()? - if ( GetSystemMetrics( SM_DEBUG ) ) - { - strcpy( aDbgOutBuf, pLine ); - strcat( aDbgOutBuf, "\r\n" ); - OutputDebugString( aDbgOutBuf ); - return; - } -#endif - -#ifdef UNX - fprintf( stderr, "%s\n", pLine ); - return; -#else - DbgPrintFile( pLine ); - return; -#endif - } - - strcpy( aDbgOutBuf, pLine ); -#if defined UNX && HAVE_FEATURE_DESKTOP - strcat( aDbgOutBuf, "\nAbort ? (Yes=abort / No=ignore / Cancel=core dump)" ); -#elif defined _WIN32 - strcat( aDbgOutBuf, "\nAbort ? (Yes=abort / No=ignore / Cancel=try to invoke debugger)" ); -#else - strcat( aDbgOutBuf, "\nAbort ? (Yes=abort / No=ignore / Cancel=crash)" ); -#endif - - SolarMessageBoxExecutor aMessageBox( OUString( aDbgOutBuf, strlen(aDbgOutBuf), RTL_TEXTENCODING_UTF8 ) ); - TimeValue aTimeout; aTimeout.Seconds = 2; aTimeout.Nanosec = 0; - long nResult = aMessageBox.execute( aTimeout ); - - if ( aMessageBox.didTimeout() ) - DbgPrintShell( pLine ); - else if ( nResult == RET_YES ) - GetpApp()->Abort( OUString("Debug-Utilities-Error") ); - else if ( nResult == RET_CANCEL ) - DbgCoreDump(); -} - -class SolarWindowPrinter : public ::vcl::SolarThreadExecutor -{ -private: - OUString m_sDebugMessage; - -public: - SolarWindowPrinter( const OUString& _rDebugMessage ) - :m_sDebugMessage( _rDebugMessage ) - { - } - -protected: - virtual long doIt() SAL_OVERRIDE; -}; - -long SolarWindowPrinter::doIt() -{ - DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin; - if ( !pDbgWindow ) - { - pDbgWindow = new DbgWindow; - ImplGetSVData()->maWinData.mpDbgWin = pDbgWindow; - } - pDbgWindow->InsertLine( m_sDebugMessage ); - - return 0L; -} - -void DbgPrintWindow( const char* pLine ) -{ - static bool bIn = false; - - // keine rekursiven Traces - if ( bIn ) - return; - bIn = true; - - SolarWindowPrinter aPrinter( OUString( pLine, strlen(pLine), RTL_TEXTENCODING_UTF8 ) ); - TimeValue aTimeout; aTimeout.Seconds = 2; aTimeout.Nanosec = 0; - aPrinter.execute( aTimeout ); - - if ( aPrinter.didTimeout() ) - DbgPrintShell( pLine ); - - bIn = false; -} - -void DbgAbort( char const * i_message ) -{ - OUString const message( i_message, strlen( i_message ), osl_getThreadTextEncoding() ); - Application::Abort( message ); -} - void ImplDbgTestSolarMutex() { assert(ImplGetSVData()->mpDefInst->CheckYieldMutex()); } -void DbgGUIInit() +void DbgGUIInitSolarMutexCheck() { - DbgSetPrintMsgBox( DbgPrintMsgBox ); - DbgSetPrintWindow( DbgPrintWindow ); DbgSetTestSolarMutex( ImplDbgTestSolarMutex ); - DbgSetAbort( DbgAbort ); -} - -void DbgGUIDeInit() -{ - DbgSetPrintMsgBox( NULL ); - DbgSetPrintWindow( NULL ); - DbgSetAbort( NULL ); - - DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin; - delete pDbgWindow; } void DbgGUIDeInitSolarMutexCheck() diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 110e7d48344b..4a724e5447ee 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -29,7 +29,6 @@ #include "rtl/instance.hxx" #include "rtl/process.h" -#include "tools/tools.h" #include "tools/debug.hxx" #include "tools/time.hxx" diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index bccd5f16b72f..f0277eaa2760 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -22,7 +22,6 @@ #include <osl/file.hxx> #include <osl/signal.h> -#include "tools/tools.h" #include "tools/debug.hxx" #include "tools/resmgr.hxx" @@ -252,9 +251,6 @@ bool InitVCL() ImplSVData* pSVData = ImplGetSVData(); - // register with tools - InitTools(); - // remember Main-Thread-Id pSVData->mnMainThreadId = ::osl::Thread::getCurrentIdentifier(); @@ -292,8 +288,7 @@ bool InitVCL() // Set exception handler pExceptionHandler = osl_addSignalHandler(VCLExceptionSignal_impl, NULL); - // initialise debug data - DBGGUI_INIT(); + DBGGUI_INIT_SOLARMUTEXCHECK(); return true; } @@ -384,9 +379,6 @@ void DeInitVCL() osl_removeSignalHandler( pExceptionHandler); pExceptionHandler = NULL; - // Debug Daten zuruecksetzen - DBGGUI_DEINIT(); - // free global data delete pSVData->maGDIData.mpGrfConverter; @@ -558,8 +550,6 @@ void DeInitVCL() // Deinit Sal DestroySalInstance( pSVData->mpDefInst ); - DeInitTools(); - if( pOwnSvApp ) { delete pOwnSvApp; diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx index a8e29a909f23..1f2ba0d47daf 100644 --- a/vcl/source/app/svmainhook.cxx +++ b/vcl/source/app/svmainhook.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/tools.h> - #ifndef MACOSX // MacOSX implementation of ImplSVMainHook is in osx/salinst.cxx |