Chapter 2. Tips on Walking Through Code

This book's goal is to improve your ability to find bugs in code. Before you get to the actual code samples, this chapter offers advice on how to read code. The intent is not to provide a complete primer on debugging software, but to give you background information that will be useful when you look at the problems in the rest of this book.

In his paper, “Tales of Debugging from the Front Lines,” Marc Eisenstadt discusses different ways in which bugs can be found. One of them is what he calls “gather data,” which is to walk through the code in the debugger, add wrapper code, insert print statement, and so on. This can be a useful way to debug code, and in many cases, it is appropriate.

However, the problems ...

Get Find the Bug A Book of Incorrect Programs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.