------------------------------------------------------------ revno: 13630 revision-id: squid3@treenet.co.nz-20141006193803-6739k48w4hr12899 parent: chtsanti@users.sourceforge.net-20141006145340-2qhahfh6v5f5yo5b committer: Amos Jeffries branch nick: trunk timestamp: Mon 2014-10-06 12:38:03 -0700 message: Cleanup CBDATA debugging messages * Remove duplicate labels from debug messages. function names are now automatically added. * Add debug messages to display method used for freeing CBDATA. Whether the object was deleted, or placement destructor called. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20141006193803-6739k48w4hr12899 # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 93d6f1b811e7a52bd9880325f9812a3e386d8436 # timestamp: 2014-10-06 19:51:01 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk # base_revision_id: chtsanti@users.sourceforge.net-20141006145340-\ # 2qhahfh6v5f5yo5b # # Begin patch === modified file 'src/base/CbcPointer.h' --- src/base/CbcPointer.h 2014-09-13 13:59:43 +0000 +++ src/base/CbcPointer.h 2014-10-06 19:38:03 +0000 @@ -11,6 +11,7 @@ #include "base/TextException.h" #include "cbdata.h" +#include "Debug.h" /** \ingroup CBDATAAPI @@ -120,6 +121,9 @@ void CbcPointer::clear() { +#if USE_CBDATA_DEBUG + debugs(45, 3, "cbc=" << (void*)cbc << ", lock=" << (void*)lock); +#endif cbdataReferenceDone(lock); // lock may be nil before and will be nil after cbc = NULL; } === modified file 'src/cbdata.cc' --- src/cbdata.cc 2014-09-13 13:59:43 +0000 +++ src/cbdata.cc 2014-10-06 19:38:03 +0000 @@ -294,9 +294,9 @@ c->calls = std::vector (); c->addHistory("Alloc", file, line); dlinkAdd(c, &c->link, &cbdataEntries); - debugs(45, 3, "cbdataAlloc: " << p << " " << file << ":" << line); + debugs(45, 3, "Allocating " << p << " " << file << ":" << line); #else - debugs(45, 9, "cbdataAlloc: " << p); + debugs(45, 9, "Allocating " << p); #endif return p; @@ -316,11 +316,9 @@ c = (cbdata *) (((char *) p) - cbdata::Offset); #endif #if USE_CBDATA_DEBUG - - debugs(45, 3, "cbdataFree: " << p << " " << file << ":" << line); + debugs(45, 3, p << " " << file << ":" << line); #else - - debugs(45, 9, "cbdataFree: " << p); + debugs(45, 9, p); #endif c->check(__LINE__); @@ -332,12 +330,12 @@ #endif if (c->locks) { - debugs(45, 9, "cbdataFree: " << p << " has " << c->locks << " locks, not freeing"); + debugs(45, 9, p << " has " << c->locks << " locks, not freeing"); return NULL; } --cbdataCount; - debugs(45, 9, "cbdataFree: Freeing " << p); + debugs(45, 9, "Freeing " << p); #if USE_CBDATA_DEBUG dlinkDelete(&c->link, &cbdataEntries); @@ -356,9 +354,15 @@ cbdata_type theType = c->type; #if HASHED_CBDATA hash_remove_link(cbdata_htable, &c->hash); +#if USE_CBDATA_DEBUG + debugs(45, 3, "Call delete " << (void*)c << " " << file << ":" << line); +#endif delete c; cbdata_index[theType].pool->freeOne((void *)p); #else +#if USE_CBDATA_DEBUG + debugs(45, 3, "Call cbdata::~cbdata() " << (void*)c << " " << file << ":" << line); +#endif c->cbdata::~cbdata(); cbdata_index[theType].pool->freeOne(c); #endif @@ -384,15 +388,10 @@ #endif #if USE_CBDATA_DEBUG - - debugs(45, 3, "cbdataLock: " << p << "=" << (c ? c->locks + 1 : -1) << " " << file << ":" << line); - + debugs(45, 3, p << "=" << (c ? c->locks + 1 : -1) << " " << file << ":" << line); c->addHistory("Reference", file, line); - #else - - debugs(45, 9, "cbdataLock: " << p << "=" << (c ? c->locks + 1 : -1)); - + debugs(45, 9, p << "=" << (c ? c->locks + 1 : -1)); #endif c->check(__LINE__); @@ -421,15 +420,10 @@ #endif #if USE_CBDATA_DEBUG - - debugs(45, 3, "cbdataUnlock: " << p << "=" << (c ? c->locks - 1 : -1) << " " << file << ":" << line); - + debugs(45, 3, p << "=" << (c ? c->locks - 1 : -1) << " " << file << ":" << line); c->addHistory("Dereference", file, line); - #else - - debugs(45, 9, "cbdataUnlock: " << p << "=" << (c ? c->locks - 1 : -1)); - + debugs(45, 9, p << "=" << (c ? c->locks - 1 : -1)); #endif c->check(__LINE__); @@ -445,7 +439,7 @@ --cbdataCount; - debugs(45, 9, "cbdataUnlock: Freeing " << p); + debugs(45, 9, "Freeing " << p); #if USE_CBDATA_DEBUG @@ -466,9 +460,15 @@ cbdata_type theType = c->type; #if HASHED_CBDATA hash_remove_link(cbdata_htable, &c->hash); +#if USE_CBDATA_DEBUG + debugs(45, 3, "Call delete " << (void*)c << " " << file << ":" << line); +#endif delete c; cbdata_index[theType].pool->freeOne((void *)p); #else +#if USE_CBDATA_DEBUG + debugs(45, 3, "Call cbdata::~cbdata() " << (void*)c << " " << file << ":" << line); +#endif c->cbdata::~cbdata(); cbdata_index[theType].pool->freeOne(c); #endif @@ -482,7 +482,7 @@ if (p == NULL) return 1; /* A NULL pointer cannot become invalid */ - debugs(45, 9, "cbdataReferenceValid: " << p); + debugs(45, 9, p); #if HASHED_CBDATA c = (cbdata *) hash_lookup(cbdata_htable, p);