Subject: bug#11813: Segmentation fault on launch related to x_draw_glyph_string_background

From: Eli Zaretskii <[email-masked]>
Date: Fri, 29 Jun 2012 12:02:46 +0300

[Please keep the bug address on the CC list, so that this discussion
is archived with the bug report.]

> Date: Fri, 29 Jun 2012 10:22:20 +0300
> From: Left Right <[email-masked]>
> 
> Program received signal SIGSEGV, Segmentation fault.
> x_draw_glyph_string_background (s=0x7fffffffcb60, force_p=1) at xterm.c:1210
> 1210          else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
> (gdb) print s->font
> $1 = (struct font *) 0x0
> (gdb) print s->height
> $2 = 25
> (gdb) print box_line_width
> $3 = 0
> (gdb) print *s->font
> Cannot access memory at address 0x0
> (gdb) print s
> $4 = (struct glyph_string *) 0x7fffffffcb60
> (gdb) print *s
> $5 = {
>   x = 82,
>   y = 631,
>   ybase = 649,
>   width = 288,
>   background_width = 288,
>   height = 25,
>   left_overhang = 0,
>   right_overhang = 0,
>   f = 0x1147010,
>   w = 0x1148020,
>   display = 0x12f5b70,
>   window = 46137470,
>   row = 0xbccc50,
>   area = TEXT_AREA,
>   char2b = 0x0,
>   nchars = 12,
>   hl = DRAW_NORMAL_TEXT,
>   face = 0x1312850,
>   font = 0x0,
>   cmp = 0x0,
>   cmp_id = 0,
>   cmp_from = 0,
>   cmp_to = 0,
>   extends_to_end_of_line_p = 0,
>   background_filled_p = 0,
>   two_byte_p = 0,
>   font_not_found_p = 0,
>   stippled_p = 0,
>   for_overlaps = 0,
>   padding_p = 0,
>   gc = 0x12e1660,
>   first_glyph = 0xbf60b0,
>   img = 0x0,
>   slice = {
>     x = 0,
>     y = 0,
>     width = 0,
>     height = 0
>   },
>   clip_head = 0x0,
>   clip_tail = 0x0,
>   clip = {{
>       x = 1,
>       y = 631,
>       width = 840,
>       height = 25
>     }, {
>       x = 0,
>       y = 0,
>       width = 0,
>       height = 0
>     }},
>   num_clips = 1,
>   underline_position = 0,
>   underline_thickness = 0,
>   next = 0x7fffffffca60,
>   prev = 0x7fffffffcd00
> }
> 
> Hi, yes, it looks like it. Sorry, I'm neither very familiar with the
> code nor with gdb. The above is what I could get, but if it's not
> enough, please tell where to look.

Please type "bt full" at the GDB prompt when Emacs crashes, and post
here the results.  (If you type "set logging on" before that, GDB will
output everything to a file named gdb.txt in the directory where you
run it, so you won't need to copy from the screen.)

Also, if you built Emacs with optimizations, please reconfigure and
rebuild like this:

  CFLAGS='-O0 -ggdb -g3' ./configure --enable-checking --enable-asserts ...
  make

(where "..." stands for any other options you use with configure).
This is because backtraces from optimized builds are deceptive and
make debugging hard.  If you do make a new build without
optimizations, please make sure it crashes like the optimized one.

Thanks.