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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 Feb 2025 16:55:38 +0200

> Date: Tue, 18 Feb 2025 12:55:12 +0300
> From: Evgeniy Dushistov <[email-masked]>
> Cc: [email-masked], Eli Zaretskii <[email-masked]>,
> 	[email-masked]
> 
> 
> On Mon, Feb 17, 2025 at 08:31:25PM +0000, Pip Cet wrote:
> > Yes, it does trigger a lot.  You can restrict the breakpoint to trigger
> > only when value is Qlistp by doing
> > 
> > b wrong_type_argument if value == Qlistp
> > 
> 
> I build with enable-checking=all and use b wrong_type_argument if value == Qlistp.
> 
> lisp.h:1497: Emacs fatal error: assertion failed: CONSP (a)

Is this session still inside GDB?  I guess not, which is a pity.

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.

If you already let Emacs continue and crash (and exit), then please
wait till the next time it crashes, leave it running under GDB, and
post the backtrace here.  We then will try to ask you to display
several values and report the results, so that we could figure out
what could be the problem.

Thanks.

P.S. You could also try building the latest pretest of what will soon
become Emacs 30.1, maybe this problem was already fixed.  You can find
the pretest tarballs here:

    https://alpha.gnu.org/gnu/emacs/pretest/