I did some debugging on the C side, using 'rr':

LD_LIBRARY_PATH=.libs ../meta/uninstalled-env rr record ./.libs/guile 
--fresh-auto-compile -l ../crash.scm

it leads to a segfault, as expected.  According to #39954, which looks
similar, 'frame-local-ref' returns (SCM)0x0.  So I tried some reverse debugging:

rr replay guile-3
break scm_frame_local_ref
reverse-continue
reverse-continue

I noticed "repr" was STACK_ITEM_SCM, and item->as_scm was set to 0x07
(which is invalid).  On another run, it was set to 0x09 (also invalid?).
I modified scm_frame_local_ref a bit so it ignores these 0x07 and 0x09
and treats them like SCM_EOF_VAL instead.  That allows printing the backtrace,
though I don't see those #<eof> appearing in the output.

Would someone know what's going on here?

Greetings,
Maxime
diff --git a/libguile/frames.c b/libguile/frames.c
index 0bb40579c..87afaec3d 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -41,6 +41,7 @@
 
 #include "frames.h"
 
+#include <stdio.h>
 
 SCM
 scm_c_make_frame (enum scm_vm_frame_kind kind, const struct scm_frame *frame)
@@ -272,6 +273,11 @@ scm_frame_local_ref (SCM frame, SCM index, SCM representation)
       switch (repr)
         {
           case STACK_ITEM_SCM:
+            fprintf(stderr, "i: %u  SCM: %p\n", (unsigned) i, (void*)item->as_u64);
+            if (item->as_u64 == 0x07)
+              return SCM_EOF_VAL;
+            if (item->as_u64 == 0x09)
+              return SCM_EOF_VAL;
             return item->as_scm;
           case STACK_ITEM_F64:
             return scm_from_double (item->as_f64);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to