Re: how to debug this error by gdb?

Eli Zaretskii
2009-05-11T03:12:04Z

> Date: Mon, 11 May 2009 10:34:52 +0800
> From: =?ISO-2022-JP?B?GyRCTEBrNBsoQg==?= <shi.minjue@gmail.com>
>
> ---------------------------------------------------------------------------------------
> PUBLIC void glXWaitX(void)
> {
> ......
> if (psc->driScreen->waitX != NULL)
> [line 660] (*psc->driScreen->waitX)(pdraw);
> .....
> }
> ---------------------------------------------------------------------------------------
>
>
> and here is the gdb info:
> ---------------------------------------------------------------------------------------
> (gdb) break glxcmds.c:660
> Breakpoint 1 (glxcmds.c:660) pending.
> (gdb) run
> Breakpoint 1, glXWaitX () at glxcmds.c:660
> (gdb) print psc->driScreen->waitX
> $3 = (void (*)(__GLXDRIdrawable *)) 0x47206769666e6f63
^^^^^^^^^^^^^^^^^^
This looks like ASCII text to me ("config G", little-endian). So I'd
try to see if some code that runs before this place could overflow
some buffer with plain text, and part of that text spilled into this
pointer.

> (gdb) print *psc->driScreen->waitX
> Cannot access memory at address
> (gdb) step
> Program received signal SIGSEGV, Segmentation fault.

Right, because it's not NULL, but not a valid pointer, either. Thus a
SIGSEGV.