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]