changeset 46833:b80760a75295

(mark_object): Detect long lists for debugging. (mark_object_loop_halt): New variable.
author Richard M. Stallman <rms@gnu.org>
date Wed, 07 Aug 2002 14:37:32 +0000
parents 3e86025ff134
children c8a846fe7940
files src/alloc.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Wed Aug 07 14:32:09 2002 +0000
+++ b/src/alloc.c	Wed Aug 07 14:37:32 2002 +0000
@@ -4427,6 +4427,12 @@
 Lisp_Object *last_marked[LAST_MARKED_SIZE];
 int last_marked_index;
 
+/* For debugging--call abort when we cdr down this many
+   links of a list, in mark_object.  In debugging,
+   the call to abort will hit a breakpoint.
+   Normally this is zero and the check never goes off.  */
+int mark_object_loop_halt;
+
 void
 mark_object (argptr)
      Lisp_Object *argptr;
@@ -4437,6 +4443,7 @@
   void *po;
   struct mem_node *m;
 #endif
+  int cdr_count = 0;
 
  loop:
   obj = *objptr;
@@ -4790,10 +4797,14 @@
 	if (EQ (ptr->cdr, Qnil))
 	  {
 	    objptr = &ptr->car;
+	    cdr_count = 0;
 	    goto loop;
 	  }
 	mark_object (&ptr->car);
 	objptr = &ptr->cdr;
+	cdr_count++;
+	if (cdr_count == mark_object_loop_halt)
+	  abort ();
 	goto loop;
       }