tags:

views:

236

answers:

5

I have learned C and I would like to start to improve open source software. I would like to hack away one irritating bug in GTK+. To see the bug I need to use Gedit.

How can I download the sources of GTK+ and gedit and compile both of them so that I can see where the bug is? And I have never used any debugger in Linux so is there somewhere a tutorial for that?

+8  A: 

You can get information about downloading and compiling of gedit here: http://projects.gnome.org/gedit/developers.html

My Debugger of choice is GDB: http://www.gnu.org/software/gdb/

GDB is a console application that may be hard to handle for a beginner. Try an IDE like Eclipse that provides a GUI to GDB.

Lennart
+1 beat me to it. ;)
Sam Hoice
I like cgdb. It is a ncurses wrapper for gdb.
liori
insight is another nice frontend for those who like a GUI.
McPherrinM
+3  A: 

The information on building and installing GTK+ should be here: http://www.gtk.org/development.html

The sources should be here: http://www.gtk.org/download-linux.html

You can check out gdb: http://www.gnu.org/software/gdb/ That's a pretty standard linux debugger. I would spend time with it on something simple first, or get an IDE that uses it. Learning gdb can be worth the time though.

Sam Hoice
+5  A: 

Almost all Linux debuggers are front-ends for or adaptations of the gdb debugger. You should therefore learn how to use this first, preferably by starting on small programs of your own construction, not giant FOSS codebases. The gdb manual, available from here is actually a pretty good tutorial.

anon
+1  A: 

gdb is a dinosaur which should long since have been made extinct. Debugging is one area where (gasp!) Windows beats Unix. Having got that off my chest, I advise you to start with the Data Display Debugger (DDD) graphical front end to gdb. Yes, the GUI is quaint, but you will be far more productive, quicker, than if you start with gdb.

Also don't overlook valgrind for finding and diagnosing memory errors. The KDE project actually mandates use of valgrind; I'm not sure about Gnome.

Norman Ramsey
A: 

It is possible that you won't see the bug if you download the latest gedit and gtk+ sources. It might be fixed in the latest sources or the latest sources might be different enough to not trigger your bug.

What Linux distribution are you running?

First of all I'd suggest consulting your distribution's bug database to see if someone has filed a similar bug. If you don't find anything, I'd suggest using your distribution's tools to obtain the source that corresponds to the binary that you have installed on your sytem (e.g. apt-get source libgtk-2.0 on Debian or Ubuntu).

Also, your distribution might also make a debug package available (e.g. libgtk2.0-0-dbg on Debian) which will let you run a debugger on the binary that you already have without requiring the source. While this is no substitute for having the sources, it can be useful for running valgrind or making sense out of a core file.

sigjuice
My distribution is Ubuntu. I once reported the bug and after a year I heard that the fix was released. But according to my tests, the bug is still there and I have updated my Ubuntu to the latest version by command sudo apt-get upgrade.