This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: how to debug this error by gdb?
- From: Eli Zaretskii <eliz at gnu dot org>
- To: 明覺 <shi dot minjue at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 11 May 2009 06:11:56 +0300
- Subject: Re: how to debug this error by gdb?
- References: <6a8fced30905101934j2aa94d27i210484a99a523ce5@mail.gmail.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> 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.