Walk Through Each Section

To walk through code, you have to learn how to “think like a computer”—that is, how to walk through source code while tracking the exact state that the computer is in and thus, hopefully, trigger the “Eureka” moment when you realize where the actual state diverges from the intended state. In other words, you find the bug.

Emulating a computer might seem obvious, but in practice, it can be quite hard.

It can be difficult, especially after reading through lots of code, to avoid simply sliding over statements that look reasonable. Remember that the computer devotes its full attention to each statement as it is being executed, and you need to do the same. No matter if a statement seems obvious, if a constant definition looks ...

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

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