emacs-devel
[Top][All Lists]
Advanced

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

Re: display word wrapping


From: Eli Zaretskii
Subject: Re: display word wrapping
Date: Sun, 30 May 2004 20:27:40 +0200

> Date: Sun, 30 May 2004 18:50:27 +0200
> From: Juanma Barranquero <address@hidden>
> 
> Yes, it is a crash. No, it fails the same way under debugging.

So we are lucky ;-)

> > Finally, assuming that we are talking about a crash, posting the
> > detailed description of the crash (exception number, register dump,
> > stack dump, etc.) here could give some further ideas.

[I apologize in advance if I'm going to say things that you already
know.]
 
> When I try to load a 811-byte .gif, I get:
> 
>   Unhandled exception at 0x0106dd08 in emacs.exe: 0xC0000005: Access
>   violation reading location 0x00000004.

This means Emacs tried to dereference an invalid pointer and read from
the invalid address.  Exception 0xC0000005 is Page Fault, the Windows
equivalent of SIGSEGV, and the bad address is 0x4 (a.k.a. a NULL
pointer).

> The stack trace is:
> 
>   image_spec_value(int spec=-536870912, int key=557610632, int * 
> found=0x00000000) Line 931 + 0x8     C
>   lookup_image(frame * f=0x015dbe00, int spec=-1572937664) Line 1682  C
> [...]
> lookup_image is calling image_spec_value with the following code:
> 
>         if (! img->background_valid)
>           {
>             bg = image_spec_value (img->spec, QCbackground, NULL);
>             if (!NILP (bg))
>               {
>                 img->background
>                   = x_alloc_image_color (f, img, bg,
>                                          FRAME_BACKGROUND_PIXEL (f));
>                 img->background_valid = 1;
>               }
>           }
> 
> At that point, img->spec is not valid.

How exactly is img->spec invalid?  Can you post the details (xtype
etc.)?

> Previously, img has been
> initialized from spec (the arg passed to the function), so spec and
> img->spec should be equal, but they aren't anymore. If you change the
> call to do
> 
>  bg = image_spec_value (spec, QCbackground, NULL);
> 
> it succeeds

If you think that img->spec is somehow clobbered in between the point
where it is computed and the point where image_spec_value is called,
the way to see who is clobbering it is to put a data breakpoint
(a.k.a. watchpoint) on img->spec, and see when that watchpoint
triggers.

> On optimized code, img is not on the stack, but on a register. In fact,
> if I change
> 
>   struct image *img;
> 
> to
> 
>   static struct image *img;
> 
> Emacs works fine.

If you change it to

   volatile struct image *img;

does the problem go away as well?

> So it looks like it *is* really a bug in the optimizer
> code, which is clobbering a register or something like that.

If the clobbered pointer is in a register, then data breakpoint will
not help, but you could still do it by single-stepping the program and
looking for a line in the code where the value of that register is
clobbered.  This could be a bit tedious, but it's simple and
straightforward, and will probably reveal some real bug in the code
(the possibility of a bug in the compiler's optimizer exists, but I
think it's only a distant second).




reply via email to

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