From 5342a87464932ce062004e3587bd4339a10035db Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 24 Feb 2011 17:39:47 +0100 Subject: [PATCH] debuglevels: simplify the build system, by complicating the OOo code ;) Introduce DBGSV_(TRACE/WARNING/ERROR)_OUT, which controls the output channel for tools-level traces/warnings/assertions, when no dbgsv.ini file is found (this is the increased OOo complexity). Use this in installationtest.mk, instead of creating a dedicated dbgsv.ini file. Yet to come: add support for DBGSV_ERROR_OUT to the GNU make build system. Which is the reason why DBGSV_ERROR_OUT was introduced: Currently, running a GNU make based test pops up assertions as message boxes. Before the change here, we would have needed to add dbgsv.ini support to the GNU make build system, which sounds not like a funny a reasonable thing to do. So, instead, we will simply set DBGSV_ERROR_OUT, which is much simpler and less error prone. --- tools/source/debug/debug.cxx | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index b15c3fe3604f..bbde4efe6d9e 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -473,25 +473,29 @@ namespace if ( nValueLen ) *_out_pnValue = strcmp( aBuf, "1" ) == 0 ? sal_True : sal_False; } - void lcl_tryReadOutputChannel( const sal_Char* _pLine, size_t _nLineLen, const sal_Char* _pKeyName, sal_uIntPtr* _out_pnValue ) + 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 ( sal_uIntPtr name = 0; name < sizeof( names ) / sizeof( names[0] ); ++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 ) - { - for ( sal_uIntPtr name = 0; name < sizeof( names ) / sizeof( names[0] ); ++name ) - { - if ( strcmp( aBuf, names[ name ] ) == 0 ) - { - *_out_pnValue = name; - return; - } - } - } + 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 ) { @@ -813,6 +817,13 @@ static DebugData* GetDebugData() FileClose( pIniFile ); } + else + { + lcl_matchOutputChannel( getenv( "DBGSV_TRACE_OUT" ), &aDebugData.aDbgData.nTraceOut ); + lcl_matchOutputChannel( getenv( "DBGSV_WARNING_OUT" ), &aDebugData.aDbgData.nWarningOut ); + lcl_matchOutputChannel( getenv( "DBGSV_ERROR_OUT" ), &aDebugData.aDbgData.nErrorOut ); + + } getcwd( aCurPath, sizeof( aCurPath ) );