]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
add cbdata __FILE__,__LINE__ debugging
authorwessels <>
Sun, 30 Nov 1997 00:00:43 +0000 (00:00 +0000)
committerwessels <>
Sun, 30 Nov 1997 00:00:43 +0000 (00:00 +0000)
src/cbdata.cc
src/protos.h
src/squid.h

index 3b81dc04986404a3a392ccec75867ef3baee09bb..99c5a27841cb49a27ca94cd2fab309a860a0b755 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cbdata.cc,v 1.9 1997/11/28 08:01:03 wessels Exp $
+ * $Id: cbdata.cc,v 1.10 1997/11/29 17:00:43 wessels Exp $
  *
  * DEBUG: section 45    Callback Data Registry
  * AUTHOR: Duane Wessels
@@ -71,6 +71,10 @@ typedef struct _cbdata {
     struct _cbdata *next;
     int valid;
     int locks;
+#if CBDATA_DEBUG
+    const char *file;
+    int line;
+#endif
 } cbdata;
 
 static HASHCMP cbdata_cmp;
@@ -97,7 +101,11 @@ cbdataInit(void)
 }
 
 void
+#if CBDATA_DEBUG
+cbdataAddDbg(void *p, const char *file, int line)
+#else
 cbdataAdd(void *p)
+#endif
 {
     cbdata *c;
     assert(p);
@@ -107,6 +115,10 @@ cbdataAdd(void *p)
     c = xcalloc(1, sizeof(cbdata));
     c->key = p;
     c->valid = 1;
+#if CBDATA_DEBUG
+    c->file = file;
+    c->line = line;
+#endif
     hash_join(htable, (hash_link *) c);
     cbdataCount++;
 }
@@ -185,9 +197,17 @@ cbdataDump(StoreEntry * sentry)
     storeAppendPrintf(sentry, "%d cbdata entries\n", cbdataCount);
     for (hptr = hash_first(htable); hptr; hptr = hash_next(htable)) {
        c = (cbdata *) hptr;
+#if CBDATA_DEBUG
+       storeAppendPrintf(sentry, "%20p %10s %d locks %s:%d\n",
+           c->key,
+           c->valid ? "VALID" : "NOT VALID",
+           c->locks,
+           c->file, c->line);
+#else
        storeAppendPrintf(sentry, "%20p %10s %d locks\n",
            c->key,
            c->valid ? "VALID" : "NOT VALID",
            c->locks);
+#endif
     }
 }
index cba31b2f48761ad7ca83dd3102e86a0a97a31c35..8b3faf452175f56f05f4905f8cae58cd9fa9208e 100644 (file)
@@ -55,7 +55,11 @@ extern void wordlistDestroy(wordlist **);
 extern void configFreeMemory(void);
 
 extern void cbdataInit(void);
+#if CBDATA_DEBUG
+extern void cbdataAddDbg(void *p, const char *, int);
+#else
 extern void cbdataAdd(void *p);
+#endif
 extern void cbdataFree(void *p);
 extern void cbdataLock(void *p);
 extern void cbdataUnlock(void *p);
index ccf3f94596719b032345d2fb1c686aa11e5ae003..ff98c07997c38dc581d66200d48463a704da24f8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.135 1997/11/14 04:55:08 wessels Exp $
+ * $Id: squid.h,v 1.136 1997/11/29 17:00:45 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
 #define LOCAL_ARRAY(type,name,size) static type name[size]
 #endif
 
+#if CBDATA_DEBUG
+#define cbdataAdd(a)   cbdataAddDbg(a,__FILE__,__LINE__)
+#endif
+
 #ifdef USE_GNUREGEX
 #include "GNUregex.h"
 #elif HAVE_REGEX_H