bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#71289: 30.0.50; cmcheckmagic aborts when tty_write_glyphs writes "Ga


From: Daniel Clemente
Subject: bug#71289: 30.0.50; cmcheckmagic aborts when tty_write_glyphs writes "Garbage collecting..." in some cases
Date: Mon, 3 Jun 2024 15:35:20 +0000

>> > At point cmcheckmagic, ¿abort? 1. MagicWrap 1, curY 3, vs. 3 - 1. Now
>> tty has 3 rows, 14 cols
>
> So you are saying that the terminal lies to us?  It has 3 rows, but
> somehow wraps the cursor to the 4th row?  What are the window and
> frame dimensions at this point?

I don't know enough to say whether the terminal is providing wrong numbers.
But it seems that the positions and terminal dimensions aren't wrong, they're just outdated. They were right a moment ago (i.e. the terminal was really as large as reported) but I was resizing the window during a slow operation (GC) that was trying to display a message due to garbage-collection-messages t, and it seems that the GC message is using outdated information about the terminal size. That's my hypothesis.

I have reproduced this in a more drastic way, e.g. the cursor in line 14 and the terminal being 4.

At point cmcheckmagic, ¿abort? 1. MagicWrap 1, curY 13, vs. 4 - 1. Now tty has 4 rows, 80 cols


> What are the window and
> frame dimensions at this point?

(I'm using the example mentioned above: 13, vs. 4 - 1).
The frame seems 4 lines 80 columns.
I'm not sure how to obtain the window dimensions from gdb, since there are several fields. Here are two attempts to get it, but total_cols/total_lines are 0 so it seems I'm not looking at the right fields.

(gdb) bt
#0  terminate_due_to_signal (sig=6, backtrace_limit=40) at emacs.c:443
#1  0x00005555556bdde1 in emacs_abort () at sysdep.c:2391
#2  0x0000555555669c8e in cmcheckmagic (tty=0x5555620ec360) at cm.c:124
#3  0x000055555566e1a0 in tty_write_glyphs (f=0x555562caa780, string=0x55555fb81720, len=80) at term.c:819
#4  0x0000555555678534 in write_glyphs (f=0x555562caa780, string=0x55555fb80820, len=80) at terminal.c:163
#5  0x0000555555591958 in update_frame_line (f=0x555562caa780, vpos=13, updating_menu_p=false) at dispnew.c:5321
#6  0x0000555555590a43 in update_frame_1 (f=0x555562caa780, force_p=true, inhibit_id_p=true, set_cursor_p=true,
    updating_menu_p=false) at dispnew.c:4980
#7  0x000055555558cfad in update_frame (f=0x555562caa780, force_p=true, inhibit_hairy_id_p=true) at dispnew.c:3346
#8  0x00005555555ca441 in echo_area_display (update_frame_p=true) at xdisp.c:13487
#9  0x00005555555c63fb in message3_nolog (m=XIL(0x55555fcf7e54)) at xdisp.c:12385
#10 0x00005555555c64a7 in message1_nolog (m=0x55555586f976 "Garbage collecting...") at xdisp.c:12413
#11 0x0000555555732a80 in garbage_collect () at alloc.c:6587
#12 0x0000555555732817 in maybe_garbage_collect () at alloc.c:6507
#13 0x0000555555769a95 in maybe_gc () at /w/emacs/src/lisp.h:5927
#14 0x000055555576f4d7 in eval_sub (form=XIL(0x5555616dda13)) at eval.c:2502
#15 0x000055555576a6f5 in Fprogn (body=XIL(0)) at eval.c:439
#16 0x000055555576a725 in prog_ignore (body=XIL(0x5555616dd8f3)) at eval.c:450
#17 0x000055555576c30a in Fwhile (args=XIL(0x5555616dd803)) at eval.c:1130
#18 0x000055555576f82d in eval_sub (form=XIL(0x5555616dd7f3)) at eval.c:2549
#19 0x000055555576a6f5 in Fprogn (body=XIL(0x5555616dd923)) at eval.c:439
#20 0x000055555576beb8 in FletX (args=XIL(0x5555616dd7a3)) at eval.c:1042
#21 0x000055555576f82d in eval_sub (form=XIL(0x5555616dd793)) at eval.c:2549

