Art of Debugging

The Art of Debugging
with GDB, DDD, and Eclipse
Norman Matloff and Peter Jay Salzman
September 2008, 280 pp.

Debugging is crucial to successful software development, but even many experienced programmers find it challenging. Sophisticated debugging tools are available, yet it may be difficult to determine which features are useful in which situations. The Art of Debugging is your guide to making the debugging process more efficient and effective.

The Art of Debugging illustrates the use three of the most popular debugging tools on Linux/Unix platforms: GDB, DDD, and Eclipse. The text-command based GDB (the GNU Project Debugger) is included with most distributions. DDD is a popular GUI front end for GDB, while Eclipse provides a complete integrated development environment.

In addition to offering specific advice for debugging with each tool, authors Norm Matloff and Pete Salzman cover general strategies for improving the process of finding and fixing coding errors, including how to:

  • Inspect variables and data structures
  • Understand segmentation faults and core dumps
  • Know why your program crashes or throws exceptions
  • Use features like catchpoints, convenience variables, and artificial arrays
  • Avoid common debugging pitfalls

Real world examples of coding errors help to clarify the authors’ guiding principles, and coverage of complex topics like thread, client-server, GUI, and parallel programming debugging will make you even more proficient. You'll also learn how to prevent errors in the first place with text editors, compilers, error reporting, and static code checkers.

Whether you dread the thought of debugging your programs or simply want to improve your current debugging efforts, you'll find a valuable ally in The Art of Debugging.

Author Bio 

Norman Matloff, a computer science professor at UC Davis, is the author of several popular public-domain software packages and online tutorials.

Peter Jay Salzman earned his PhD in physics from UC Davis and founded the Linux Users Group of Davis. He is currently a programmer with a Wall Street financial firm.

Table of contents 

Chapter 1: Some Preliminaries, for Beginners and Pros
Chapter 2: Stopping to Take a Look Around
Chapter 3: Inspecting and Setting Variables
Chapter 4: When a Program Crashes
Chapter 5: Debugging in a Multiple-Activities Context
Chapter 6: Special Topics
Chapter 7: Other Tools
Chapter 8: Using GDB/DDD for Other Languages

View the detailed Table of Contents (PDF)

View the Index (PDF)


IT Knowledge Exchange interviewed Norman Matloff about The Art of Debugging with GDB, DDD, and Eclipse. Read the interview here!

The Art of Debugging with GDB, DDD, and Eclipse "is intermediate to a glorified user's manual and an abstract treatise on the cognitive theory of the debugging process. The authors provide information on the 'how-to' for specific commands in the tools, but they also set forth and make frequent use of some general principles for the debugging process."
Golden Triangle PC Club (Read More)

"Most of the examples in The Art of Debugging with GDB, DDD, and Eclipse are in line with the theory and bring out the concepts clearly. There is the repeated comparison of usage of the three debugging tools for the same example so that the reader can draw their own conclusions and grow on their own favorite debugging tool." (Read More)

"If you want to get started in effective debugging, this is the book to have. If you are a professional programmer looking for more effective strategies, this is the book to have."
Major Keary, Linux and Open Source SIG

In The Art of Debugging with GDB, DDD, and Eclipse, "The explanations are clear, the sample source code is well-written, the example debugging sessions are easy to follow, and so on. If you are new to debugging and you want to learn about GDB this book might be what you need." (Read More)

"This book provides an excellent contrast between each by showing how to perform the same function in each environment. The authors cover common debugging problems such as segmentation faults in addition to common debugging pitfalls to avoid so that this can be a useful learning tool for novice debuggers."
Electronic Design (Read More)

"This book is a comprehensive introduction to, and a good book to have around while using, GDB and some of it's popular front-ends."
Petrea Stefan, Freelance Programmer (Read More)

"C programmers working on Unix systems will benefit the most from reading this book, but many others will learn valuable techniques and tricks." (Read More)

"This book is important reading for anyone programming on Linux in C++, Java, Perl, or Python. It is very readable with 250 pages."
Blink Monitor (Read More)

"The many coding instructors who consider mastering C and pointers essential to computer scientists and coding professionals will do well to recommend this book to their classes...Technical professionals who craft an occasional application in C to solve an immediate problem should also own this book--it will pay for itself in saved time, the first time it is used."
Computing Reviews (Read More)


Page 225:
The last two lines of code on this page should read:
$ gcc -g3 -Wall -std=c99 out0fBound.c -o out0fBound_with_efence -lefence
$ ./out0fBound_with_efence