Subject: bug#36649: 27.0.50; pure space and pdumper

From: Pip Cet <[email-masked]>
Date: Sun, 21 Jul 2019 18:07:43 +0000

On Sun, Jul 21, 2019 at 5:56 PM Robert Pluim <[email-masked]> wrote:
> >>>>> On Sun, 21 Jul 2019 17:43:05 +0000, Pip Cet <[email-masked]> said:
>
>     Pip> On Sun, Jul 21, 2019 at 3:06 PM Robert Pluim <[email-masked]> wrote:
>     >> Hmm, it crashed the first time I ran make, then I got distracted, so I
>     >> ran make again later, and this time it built:
>     >>
>     >> make[2]: Nothing to be done for `all'.
>     >> ELC      char-fold.elc
>     >> freeing symbol def-tmp-var
>
>     Pip> Hmm. So it worked with the second patch, but only when you reran make?
>     Pip> That's strange. Looking at the crash backtrace again, it seems that
>     Pip> this is the initial garbage collection, when everything should be
>     Pip> pristine. I still think it dies while marking the obarray, upon
>     Pip> encountering a symbol which has somehow become corrupted...
>
> OK. How do we go about detecting which symbol that is?

I'm not sure about debugging on macOS, but can you get a full
backtrace, or a core dump, or both? We're particularly interested in
what "i" is in mark_vectorlike.

Otherwise, the attached patch should produce (probably a lot of)
information, the last lines of which would be interesting...
From f366d66e83d76df1d89e264b463a6f903459d024 Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Date: Sun, 21 Jul 2019 18:03:17 +0000
Subject: [PATCH] Other debugging changes.

---
 src/alloc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/alloc.c b/src/alloc.c
index 1b55ad8cab..fe98eca086 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5663,7 +5663,10 @@ mark_vectorlike (union vectorlike_header *header)
      The distinction is used e.g. by Lisp_Process which places extra
      non-Lisp_Object fields at the end of the structure...  */
   for (i = 0; i < size; i++) /* ...and then mark its elements.  */
-    mark_object (ptr->contents[i]);
+    {
+      fprintf (stderr, "%d\n", (int)i);
+      mark_object (ptr->contents[i]);
+    }
 }
 
 /* Like mark_vectorlike but optimized for char-tables (and
@@ -6079,6 +6082,8 @@ #define CHECK_ALLOCATED_AND_LIVE_SYMBOL()	((void) 0)
       {
 	struct Lisp_Symbol *ptr = XSYMBOL (obj);
       nextsym:
+	if (!NILP (ptr->u.s.name))
+	  fprintf (stderr, "%p %s\n", ptr, SDATA (ptr->u.s.name));
         if (symbol_marked_p (ptr))
           break;
         CHECK_ALLOCATED_AND_LIVE_SYMBOL ();
-- 
2.22.0