added a handful of debugTagIsOn("context") checks to resolve bug 143
authorMorgan Deters <mdeters@gmail.com>
Wed, 2 Jun 2010 23:18:54 +0000 (23:18 +0000)
committerMorgan Deters <mdeters@gmail.com>
Wed, 2 Jun 2010 23:18:54 +0000 (23:18 +0000)
src/context/context.cpp
src/context/context.h
src/context/context_mm.cpp

index 2de6e2051be10e7d41ab167fe712f485906c64a5..b003571c16c9bf7df6d86a6f6081b38a341ce7dd 100644 (file)
@@ -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;
   }
index ff650ce5da298be918d3f7dc90278c044fdd9b38..caa5fa57b7346b62f1a43a765e79099e30bee20d 100644 (file)
@@ -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);
   }
index b0b01568177b56c0e37690098a546f3b82d4fb55..a202edf195ac04ddb549c4f95972df8a3e77e3d8 100644 (file)
@@ -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;
 }