Subject: bug#71679: 29.3; treesit-node-child function chokes and crashes emacs for nodes with large number of child nodes

From: Mauritz Stenek <[email-masked]>
Date: Thu, 20 Jun 2024 13:31:52 -0600

On 2024-06-20 at 13:10, Eli Zaretskii <[email-masked]> wrote:

> But your way should also work, if you say "continue" after 
> attaching
> GDB.  And don't use -i=mi, since the MI interface is for another
> program to drive GDB, it is not convenient for humans.

I couldn't run it your way; running it without the `-i=mi`, this 
is what I get from gdb:

```
(gdb) continue
Continuing.

Thread 1 ".emacs-29.3-rea" received signal SIGSEGV, Segmentation 
fault.
0x0000000000584404 in ?? ()
(gdb) bt
#0  0x0000000000584404 in ?? ()
#1  0x0000000000662d88 in ?? ()
#2  0x0000000000604b9d in ?? ()
#3  0x0000000000602b1b in ?? ()
#4  0x000000000060350d in ?? ()
#5  0x00007f496d659800 in 
 F656c6973702d2d6576616c2d6c6173742d736578702d7072696e742d76616c7565_elisp__eval_last_sexp_print_value_0 
 ()
   from 
   /gnu/store/cigkk82q1f5wypljsc6nfs4sz9k1qi2b-emacs-29.3/bin/../lib/emacs/29.3/native-lisp/29.3-d9acad52/preloaded/progmodes/elisp-mode.eln
#6  0x00000000005dbf33 in ?? ()
#7  0x00007f496d659788 in 
 F656c6973702d2d6576616c2d6c6173742d73657870_elisp__eval_last_sexp_0 
 ()
   from 
   /gnu/store/cigkk82q1f5wypljsc6nfs4sz9k1qi2b-emacs-29.3/bin/../lib/emacs/29.3/native-lisp/29.3-d9acad52/preloaded/progmodes/elisp-mode.eln
#8  0x00000000005dbf33 in ?? ()
#9  0x00007f496d659c11 in 
 F6576616c2d6c6173742d73657870_eval_last_sexp_0 ()
   from 
   /gnu/store/cigkk82q1f5wypljsc6nfs4sz9k1qi2b-emacs-29.3/bin/../lib/emacs/29.3/native-lisp/29.3-d9acad52/preloaded/progmodes/elisp-mode.eln
#10 0x00000000005dbf33 in ?? ()
#11 0x00000000005d7fbf in ?? ()
#12 0x00000000005dbf33 in ?? ()
#13 0x00000000005d93e3 in ?? ()
#14 0x00007f496ded5c9d in 
 F636f6d6d616e642d65786563757465_command_execute_0 () from 
 /gnu/store/cigkk82q1f5wypljsc6nfs4sz9k1qi2b-emacs-29.3/bin/../lib/emacs/29.3/native-lisp/29.3-d9acad52/preloaded/simple.eln
#15 0x00000000005dbf33 in ?? ()
#16 0x00000000005651c5 in ?? ()
#17 0x00000000005da697 in ?? ()
#18 0x00000000005510ba in ?? ()
#19 0x00000000005da5f1 in ?? ()
#20 0x000000000055105f in ?? ()
#21 0x0000000000558033 in ?? ()
#22 0x00000000005583aa in ?? ()
#23 0x0000000000431069 in ?? ()
#24 0x00007f496fc2d1f7 in __libc_start_call_main () from 
 /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libc.so.6
#25 0x00007f496fc2d2ac in __libc_start_main_impl () from 
 /gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libc.so.6
#26 0x0000000000431561 in ?? ()
(gdb) continue
Continuing.

Thread 1 ".emacs-29.3-rea" received signal SIGSEGV, Segmentation 
fault.
0x00007f496fc8afec in __pthread_kill_implementation () from 
/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35/lib/libc.so.6
(gdb) continue
Continuing.
Couldn't get registers: No such process.
(gdb) [Thread 0x7f496be00640 (LWP 257704) exited]
[Thread 0x7f496ef9d100 (LWP 257702) exited]
[Thread 0x7f496c800640 (LWP 257703) exited]
[New process 257702]

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

The program is not being run.
```

Is this the expected backtrace output?

-- 
Mauritz Stenek <[email-masked]>