emacs-devel
[Top][All Lists]
Advanced

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

Debugging printing to stderr prior glyph row values ....


From: Keith David Bershatsky
Subject: Debugging printing to stderr prior glyph row values ....
Date: Wed, 22 May 2019 21:14:01 -0700

I am working on feature requests 22873 (multiple fake cursors) and 17684 
(crosshairs that track the cursor position).

I am having trouble preventing Emacs from occasionally crashing when printing 
messages to stderr while update_window is occurring, which makes debugging 
other issues more difficult than necessary.

update_window processes one glyph row at a time using the w->desired_matrix; 
and, feature requests 22873/17684 use both the desired/current matrices.

My best guess is that the problem lies here:

(gdb) print previous_row__last_glyph
$9 = (struct glyph *) 0x11f7fffb0

(gdb) print previous_row__last_glyph->charpos
Cannot access memory at address 0x11f7fffd0

Some suggestions regarding how to prevent Emacs from crashing would be greatly 
appreciated.  A full bt of frame 0 follows at the end of this post.

  struct glyph *previous_row__penultimate_glyph
    = (vpos == 0)
        ? NULL
      : (!(row - 1)->enabled_p)
        ? NULL
      : ((row - 1)->used[TEXT_AREA] > 1)
        ? (row - 1)->glyphs[TEXT_AREA] + (row - 1)->used[TEXT_AREA] - 2
      : NULL;

  struct glyph *previous_row__last_glyph
    = (vpos == 0)
        ? NULL
      : (!(row - 1)->enabled_p)
        ? NULL
      : (row - 1)->glyphs[TEXT_AREA] + (row - 1)->used[TEXT_AREA] - 1;

  struct glyph *penultimate_glyph
    = (row->used[TEXT_AREA] < 1)
      ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 2
      : NULL;

  struct glyph *last_glyph
    = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;

  fprintf (stderr, "\nA.  vpos (%d) | glyph->charpos (%d) | posint (%d) | mc_zv 
(%d) | mc_zv_byte (%d)\n\
  row - 1:  penultimate_charpos (%d) | last_charpos (%d) | ends_at_zv_p (%s)\n\
  row - 1:  start/end_bytepos (%d/%d) | start/end_charpos (%d/%d)\n\
  row_at_zv_p (%s) | row_beyond_zv_p (%s)\n\
  row:  penultimate_charpos (%d) | last_charpos (%d) | ends_at_zv_p (%s)\n\
  row:  start/end_bytepos (%d/%d) | start/end_charpos (%d/%d)\n",
    vpos, start->charpos, posint, mc_zv, mc_zv_byte,
    previous_row__penultimate_glyph != NULL
      ? previous_row__penultimate_glyph->charpos
      : -1,
    previous_row__last_glyph != NULL
      ? previous_row__last_glyph->charpos
      : -1,
      (row - 1)->ends_at_zv_p ? "y" : "n",
    MATRIX_ROW_START_BYTEPOS (row - 1), MATRIX_ROW_END_BYTEPOS (row - 1),
      MATRIX_ROW_START_CHARPOS (row - 1), MATRIX_ROW_END_CHARPOS (row - 1),
    row_at_zv_p ? "y" : "n", row_beyond_zv_p ? "y" : "n",
    penultimate_glyph != NULL
      ? penultimate_glyph->charpos
      : -1,
    last_glyph->charpos, row->ends_at_zv_p ? "y" : "n",
    MATRIX_ROW_START_BYTEPOS (row), MATRIX_ROW_END_BYTEPOS (row),
      MATRIX_ROW_START_CHARPOS (row), MATRIX_ROW_END_CHARPOS (row));

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(gdb) print previous_row__penultimate_glyph
$8 = (struct glyph *) 0x0

(gdb) print previous_row__last_glyph
$9 = (struct glyph *) 0x11f7fffb0

(gdb) print previous_row__last_glyph->charpos
Cannot access memory at address 0x11f7fffd0

(gdb) print *previous_row__last_glyph
Cannot access memory at address 0x11f7fffb0

(gdb) print last_glyph
$10 = (struct glyph *) 0x11fa46200

(gdb) print last_glyph->charpos
$11 = -1

(gdb) print penultimate_glyph
$12 = (struct glyph *) 0x0

(gdb) bt full

#0  0x0000000100045d1b in mc_draw_row (w=0x1088ef048, matrix=0x106ddb0a0, 
    row=0x11d1b2e00, start=0x11fa46200, x=0, hpos_length=1, vpos=8, 
    bottom_vpos=113, active_p=true, cursor_matrix=0x106be6580, fc_x=770, 
    ch_foreground=..., fc_foreground=..., mc_zv=16, mc_zv_byte=16, 
    draw_p=true, from_where=SCRIBE_ONE) at xdisp.c:4604
        hpos = 0
        previous_glyph = 0x0
        skip_p = false
        posint = -1
        specs = {
          i = 0
        }
        hpos_start = 0
        window = {
          i = 4438552653
        }
        f = 0x10388f1a0
        buf = {
          i = 4354225669
        }
        b = 0x103883600
        opoint_fx = 1
        opoint_fy = 143585352
        opoint_wd = 1
        opoint_h = 488320512
        text_area_width = 975
        header_line_format = 24
        previous_row__penultimate_glyph = 0x0
        previous_row__last_glyph = 0x11f7fffb0
        penultimate_glyph = 0x0
        last_glyph = 0x11fa46200
        row_at_zv_p = false
        row_beyond_zv_p = true
        cursor_row = 0x11fa17100
        cursor_glyph = 0x11fa236b0
        cursor_at_fringe_p = false
        cursor_beyond_fringe_p = false
        bg_face_id = DEFAULT_FACE_ID
        cursor_bg = {
          red = 0, 
          green = 0, 
          blue = 0
        }
        lisp_type = {
          i = 24336
        }
        cursor_type = MC_HOLLOW_BOX
        cursor_width = -1
        cursor_face_id = 36
        cursor_face = 0x100f0fc30
        cursor_color = {
          i = 4299532436
        }
        cursor_fg = {
          red = 0, 
          green = 1, 
          blue = 1
        }
        fill_column_trumps_p = false



reply via email to

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