Subject: bug#76327: 29.4; random segfaults after switch to tree-sitter

From: Pip Cet <[email-masked]>
Date: Tue, 18 Feb 2025 15:38:43 +0000

"Evgeniy Dushistov via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\"" <[email-masked]> writes:

> On Tue, Feb 18, 2025 at 04:55:38PM +0200, Eli Zaretskii wrote:
>> The crash is here:
>>
>> 	if (CONSP (event->arg))
>> 	  return list5 (head, position, make_fixnum (double_click_count),
>> 			XCAR (event->arg), Fcons (XCAR (XCDR (event->arg)),
>> 						  XCAR (XCDR (XCDR (event->arg)))));
>>
>> It's an assertion violation, which probably means XCAR(event->arg) is
>> not a cons cell.  So it would be important to see the exact value of
>> event->arg at this point.  Like this:
>>
>>   (gdb) fr 5
>>   (gdb) pp event->arg
>>
>> If GDB says it doesn't know about "pp", do this:
>>
>>   (gdb) source /path/to/emacs/stc/.gdbinit
>>
>> and then repeat the above 2 commands.
>>
>
> (gdb) fr 5
> #5  make_lispy_event (event=0x555555f308e0 <kbd_buffer+13952>) at keyboard.c:6375
> warning: Source file is more recent than executable.
> 6375		  return list5 (head, position, make_fixnum (double_click_count),
> (gdb) pp event->arg
> (33558466)

So XCDR (event->arg) is nil, not a cons cell, and its car is also not
what it should be.  (My reading of xterm.c is that it should be Qnil,
and there should be floats in the list following the nil).

The car would be XLI(0x8003f0a), but that doesn't ring any immediate
bells (it might be a weird character with a shift modifier, but not an
ASCII one...)

So this still seems like a GC issue.

Pip