A GDB Tutorial

Before coming to Lisp, I spent many many years writing C code. Despite the disrepute that C has fallen into with some of those damn kids playing on my lawn, I think it’s a really great language for the problems in its domain—certainly superior to C++, no matter what they tell you. In any event, if you’re a C (or C++ or other GCC-based language) programmer, one of the handiest debugging tools at your disposal is GDB, the Gnu Debugger.

The problem is that GDB can be a bit intimidating for the uninitiated. Happily, Ryan Schmidt wrote a nice tutorial to get you started. It’s written in a question/answer format and takes you through all the basic operations. After he discusses the commands there are a couple of examples that show you how to actually work with the debugger.

Emacs users will, of course, want to use the Emacs interface to GDB. It’s separate from GUD (the Grand Unified Debugger) and has a nice multi-window IDE-like presentation. For more information, visit the online documentation for it with【Ctrl+h Fgdb (note the capital F).

Non-Emacs users might want to look at cgdb, a split-screen, terminal-based interface to GDB. I haven’t used it but it looks quite nice from the Web site.

Update: 【Ctrl+x F】 → 【Ctrl+h F

This entry was posted in Programming and tagged . Bookmark the permalink.