unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Daniel Clemente <n142857@gmail.com>
Cc: 71224@debbugs.gnu.org
Subject: bug#71224: 30.0.50; SIGSEGV in start_display
Date: Thu, 30 May 2024 15:05:29 +0300	[thread overview]
Message-ID: <86jzjbqzcm.fsf@gnu.org> (raw)
In-Reply-To: <CAJKAhPAnZXzUo-cWTbc1Hf1Rt2N-Z=379WhWWzgqmKWxG5SMAg@mail.gmail.com> (message from Daniel Clemente on Thu, 30 May 2024 09:55:20 +0000)

> From: Daniel Clemente <n142857@gmail.com>
> Date: Thu, 30 May 2024 09:55:20 +0000
> Cc: 71224@debbugs.gnu.org
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00005555555d772f in redisplay_window (window=XIL(0x555556d13e05),
> just_this_one_p=false) at xdisp.c:19961
> 19961     *w->desired_matrix->method = 0;
> 
> (gdb) pp window
> #<window 411 on *scratch*>
> 
> (gdb) list 19961
> 19956
> 19957      SET_TEXT_POS (lpoint, PT, PT_BYTE);
> 19958      opoint = lpoint;
> 19959
> 19960    #ifdef GLYPH_DEBUG
> 19961      *w->desired_matrix->method = 0;
> 19962    #endif
> 19963
> 19964      if (!just_this_one_p && needs_no_redisplay (w))
> 19965        return;

That's not what I hoped for, sadly.  It's the same problem, just
detected a bit earlier.  A window with NULL glyph matrices cannot be
redisplayed, period.  That's why leaf windows _must_ have glyph
matrices.

> Maybe we need more GLYPH_DEBUG assertions to catch null glyph matrices sooner?

Yes, but where?  I don't understand how this situation could happen,
so it's hard to think about a good place to add assertions.

> I see similar checks in dispnew.c, e.g.:
> eassert (current_matrix && desired_matrix);

This is too late: update_frame_1, where this assertion lives, is
called after redisplay_window did its job.

> A next step for me could be setting up a breakpoint (or message) in
> the place where the glyph matrix is defined, to see if it's ever being
> defined, vs. it's defined and then cleared. But I'm still learning
> about glyph matrices and I don't know where they're expected vs. where
> null.

AFAIK, the glyph matrices are assigned to windows on TTY frames in
allocate_matrices_for_frame_redisplay:

	  /* If not already done, allocate sub-matrix structures.  */
	  if (w->desired_matrix == NULL)
	    {
	      w->desired_matrix = new_glyph_matrix (f->desired_pool);
	      w->current_matrix = new_glyph_matrix (f->current_pool);
	      *window_change_flags |= NEW_LEAF_MATRIX;
	    }

And new_glyph_matrix cannot return NULL (if we run out of memory,
new_glyph_matrix will signal a "memory-full" error).

It might be possible that the glyph matrices of a window are somehow
freed later, perhaps in free_window_matrices.  But all these places
are run as part of deleting a window under block_input, so I don't
quite see how a window with NULL glyph matrices could have been used
for anything...

> I'm also trying to get better at gdb to detect when a variable (e.g.
> w->desired_matrix) changes.

You are talking about watchpoints.  Something like

  (gdb) watch -l w->current_matrix

If nothing else helps, try that.  But I suspect it will be hard to
find the window whose matrices to watch, and the problem is how to
distinguish between windows that are being killed in your high-speed
scenario and windows that are still being used.

Thanks.

P.S. If no other ideas are brought up, I can think about a simple
band-aid we could try: refrain from redisplaying a window that doesn't
have glyph matrices.





  reply	other threads:[~2024-05-30 12:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27 11:03 bug#71224: 30.0.50; SIGSEGV in start_display Daniel Clemente
2024-05-27 12:16 ` Eli Zaretskii
2024-05-28 15:36   ` Daniel Clemente
2024-05-28 15:55     ` Eli Zaretskii
2024-05-28 16:49       ` Daniel Clemente
2024-05-28 18:16         ` Eli Zaretskii
2024-05-28 18:45           ` Daniel Clemente
2024-05-28 19:17             ` Eli Zaretskii
2024-05-29  5:56               ` Daniel Clemente
2024-05-29 16:35                 ` Eli Zaretskii
2024-05-30  9:55                   ` Daniel Clemente
2024-05-30 12:05                     ` Eli Zaretskii [this message]
2024-06-07 16:08                       ` Daniel Clemente
2024-06-07 19:46                         ` Eli Zaretskii
     [not found]                           ` <CAJKAhPBdc2Og+UsgoCVwK_AOKnewdF5P3aV86Mr-FJOz4zNVvg@mail.gmail.com>
2024-06-10 16:30                             ` Eli Zaretskii
2024-06-12 13:47                               ` Daniel Clemente

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86jzjbqzcm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71224@debbugs.gnu.org \
    --cc=n142857@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).