From 24d5e9f172e46020c8c3744802225ab2b252f72d Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 21 Dec 2017 17:29:29 +0100 Subject: [PATCH] The min debug level has to be high (10000) and not zero. * Bug: In Hurricane the ::tstream class must be initialized with a minLevel of 10000 instead of zero, as the minLevel go *towards* zero as the debug slice [min:max[ is expanded by DebugSession. This default value must be repeated in the CRL::System CTOR and in the coriolis2/etc/commons/misc.conf. * Bug: In Hurricane::IntrusiveSet, uses "tsetw(n)" dedicated cdebug stream manipulator instead of the STL one. --- crlcore/src/ccore/Utilities.cpp | 20 +++++++++---------- hurricane/src/hurricane/UpdateSession.cpp | 2 +- hurricane/src/hurricane/hurricane/Commons.h | 6 +++--- .../src/hurricane/hurricane/DebugSession.h | 9 ++++++++- .../src/hurricane/hurricane/IntrusiveSet.h | 7 +++---- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/crlcore/src/ccore/Utilities.cpp b/crlcore/src/ccore/Utilities.cpp index 0f364f95..86a9b103 100644 --- a/crlcore/src/ccore/Utilities.cpp +++ b/crlcore/src/ccore/Utilities.cpp @@ -330,16 +330,16 @@ namespace CRL { // Triggers Configuration singleton creation. Cfg::Configuration::get (); - Cfg::getParamBool ("misc.catchCore" ,false)->registerCb ( this, catchCoreChanged ); - Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( this, verboseLevel1Changed ); - Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( this, verboseLevel2Changed ); - Cfg::getParamBool ("misc.info" ,false)->registerCb ( this, infoChanged ); - Cfg::getParamBool ("misc.paranoid" ,false)->registerCb ( this, paranoidChanged ); - Cfg::getParamBool ("misc.bug" ,false)->registerCb ( this, bugChanged ); - Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( this, logModeChanged ); - Cfg::getParamInt ("misc.minTraceLevel" ,0 )->registerCb ( this, minTraceLevelChanged ); - Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged ); - Cfg::getParamString("stratus1.mappingName","" )->registerCb ( this, stratus1MappingNameChanged ); + Cfg::getParamBool ("misc.catchCore" ,false )->registerCb ( this, catchCoreChanged ); + Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( this, verboseLevel1Changed ); + Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( this, verboseLevel2Changed ); + Cfg::getParamBool ("misc.info" ,false )->registerCb ( this, infoChanged ); + Cfg::getParamBool ("misc.paranoid" ,false )->registerCb ( this, paranoidChanged ); + Cfg::getParamBool ("misc.bug" ,false )->registerCb ( this, bugChanged ); + Cfg::getParamBool ("misc.logMode" ,false )->registerCb ( this, logModeChanged ); + Cfg::getParamInt ("misc.minTraceLevel" ,100000)->registerCb ( this, minTraceLevelChanged ); + Cfg::getParamInt ("misc.maxTraceLevel" ,0 )->registerCb ( this, maxTraceLevelChanged ); + Cfg::getParamString("stratus1.mappingName","" )->registerCb ( this, stratus1MappingNameChanged ); // Immediate update from the configuration. //catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) ); diff --git a/hurricane/src/hurricane/UpdateSession.cpp b/hurricane/src/hurricane/UpdateSession.cpp index 27192993..c833fc83 100644 --- a/hurricane/src/hurricane/UpdateSession.cpp +++ b/hurricane/src/hurricane/UpdateSession.cpp @@ -147,7 +147,7 @@ void UpdateSession::onNotOwned() void Go::invalidate(bool propagateFlag) // ************************************ { - cdebug_log(18,1) << "Go::invalidate(" << this << ")" << endl; + cdebug_log(18,1) << "Go::invalidate(" << this << ") " << endl; if (not UPDATOR_STACK or UPDATOR_STACK->empty()) throw Error( "Can't invalidate go: empty update session stack" ); diff --git a/hurricane/src/hurricane/hurricane/Commons.h b/hurricane/src/hurricane/hurricane/Commons.h index 7f257b30..5ae9a71a 100644 --- a/hurricane/src/hurricane/hurricane/Commons.h +++ b/hurricane/src/hurricane/hurricane/Commons.h @@ -947,9 +947,9 @@ class tstream : public std::ostream { inline tstream::tstream ( std::ostream& s ) : std::ostream(s.rdbuf()) - , _minLevel(0) - , _maxLevel(0) - , _level(0) + , _minLevel (100000) + , _maxLevel (0) + , _level (0) , _tabulation(" ") { } diff --git a/hurricane/src/hurricane/hurricane/DebugSession.h b/hurricane/src/hurricane/hurricane/DebugSession.h index dc43e468..9180fbbc 100644 --- a/hurricane/src/hurricane/hurricane/DebugSession.h +++ b/hurricane/src/hurricane/hurricane/DebugSession.h @@ -101,6 +101,8 @@ namespace Hurricane { _singleton->_levels.push( make_pair( cdebug.setMinLevel(minLevel) , cdebug.setMaxLevel(maxLevel) ) ); + + //std::cerr << "DebugSession::open() " << minLevel << ":" << maxLevel << std::endl; } @@ -112,10 +114,13 @@ namespace Hurricane { if ( _singleton->_isTraced(symbol) ) { _singleton->_levels.push( make_pair( cdebug.setMinLevel(minLevel) , cdebug.setMaxLevel(maxLevel) ) ); - //cerr << "DebugSession::open() " << symbol << "min:" << minLevel << " max:" << maxLevel << endl; + + //std::cerr << "DebugSession::open() " << symbol << " " << minLevel << ":" << maxLevel << std::endl; } else { _singleton->_levels.push ( make_pair( cdebug.getMinLevel() , cdebug.getMaxLevel() ) ); + + //std::cerr << "DebugSession::open() Same level " << minLevel << ":" << maxLevel << std::endl; } } @@ -126,6 +131,8 @@ namespace Hurricane { cdebug.setMinLevel( _singleton->_levels.top().first ); cdebug.setMaxLevel( _singleton->_levels.top().second ); _singleton->_levels.pop (); + + //std::cerr << "DebugSession::close() " << cdebug.getMinLevel() << ":" << cdebug.getMaxLevel() << std::endl; } } diff --git a/hurricane/src/hurricane/hurricane/IntrusiveSet.h b/hurricane/src/hurricane/hurricane/IntrusiveSet.h index 48106d88..add70596 100644 --- a/hurricane/src/hurricane/hurricane/IntrusiveSet.h +++ b/hurricane/src/hurricane/hurricane/IntrusiveSet.h @@ -427,7 +427,6 @@ template class IntrusiveSet { newLength = min(_size / 5, (unsigned)512); if (newLength != _length) { - // cerr << "Resizing: " << this << " " << _length << " " << newLength << endl; unsigned oldLength = _length; Element** oldArray = _array; _length = newLength; @@ -438,7 +437,7 @@ template class IntrusiveSet { for (unsigned index = 0; index < oldLength; index++) { Element* element = oldArray[index]; if (not element) - cdebug_log(0,0) << "| bucket:" << setw(4) << index << " empty" << endl; + cdebug_log(0,0) << "| bucket:" << tsetw(4) << index << " empty" << endl; while (element) { Element* nextElement = _getNextElement(element); @@ -447,8 +446,8 @@ template class IntrusiveSet { _array[newIndex] = element; element = nextElement; - cdebug_log(0,0) << "| bucket:" << setw(4) << index - << " -> " << setw(4) << newIndex + cdebug_log(0,0) << "| bucket:" << tsetw(4) << index + << " -> " << tsetw(4) << newIndex << " + " << element << endl; } }