I would like to run a GTK+/C program line by line with some debugger. I have never debugged a Linux program so where can I find instructions to a very beginner on how to debug code? I have just an idea that I have to download the sources from net, compile the project with debug symbols and run sources through DDD or GDB. So can anyone give suggestions how to start studying these subjects and what could be a good debugger to start? I have at least time to learn things.
Also look into nemiver besides DDD, they are good at different things but nemiver is coming along very nicely.
PS. If you're on Ubuntu and you want to step through an application that's installed from the package repository, let's called it some_package, then do this:
7A. run "debuild -us -uc -b" to compile the source into a fresh installable .DEB file compiled in release mode WITHOUT debug information
or (and this is the central part):
7B. run "MAKEFLAGS=-j6 DEB_BUILD_OPTIONS="nostrip noopt parallel=5" CFLAGS="-g3 -O0" debuild -us -uc" to build a deb in debug mode WITH debug information
Of course, you could optionally modify the code between steps 6 and 7. The nice thing about this method is that it works for pretty much any application. You can use it for Firefox, the Linux kernel, the mesa stack or whatever.
Look into using GDB and compiling with gcc -g, or using another debugger.
http://www.sourceware.org/current/onlinedocs/gdb_toc.html
Full gdb user manual online.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.