Subject: bug#71289: 30.0.50; cmcheckmagic aborts when tty_write_glyphs writes "Garbage collecting..." in some cases

From: Daniel Clemente <[email-masked]>
Date: Thu, 6 Jun 2024 15:23:33 +0000

> I see a different abort, for which I've now installed a fix.  To try
> to fix the above one, I need some additional data:
>
>   (gdb) frame 2
>   (gdb) p window_matrix->rows->glyphs[0]
>   (gdb) p frame_matrix->rows->glyphs[0]
>   (gdb) p frame_matrix->rows->glyphs[2]
>   (gdb) p window_matrix->nrows
>   (gdb) p frame_matrix->nrows

Right now if I run the C-x 2 and resize scenario, I get this other
backtrace with build_frame_matrix_from_leaf_window, it's not the one
you requested (the one in check_matrix_pointers), but does it help?
This is with your latest patch.

(gdb) bt

#0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:443
#1  0x00005555557352d1 in die (msg=0x55555584e780
"frame_size_change_delayed (XFRAME (w->frame)) || glyph_row_slice_p
(window_row, frame_row)", file=0x55555584e231 "dispnew.c", line=2646)
at alloc.c:8082
#2  0x000055555558b5d1 in build_frame_matrix_from_leaf_window
(frame_matrix=0x55555602bdd0, w=0x5555560596e8) at dispnew.c:2646
#3  0x000055555558b094 in build_frame_matrix_from_window_tree
(matrix=0x55555602bdd0, w=0x5555560596e8) at dispnew.c:2535
#4  0x000055555558b07f in build_frame_matrix_from_window_tree
(matrix=0x55555602bdd0, w=0x5555561dc308) at dispnew.c:2533
#5  0x000055555558b029 in build_frame_matrix (f=0x5555560594c8) at
dispnew.c:2519
#6  0x000055555558cf9f in update_frame (f=0x5555560594c8,
force_p=true, inhibit_hairy_id_p=false) at dispnew.c:3335
#7  0x00005555555cf68a in redisplay_internal () at xdisp.c:17464
#8  0x00005555555cffbe in redisplay_preserve_echo_area (from_where=11)
at xdisp.c:17747
#9  0x00005555557edf64 in wait_reading_process_output (time_limit=30,
nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0),
wait_proc=0x0, just_wait_proc=0) at process.c:5585

(gdb) frame 2

#2  0x000055555558b5d1 in build_frame_matrix_from_leaf_window
(frame_matrix=0x55555602bdd0, w=0x5555560596e8) at dispnew.c:2646
2646          eassert (frame_size_change_delayed (XFRAME (w->frame))
(gdb) lisp

Undefined command: "lisp".  Try "help".
(gdb) list

2641            }
2642
2643    #ifdef GLYPH_DEBUG
2644          /* Window row window_y must be a slice of frame row
2645             frame_y.  */
2646          eassert (frame_size_change_delayed (XFRAME (w->frame))
2647               || glyph_row_slice_p (window_row, frame_row));
2648
2649          /* If rows are in sync, we don't have to copy glyphs because
2650             frame and window share glyphs.  */
(gdb) p window_matrix

$1 = (struct glyph_matrix *) 0x55555602c2b0
(gdb) p window_matrix->rows->glyphs[0]

$2 = (struct glyph *) 0x7ffff033f4c0
(gdb) xpr
xpr            xprintbytestr  xprintstr      xprintsym      xprocess
(gdb) p window_matrix->rows->glyphs[0]

$3 = (struct glyph *) 0x7ffff033f4c0
(gdb) p frame_matrix->rows->glyphs[0]

$4 = (struct glyph *) 0x7ffff02cf010
(gdb) p frame_matrix->rows->glyphs[2]

$5 = (struct glyph *) 0x7ffff02cf4f0
(gdb)  p window_matrix->nrows

$6 = 2
(gdb) p frame_matrix->nrows

$7 = 6
(gdb)

And from another run:

(gdb) p window_matrix->rows->glyphs[0]
$8 = (struct glyph *) 0x7ffff2ac92e0
(gdb) p window_matrix->rows->glyphs[0]
$9 = (struct glyph *) 0x7ffff2ac92e0
(gdb) pgx window_matrix->rows->glyphs[0]
CHAR[6] pos=160 blev=0,btyp=L w=1 a+d=0+0 MB
(gdb) p window_matrix->rows->glyphs[0]
$10 = (struct glyph *) 0x7ffff2ac92e0
(gdb) pgx window_matrix->rows->glyphs[0]
CHAR[6] pos=160 blev=0,btyp=L w=1 a+d=0+0 MB
(gdb) p frame_matrix->rows->glyphs[0]
$11 = (struct glyph *) 0x7ffff2a59010
(gdb) pgx frame_matrix->rows->glyphs[0]
CHAR[F] str=0xf2223b2f[0] blev=0,btyp=L w=1 a+d=0+0 face=10
(gdb) p frame_matrix->rows->glyphs[2]
$12 = (struct glyph *) 0x7ffff2a59340
(gdb) pgx frame_matrix->rows->glyphs[2]
CHAR[ ] str=0xf2385987[-1] blev=0,btyp=B w=1 a+d=0+0 face=10
(gdb) p window_matrix->nrows
$13 = 2
(gdb) p frame_matrix->nrows
$14 = 8
(gdb)