- Before invoking the debugger. make sure you compiled your program (all its modules, as well as during linking) with the "-g" flag.
- Compile the http://siber.cankaya.edu.tr/OperatingSystems/cfiles/debugme.c debugme.c program, and then invoke "gdb" to debug it:
$gcc -g debugme.c -o debugme
$gdb debugme
Note that we run the program from the same directory it was compiled in, otherwise gdb won't find the source file, and thus won't be able to show us where in the code we are at a given point. It is possible to ask gdb to search for extra source files in some directory after launching it, but for now, it's easier to just invoke it from the correct directory.
Cem Ozdogan
2011-02-14