RE: How to debug gtk application using gdb in Fedora



Yes. I want to debug into the gtk kernel. So I "enable-debug=yes".
I forget use LD_LIBRARY_PATH to load my compiled gtk library. After export this parameter, I can get into the gtk code.
I use ddd as my default gdb debug tool.

Thanks,
Frank

-----Original Message-----
From: jcupitt gmail com [mailto:jcupitt gmail com] 
Sent: 2010年4月14日 16:08
To: Huang, FrankR
Cc: gtk-list gnome org
Subject: Re: How to debug gtk application using gdb in Fedora

On 14 April 2010 08:14, Huang, FrankR <FrankR Huang amd com> wrote:
>             I want to know the gtk application call to the glib and gtk
> library, such as the gtk_init(). How to step into it?

Make sure you've built your program with the "-g" flag, then type
something like:

$ gdb myapp
(gdb) break gtk_init
(gdb) run

See: http://www.gnu.org/software/gdb/documentation

There are also plenty of GUI wrappers over gdb, such as kdbg or even
ddd. You might find them easier to use.

valgrind is very useful for debugging memory errors.

>             I have compiled the gtk+-2.18.9 with the option
> “—enable-debug=yes”.

You only need to do this if you want to debug the internals of gtk.
Even then, there are probably already debug versions of the libraries
in your package manager. Just build your program with -g.

John



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