* smob.c (freeprint): New function.
authorJim Blandy <jimb@red-bean.com>
Sat, 5 Dec 1998 16:52:34 +0000 (16:52 +0000)
committerJim Blandy <jimb@red-bean.com>
Sat, 5 Dec 1998 16:52:34 +0000 (16:52 +0000)
(freecell): Use it to print freed objects, for slightly easier
debugging.

libguile/smob.c

index 76d936a..4bf826f 100644 (file)
@@ -84,14 +84,29 @@ scm_newsmob (smob)
   return scm_tc7_smob + (scm_numsmob - 1) * 256;
 }
 
+\f
 /* {Initialization for i/o types, float, bignum, the type of free cells}
  */
 
+static int
+freeprint (SCM exp,
+          SCM port,
+          scm_print_state *pstate)
+{
+  char buf[100];
+
+  sprintf (buf, "#<freed cell %p; GC missed a reference>", (void *) exp);
+  scm_puts (buf, port);
+
+  return 1;
+}
+
+
 static scm_smobfuns freecell =
 {
   0,
   scm_free0,
-  0,
+  freeprint,
   0
 };