unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Test to determine character left-overhangs a tab stretch.
Date: Tue, 13 Nov 2018 11:11:49 -0800	[thread overview]
Message-ID: <m27ehgn66i.wl%esq@lawlist.com> (raw)

I was able to locate the exact location where the tab stretch is being redrawn when I place a fake cursor on the following character; however, my test is causing Emacs to crash.  I tried putting in two additional checks in an effort to void a crash (first_glyph != NULL && first_glyph->type != NULL), but the crash still occurs.  Any pointers on how to refine my test to avoid crashing Emacs would be greatly appreciated.  A partial GDB printout follows the relevant xdisp.c snippet below.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; xdisp.c snippet

      /* Prepend glyph strings for glyphs in front of the first glyph
	 string that are overwritten because of the first glyph
	 string's left overhang.  The background of all strings
	 prepended must be drawn because the first glyph string
	 draws over it.  */
      i = left_overwritten (head);

      bool skip_p = false;
      int beg = i;
      if (w->mc.glyph_flavor == MC_GLYPH
          || w->mc.glyph_flavor == MC_GLYPHLESS
          || w->mc.glyph_flavor == MC_GLYPH_TAB)
        while (beg < start)
          {
            struct glyph *first_glyph = (row)->glyphs[area] + beg;
            if (first_glyph != NULL
                && first_glyph->type != NULL)
              {
                 switch (first_glyph->type)
                {
                  case CHAR_GLYPH:
                    break;
                  case COMPOSITE_GLYPH:
                    break;
                  case STRETCH_GLYPH:
                    {
                      skip_p = true;
                      break;
                    }
                  case IMAGE_GLYPH:
                    break;
                }
              }
            beg += 1;
          }

      if (i >= 0
          && !skip_p)
	{
	  enum draw_glyphs_face overlap_hl;

	  /* If this row contains mouse highlighting, attempt to draw
	     the overlapped glyphs with the correct highlight.  This
	     code fails if the overlap encompasses more than one glyph
	     and mouse-highlight spans only some of these glyphs.
	     However, making it work perfectly involves a lot more
	     code, and I don't know if the pathological case occurs in
	     practice, so we'll stick to this for now.  --- cyd  */

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; GDB

Program received signal SIGSEGV, Segmentation fault.
0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, 
    area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0)
    at xdisp.c:31453
warning: Source file is more recent than executable.
31453	                {

(gdb) bt
#0  0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, 
    area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0)
    at xdisp.c:31453
#1  0x00000001000a9361 in draw_phys_cursor_glyph (w=0x11e373c30, 
    row=0x102f6fa00, hl=DRAW_CURSOR) at xdisp.c:34272
#2  0x00000001002c2828 in ns_draw_window_cursor (w=0x11e373c30, 
    glyph_row=0x102f6fa00, x=165, y=444, cursor_type=BAR_CURSOR, 
    cursor_width=1, on_p=true, active_p=true) at nsterm.m:3077

* * *

(gdb) frame 0
#0  0x000000010009c6cb in draw_glyphs (w=0x11e373c30, x=186, row=0x102f6fa00, 
    area=TEXT_AREA, start=15, end=16, hl=DRAW_CURSOR, overlaps=0)
    at xdisp.c:31453
31453	                {

(gdb) print first_glyph->type
Cannot access memory at address 0x1227fffb8

(gdb) print first_glyph
$1 = (struct glyph *) 0x1227fffb8



             reply	other threads:[~2018-11-13 19:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13 19:11 Keith David Bershatsky [this message]
2018-11-13 20:08 ` Test to determine character left-overhangs a tab stretch Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2018-11-14 18:25 Keith David Bershatsky
2018-11-13 20:57 Keith David Bershatsky
2018-11-14 15:33 ` Eli Zaretskii
2018-11-12 22:22 Keith David Bershatsky
2018-11-12  2:06 Keith David Bershatsky
2018-11-12 16:13 ` Eli Zaretskii

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=m27ehgn66i.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).