GDB, The GNU Project Debugger

Every serious project development makes use of a debugger. Such a tool allows the programmer to examine her program, running it step by step, display/change values etc.

GDB is a debugger for programs written in C, C++, Objective-C, Pascal (and other languages). It will help you to track and fix bugs in your project. Don’t forget to pass the option -g (or -ggdb, depending on your linker’s abilities to handle GDB extensions) to your compiler to include useful information into the debugged program.

Pay attention when debugging a libtoolized program, as it may be a shell script wrapper around the real binary. Thus don’t use

$ gdb tc

or expect errors from GDB when running the program. Use libtool’s --mode=execute option to run gdb instead:

$ libtool --mode=execute gdb tc

or the following shortcut:

$ libtool exe gdb tc

Detailed explanations can be found in the Libtool manual.