(gdb) frame 3
#3  0x000055555566e1a0 in tty_write_glyphs (f=0x555562caa780, string=0x55555fb81720, len=80) at term.c:819
(gdb) p *f
$1 = {
  header = {
    size = 4611686018595348501
  },
  name = XIL(0x55555ffbf4a4),
  icon_name = XIL(0),
[…]
  text_cols = 80,
  text_lines = 4,
  text_width = 80,
  text_height = 4,
  total_cols = 80,
  total_lines = 4,
  pixel_width = 80,
  pixel_height = 4,
  new_width = -1,
  new_height = -1,
[…]

(gdb) p *((struct window*) f->selected_window)
$6 = {
  header = {
    size = 6152702861785432064
  },
  frame = XIL(0x55),
  next = XIL(0x5562caa9a5000000),
  prev = XIL(0x556252b675000055),
  parent = XIL(0xfff21ef0c7000055),
  normal_lines = XIL(0xfff2ba75bf00007f),
  normal_cols = XIL(0x1a00007f),
  new_total = XIL(0),
  new_normal = XIL(0x1a000000),
  new_pixel = XIL(0x5559e3af55000000),
  contents = XIL(0x5559e3af55000055),
  old_buffer = XIL(0x555f92c855000055),
  start = XIL(0x5559d0c41d000055),
  pointm = XIL(0x55604735d5000055),
  old_pointm = XIL(0xa000055),
  temslot = XIL(0),
  vertical_scroll_bar = XIL(0x30000000),
  vertical_scroll_bar_type = XIL(0),
  horizontal_scroll_bar = XIL(0x30000000),
  horizontal_scroll_bar_type = XIL(0),
  display_table = XIL(0),
  dedicated = XIL(0),
  combination_limit = XIL(0x5562913c43000000),
  window_parameters = XIL(0x30000055),
  cursor_type = XIL(0x555fcf7c94000000),
  mode_line_help_echo = XIL(0x5562966770000055),
  current_matrix = 0x5562a39930000055,
  desired_matrix = 0x55641a3233000055,
  prev_buffers = XIL(0x55),
  next_buffers = XIL(0x3cb000000),
  use_time = 3019898880,
  sequence_number = 3103784960,
  change_stamp = 117440512,
  pixel_left = 0,
  pixel_top = 117440512,
  left_col = 1342177280,
  top_line = 100663296,
  pixel_width = 100663296,
  pixel_height = 335544320,
  old_pixel_width = 100663296,
  old_pixel_height = 318767104,
  old_body_pixel_width = 1342177280,
  old_body_pixel_height = 100663296,
  total_cols = 0,
  total_lines = 0,
  hscroll = 0,
  min_hscroll = 0,
  hscroll_whole = 0,
  last_modified = 0,
  last_overlay_modified = 4144676995072,
  last_point = 3548213411840,
  last_mark = 0,
  base_line_number = 0,
  base_line_pos = -16777216,
  column_number_displayed = 72057594071482367,
  nrows_scale_factor = 16777216,
  ncols_scale_factor = 150994944,
  cursor = {
    x = 16777216,
--Type <RET> for more, q to quit, c to continue without paging--
    y = 150994944,
    hpos = 0,
    vpos = 0
  },
  phys_cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = 0
  },
  output_cursor = {
    x = 0,
    y = 0,
    hpos = 150994944,
    vpos = -16777216
  },
  last_cursor_vpos = -1,
  left_fringe_width = 16777215,
  right_fringe_width = 0,
  left_margin_cols = -16777216,
  right_margin_cols = -1,
  scroll_bar_width = 33554431,
  scroll_bar_height = -16777216,
  mode_line_height = -1,
  header_line_height = -2080374785,
  tab_line_height = 352,
  window_end_pos = 1441151881060548608,
  window_end_vpos = 260,
  mini = false,
  horizontal = false,
  update_mode_line = false,
  last_had_star = false,
  start_at_line_beg = false,
  force_start = false,
  optional_new_start = false,
  phys_cursor_on_p = false,
  cursor_off_p = false,
  last_cursor_off_p = false,
  must_be_updated_p = false,
  pseudo_window_p = false,
  fringes_outside_margins = false,
  fringes_persistent = false,
  scroll_bars_persistent = false,
  window_end_valid = false,
  redisplay = false,
  suspend_auto_hscroll = false,
  preserve_vscroll_p = false,
  vscroll = 419430400,
  window_end_bytepos = 281543696187392
}
(gdb) p *((struct window*) f->root_window)
$7 = {
  header = {
    size = 6152702861785432064
  },
  frame = XIL(0x55620a01ed000055),
  next = XIL(0x55),
  prev = XIL(0),
  parent = XIL(0xfff2ba41a7000000),
  normal_lines = XIL(0xfff2ba419f00007f),
  normal_cols = XIL(0x3600007f),
  new_total = XIL(0),
  new_normal = XIL(0x36000000),
  new_pixel = XIL(0x5562caa9a5000000),
  contents = XIL(0x55599fab25000055),
  old_buffer = XIL(0x55),
  start = XIL(0),
  pointm = XIL(0),
  old_pointm = XIL(0x2000000),
  temslot = XIL(0),
  vertical_scroll_bar = XIL(0x30000000),
  vertical_scroll_bar_type = XIL(0),
  horizontal_scroll_bar = XIL(0x30000000),
  horizontal_scroll_bar_type = XIL(0),
  display_table = XIL(0),
  dedicated = XIL(0),
  combination_limit = XIL(0),
  window_parameters = XIL(0x30000000),
  cursor_type = XIL(0),
  mode_line_help_echo = XIL(0),
  current_matrix = 0x0,
  desired_matrix = 0x555d5785a3000000,
  prev_buffers = XIL(0x55),
  next_buffers = XIL(0x290000000),
  use_time = 3003121664,
  sequence_number = 100663296,
  change_stamp = 0,
  pixel_left = 0,
  pixel_top = 0,
  left_col = 1342177280,
  top_line = 218103808,
  pixel_width = 1207959552,
  pixel_height = 805306368,
  old_pixel_width = 1207959552,
  old_pixel_height = 788529152,
  old_body_pixel_width = 1342177280,
  old_body_pixel_height = 218103808,
  total_cols = 0,
  total_lines = 0,
  hscroll = 0,
  min_hscroll = 0,
  hscroll_whole = 36758880256,
  last_modified = 3741319168,
  last_overlay_modified = 1599271337984,
  last_point = 1589456666624,
  last_mark = 18740150272,
  base_line_number = 0,
  base_line_pos = 989855744,
  column_number_displayed = 72057594054705152,
  nrows_scale_factor = 0,
  ncols_scale_factor = 0,
  cursor = {
    x = 0,
--Type <RET> for more, q to quit, c to continue without paging--
    y = 0,
    hpos = 0,
    vpos = 0
  },
  phys_cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = 0
  },
  output_cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = -16777216
  },
  last_cursor_vpos = -1,
  left_fringe_width = 16777215,
  right_fringe_width = 0,
  left_margin_cols = -16777216,
  right_margin_cols = -1,
  scroll_bar_width = 33554431,
  scroll_bar_height = -16777216,
  mode_line_height = -1,
  header_line_height = 16777215,
  tab_line_height = 0,
  window_end_pos = 1152921504606846976,
  window_end_vpos = 0,
  mini = false,
  horizontal = false,
  update_mode_line = false,
  last_had_star = false,
  start_at_line_beg = false,
  force_start = false,
  optional_new_start = false,
  phys_cursor_on_p = false,
  cursor_off_p = false,
  last_cursor_off_p = false,
  must_be_updated_p = false,
  pseudo_window_p = false,
  fringes_outside_margins = false,
  fringes_persistent = false,
  scroll_bars_persistent = false,
  window_end_valid = false,
  redisplay = false,
  suspend_auto_hscroll = false,
  preserve_vscroll_p = false,
  vscroll = 1191182336,
  window_end_bytepos = 6152702647217422336
}




