REVIEW - The Art of Debugging with GDB, DDD, and Eclipse

Title:

The Art of Debugging with GDB, DDD, and Eclipse

Author:

Norman Matloff, Peter Jay Salzman

ISBN:

9781593272319

Publisher:

No Starch Press (2008)

Pages:

280pp

Reviewer:

Ian Bruntlett

Reviewed:

January 2020

Rating:

★★★★☆

I have, in my time, debugged programs in a variety of ways and debuggers. I bought this book to become familiar with the debuggers in the GNU toolchain – that is gdb and ddd – but this book also covers the Eclipse IDE. A Linux/Unix-like environment and the C programming language is assumed although some coverage of C++ in the main text and some coverage of Java, Perl, and, Python is present in the final chapter.

Chapter 1, ‘Some Preliminaries for Beginners and Pros’, is well-meaning but I found its example (of an insert sort) to be confusingly written and a bad example to beginner coders. Also, the text refers to source code line numbers heavily so it would have been helpful to have line numbers for that example. However, the source code of examples is available for downloading so this is less of a problem (see nostarch.com/debugging.htm).

Chapter 2, ‘Stopping to take a look around’, is about breakpoints which can not only act as breakpoints but also as watch points and catch points. However, you will need to see the GNU gdb documentation to get info on catch points.

Chapter 3, ‘Inspecting and Setting Variables’, has an example of using a binary tree to sort input data. Whilst the examples given are good for debugging they make serious design compromises, presumably in the interest of demonstrating the debugger’s facilities.

Chapter 4, ‘When a Program Crashes’, goes into detail about how Linux handles virtual memory and has an extensive debugging session fixing a badly broken C string handling library.

Chapter 5, ‘Debugging in a Multiple-Activities Context’, covers client/server network programs, multi-threading and parallelprogramming, all of which are currently out of my depth.

Chapter 6, ‘Special Topics’, covers syntax errors, shared and dynamic libraries, and debugging curses programs.

Chapter 7, ‘Other Tools’, covers how text editors (vim in this case), the compiler, strace, ltrace, static code checkers (e.g. splint – C only) can all be used to prevent or deal with bugs and finishes off with a section on debugging dynamically allocated memory (malloc etc, free) using tools like Electric Fence, mtrace and MALLOC_CHECK_.

Chapter 8, ‘Using GDB/DDD/Eclipse for Other Languages’, covers Java, Perl, Python, SWIG, and (32-bit Intel) assembly language debugging.

A good book, especially if used alongside the dedicated manuals available for the tools covered here (www.gnu.org/manual/manual.html is a good place to start). You will need a background in C and Linux/Unix to get the most out of this book.