From 3e1ab30ae6f4504b2a94224d5f0dfcfdf32aed6e Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Wed, 2 Jun 2010 23:18:54 +0000 Subject: [PATCH] added a handful of debugTagIsOn("context") checks to resolve bug 143 --- src/context/context.cpp | 39 ++++++++++++++++++++++---------------- src/context/context.h | 4 +++- src/context/context_mm.cpp | 8 +++++--- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/context/context.cpp b/src/context/context.cpp index 2de6e2051..b003571c1 100644 --- a/src/context/context.cpp +++ b/src/context/context.cpp @@ -129,15 +129,19 @@ void Context::addNotifyObjPost(ContextNotifyObj* pCNO) { void ContextObj::update() throw(AssertionException) { - Debug("context") << "before update(" << this << "):" << std::endl - << *getContext() << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "before update(" << this << "):" << std::endl + << *getContext() << std::endl; + } // Call save() to save the information in the current object ContextObj* pContextObjSaved = save(d_pScope->getCMM()); - Debug("context") << "in update(" << this << ") with restore " - << pContextObjSaved << ": waypoint 1" << std::endl - << *getContext() << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "in update(" << this << ") with restore " + << pContextObjSaved << ": waypoint 1" << std::endl + << *getContext() << std::endl; + } // Check that base class data was saved Assert( ( pContextObjSaved->d_pContextObjNext == d_pContextObjNext && @@ -166,9 +170,11 @@ void ContextObj::update() throw(AssertionException) { Debug("context") << "in update(" << this << "): *prev() is now " << *prev() << std::endl; - Debug("context") << "in update(" << this << ") with restore " - << pContextObjSaved << ": waypoint 3" << std::endl - << *getContext() << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "in update(" << this << ") with restore " + << pContextObjSaved << ": waypoint 3" << std::endl + << *getContext() << std::endl; + } // Update Scope pointer to current top Scope d_pScope = d_pScope->getContext()->getTopScope(); @@ -180,9 +186,11 @@ void ContextObj::update() throw(AssertionException) { // Scope is popped. d_pScope->addToChain(this); - Debug("context") << "after update(" << this << ") with restore " - << pContextObjSaved << ":" << std::endl - << *getContext() << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "after update(" << this << ") with restore " + << pContextObjSaved << ":" << std::endl + << *getContext() << std::endl; + } } @@ -227,10 +235,9 @@ ContextObj* ContextObj::restoreAndContinue() throw(AssertionException) { void ContextObj::destroy() throw(AssertionException) { - if( debugTagIsOn("context") ) { + if(debugTagIsOn("context")) { /* Context can be big and complicated, so we only want to process this output - * if we're really going to use it. (Same goes below.) - */ + * if we're really going to use it. (Same goes below.) */ Debug("context") << "before destroy " << this << " (level " << getLevel() << "):" << std::endl << *getContext() << std::endl; } @@ -246,7 +253,7 @@ void ContextObj::destroy() throw(AssertionException) { if(d_pContextObjRestore == NULL) { break; } - if( debugTagIsOn("context") ) { + if(debugTagIsOn("context")) { Debug("context") << "in destroy " << this << ", restore object is " << d_pContextObjRestore << " at level " << d_pContextObjRestore->getLevel() << ":" << std::endl @@ -254,7 +261,7 @@ void ContextObj::destroy() throw(AssertionException) { } restoreAndContinue(); } - if( debugTagIsOn("context") ) { + if(debugTagIsOn("context")) { Debug("context") << "after destroy " << this << ":" << std::endl << *getContext() << std::endl; } diff --git a/src/context/context.h b/src/context/context.h index ff650ce5d..caa5fa57b 100644 --- a/src/context/context.h +++ b/src/context/context.h @@ -505,7 +505,9 @@ public: * ContextMemoryManager as an argument. */ void deleteSelf() { - Debug("context") << "deleteSelf(" << this << ")" << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "deleteSelf(" << this << ")" << std::endl; + } this->~ContextObj(); ::operator delete(this); } diff --git a/src/context/context_mm.cpp b/src/context/context_mm.cpp index b0b015681..a202edf19 100644 --- a/src/context/context_mm.cpp +++ b/src/context/context_mm.cpp @@ -85,9 +85,11 @@ void* ContextMemoryManager::newData(size_t size) { AlwaysAssert(d_nextFree <= d_endChunk, "Request is bigger than memory chunk size"); } - Debug("context") << "ContextMemoryManager::newData(" << size - << ") returning " << res << " at level " - << d_chunkList.size() << std::endl; + if(debugTagIsOn("context")) { + Debug("context") << "ContextMemoryManager::newData(" << size + << ") returning " << res << " at level " + << d_chunkList.size() << std::endl; + } return res; } -- 2.30.2