From 3c43b86a8e8cf640b069779182c8c521c1900a9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Fri, 19 Mar 1999 03:39:49 -0800
Subject: [PATCH] more debug

Rev: src/dmalloc.h:1.10
Rev: src/pike_memory.c:1.35
Rev: src/program.h:1.54
---
 src/dmalloc.h     |  4 +++-
 src/pike_memory.c | 15 ++++++++++-----
 src/program.h     |  8 ++++----
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/dmalloc.h b/src/dmalloc.h
index dfb24d5c56..5d0626b43e 100644
--- a/src/dmalloc.h
+++ b/src/dmalloc.h
@@ -1,5 +1,5 @@
 /*
- * $Id: dmalloc.h,v 1.9 1999/01/31 09:01:43 hubbe Exp $
+ * $Id: dmalloc.h,v 1.10 1999/03/19 11:39:29 hubbe Exp $
  */
 
 extern char *debug_xalloc(long);
@@ -33,6 +33,7 @@ void *debug_malloc_update_location(void *,const char *, int);
 #define debug_malloc_pass(X) debug_malloc_update_location((X),__FILE__,__LINE__)
 #define xalloc(X) ((char *)debug_malloc_touch(debug_xalloc(X)))
 void debug_malloc_dump_references(void *x);
+#define dmalloc_touch(TYPE,X) ((TYPE)debug_malloc_update_location((X),__FILE__,__LINE__))
 #else
 #define debug_malloc_dump_references(X)
 #define xalloc debug_xalloc
@@ -41,4 +42,5 @@ void debug_malloc_dump_references(void *x);
 #define debug_malloc_update_location(X,Y,Z) (X)
 #define debug_malloc_touch(X)
 #define debug_malloc_pass(X) (X)
+#define dmalloc_touch(TYPE,X) (X)
 #endif
diff --git a/src/pike_memory.c b/src/pike_memory.c
index 607fc0eec9..5c9f531aa1 100644
--- a/src/pike_memory.c
+++ b/src/pike_memory.c
@@ -10,7 +10,7 @@
 #include "pike_macros.h"
 #include "gc.h"
 
-RCSID("$Id: pike_memory.c,v 1.34 1999/03/10 02:41:17 hubbe Exp $");
+RCSID("$Id: pike_memory.c,v 1.35 1999/03/19 11:39:30 hubbe Exp $");
 
 /* strdup() is used by several modules, so let's provide it */
 #ifndef HAVE_STRDUP
@@ -636,8 +636,8 @@ int debug_malloc_check_all = 0;
 #define LHSIZE 1109891
 #define FLSIZE 8803
 #define DEBUG_MALLOC_PAD 8
-#define FREE_DELAY 1024
-#define MAX_UNFREE_MEM 1024*1024*16
+#define FREE_DELAY 4096
+#define MAX_UNFREE_MEM 1024*1024*32
 
 static void *blocks_to_free[FREE_DELAY];
 static unsigned int blocks_to_free_ptr=0;
@@ -701,9 +701,12 @@ char *do_pad(char *mem, long size)
 
 void check_pad(struct memhdr *mh, int freeok)
 {
+  static int out_biking=0;
   long q,e;
   char *mem=mh->data;
   long size=mh->size;
+  if(out_biking) return;
+
   if(size < 0)
   {
     if(!freeok)
@@ -725,14 +728,16 @@ void check_pad(struct memhdr *mh, int freeok)
     q=(q<<13) ^ ~(q>>5);
     if(mem[e-DEBUG_MALLOC_PAD] != tmp)
     {
+      out_biking=1;
       fprintf(stderr,"Pre-padding overwritten for block at %p (size %ld) (e=%ld %d!=%d)!\n",mem, size, e, tmp, mem[e-DEBUG_MALLOC_PAD]);
-      dump_memhdr_locations(mh, 0);
+      describe(mem);
       abort();
     }
     if(mem[size+e] != tmp)
     {
+      out_biking=1;
       fprintf(stderr,"Post-padding overwritten for block at %p (size %ld) (e=%ld %d!=%d)!\n",mem, size, e, tmp, mem[size+e]);
-      dump_memhdr_locations(mh, 0);
+      describe(mem);
       abort();
     }
   }
diff --git a/src/program.h b/src/program.h
index 11aeb87e32..8f54d34f96 100644
--- a/src/program.h
+++ b/src/program.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: program.h,v 1.53 1999/03/17 21:51:59 hubbe Exp $
+ * $Id: program.h,v 1.54 1999/03/19 11:39:49 hubbe Exp $
  */
 #ifndef PROGRAM_H
 #define PROGRAM_H
@@ -229,14 +229,14 @@ struct program
   INT16 lfuns[NUM_LFUNS];
 };
 
-#define INHERIT_FROM_PTR(P,X) ((debug_malloc_pass(P))->inherits + (debug_malloc_pass(X))->inherit_offset)
-#define PROG_FROM_PTR(P,X) (debug_malloc_pass(INHERIT_FROM_PTR(P,X)->prog))
+#define INHERIT_FROM_PTR(P,X) (dmalloc_touch(struct program *,(P))->inherits + (X)->inherit_offset)
+#define PROG_FROM_PTR(P,X) (dmalloc_touch(struct program *,INHERIT_FROM_PTR(P,X)->prog))
 #define ID_FROM_PTR(P,X) (PROG_FROM_PTR(P,X)->identifiers+(X)->identifier_offset)
 #define INHERIT_FROM_INT(P,X) INHERIT_FROM_PTR(P,(P)->identifier_references+(X))
 #define PROG_FROM_INT(P,X) PROG_FROM_PTR(P,(P)->identifier_references+(X))
 #define ID_FROM_INT(P,X) ID_FROM_PTR(P,(P)->identifier_references+(X))
 
-#define FIND_LFUN(P,N) ((debug_malloc_pass(P))->flags & PROGRAM_FIXED?(debug_malloc_pass((P)->lfuns[(N)])):find_identifier(lfun_names[(N)],(P)))
+#define FIND_LFUN(P,N) ( dmalloc_touch(struct program *,(P))->flags & PROGRAM_FIXED?((P)->lfuns[(N)]):find_identifier(lfun_names[(N)],(P)) )
 
 #define free_program(p) do{ struct program *_=(p); debug_malloc_touch(_); if(!--_->refs) really_free_program(_); }while(0)
 
-- 
GitLab