On Fri, 31 May 2024 at 18:18, Eli Zaretskii <eliz@gnu.org> wrote:
> From: Daniel Clemente <n142857@gmail.com>
> Date: Fri, 31 May 2024 17:07:45 +0000
> Cc: 71289@debbugs.gnu.org
>
> > Thanks, but these backtraces are not enough, because they don't
> > explain why was emacs_abort called.  We need to see all the values
> > involved in this condition:
> >
> >  if (curX (tty) == FrameCols (tty))
> >    {
> >      if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) <<<<<<<<<<<
> >        emacs_abort ();
>
>
> These were the variables just before emacs_abort, and (abort==1) when aborting.
>
> At point cmcheckmagic, ¿abort? 0. MagicWrap 1, curY 0, vs. 3 - 1. Now
> tty has 3 rows, 14 cols
> At point cmcheckmagic, ¿abort? 0. MagicWrap 1, curY 1, vs. 3 - 1. Now
> tty has 3 rows, 14 cols
> At point cmcheckmagic, ¿abort? 1. MagicWrap 1, curY 3, vs. 3 - 1. Now
> tty has 3 rows, 14 cols

So you are saying that the terminal lies to us?  It has 3 rows, but
somehow wraps the cursor to the 4th row?  What are the window and
frame dimensions at this point?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]