Although every bug is different, certain techniques and approaches have repeatedly proven their value in tracking down a wide range of problems. They won’t suffice for every problem you find yourself faced with, but every programmer should have them at their fingertips.


Diagnosis is all about information—divining precisely the state of, and the execution path taken by, the software. Although there are many ways through which you can either infer or derive this information, by far the simplest and most direct is adding instrumentation to the software itself.

Instrumentation is code that doesn’t affect how the software behaves but instead provides insight into why it behaves as it does. In the previous chapter, we ...

Get Debug It! now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.