This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Meaningful backtrace from your debugger if you break on the gdk_x_error
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Elvis Wong <mixtape_qc at yahoo dot ca>
- Cc: gdb at sourceware dot org
- Date: Tue, 15 Dec 2009 21:32:42 -0800
- Subject: Re: Meaningful backtrace from your debugger if you break on the gdk_x_error
- References: <288652.4520.qm@web112014.mail.gq1.yahoo.com>
On Mon, Dec 14, 2009 at 7:45 AM, Elvis Wong <mixtape_qc@yahoo.ca> wrote:
> Hi all, im new to gdb.
>
> I try to debug an application that crash;
>
> here what i try;
>
> $ gdb --args test --sync
>
> (gdb) break gdk_x_error
> Function "gdk_x_error" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (gdk_x_error) pending
>
> (gdb) run
> ....snip....
>
> The program 'test' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadAlloc (insufficient resources for operation)'.
> ?(Details: serial 15391 error_code 11 request_code 53 minor_code 0)
> ?(Note to programmers: normally, X errors are reported asynchronously;
> ? that is, you will receive the error a while after causing it.
> ? To debug your program, run it with the --sync command line
> ? option to change this behavior. You can then get a meaningful
> ? backtrace from your debugger if you break on the gdk_x_error() function.)
> [Thread 0xb7e1ab70 (LWP 7469) exited]
> [Thread 0xb7125b70 (LWP 7470) exited]
> [Thread 0xb691fb70 (LWP 7471) exited]
> [Thread 0xb611eb70 (LWP 7472) exited]
> [Thread 0xb3e02b70 (LWP 7482) exited]
> [Thread 0xb57ffb70 (LWP 7485) exited]
> [Thread 0xb3601b70 (LWP 7486) exited]
>
> Program exited with code 01.
> (gdb) bt
> No stack.
The program has *exited*, there is no stack!
> (gdb) i r
> The program has no registers now.
>
> How can i catch this bug?
Set a breakpoint on main. Run. When the breakpoint is hit, set a
breakpoint on gdk_x_error which by that time should be known to GDB
(i.e. you should not get a "pending" breakpoint at that point). If
gdk_x_error isn't known, you probably have stripped gdk libraries; try
setting breakpoint on _XError instead.
Good luck!
--
Paul Pluzhnikov