This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:
Matloff N., Salzman P.
The Art of Debugging with GDB, DDD, and Eclipse
No Starch Press, San Francisco, CA, 2008.
Together with programming, debugging is a skill we develop through experience. However, while we can become better programmers by studying algorithms, data structures, implementation patterns, style guides, application programming interfaces (APIs), and even existing open-source code, there are few resources we can tap into to improve our debugging abilities. Matloff and Salzmanís book fills this gap by presenting three powerful debugging tools, background knowledge, and essential techniques.
The three tools discussed in the book span the whole range of tool support for debugging. GDB is a command-line based tool that is difficult to master, but can be extremely powerful. DDD provides a graphical user interface (GUI) front end to GDB; thus, DDD is a reasonable compromise between power and usability. Eclipse, as a full-featured integrated development environment (IDE), provides additional facilities that cover more software development activities.
The book starts with a discussion of debugging techniques, an overview of the tools, a comparison of their distinct interfaces, and a sample of a debugging session performed on each of them. This allows readers to decide which tool is most appropriate for them.
The bookís main part covers in detail the facilities typically used for debugging programs: breakpoints, watchpoints, variable inspection, and examining a failed programís memory image (core dump). Each topic includes both simple and detailed examples that cover GDB, DDD, and Eclipse. The text then moves on to more advanced topics, including: the debugging of threaded code, parallel applications, GUI programs, and debugger-specific quirks. Where required, the authors present the theory behind a particular behavior, such as a memory protection fault.
Somewhat paradoxically for a book with a title that focuses on three specific tools, the text also covers other important debugging tools: text editor, compiler, Cís error reporting, strace, ltrace, splint, and electric fence. I would have liked to see valgrind and dtrace included in the presentation. The book ends with a discussion of how DDD, GDB, and Eclipse can be used to debug code written in Java, Perl, Python, SWIG, and assembly.
C programmers working on Unix systems will benefit the most from reading this book, but many others will learn valuable techniques and tricks.