Reading 9: Debugging
First, we’re going to look at how to avoid debugging – ways to write code that either avoids debugging entirely, or at least makes it easy when we have to do it. But sometimes you have no choice but to debug – particularly when the bug is found only when you plug the whole system together or reported by a user after the system is deployed, in which case it may be hard to localize it to a particular module. For those situations, we can suggest a systematic strategy for more effective debugging. A good book about systematic debugging is Why Programs Fail by Andreas Zeller. Much of this reading is inspired by that book. Also related is “How to Debug” by John Regehr, a lecture from an embedded systems course, which is more low-level than 6.102 but with the same general principles for systematic debugging. Finally, Debugging: The Nine Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems by David Agans is a readable, eminently practical guide to debugging in a
Reading 9: Debugging > hide Snapdown help Snapdown is a language for drawing snapshot diagrams. Click on the links below to see examples of Snapdown in action! In each example, you'll see a snippet of Snapdown syntax and the corresponding diagram side-by-side. Primitives (click to expand) In this example, we have two variables: i points to the value 5 , and s points to the value "abc" . i -> 5 s -> "abc" Objects (click to expand) In this example, f points to a MyFloat object with the value 5.0 , s points to a MyString object with the value "abc" . f -> (MyFloat 5.0) s -> (MyString "abc") Field
related reading
- Reading 13: Debuggingweb.mit.edu
- Reading 9: Avoiding Debuggingweb.mit.edu
- Debugging Reinforcement Learning Systemsandyljones.com
- Reading 4: Code Reviewweb.mit.edu
- Computers can be understood - Made of Bugsblog.nelhage.com
- The Debugger's Toolkit - by Addy Osmani - Elevateaddyo.substack.com
- Reading 2: Testingweb.mit.edu
- 9. Kaleidoscope: Adding Debug Information — LLVM 23.0.0git documentationllvm.org
- CSC 151 - Hypothesis-driven debuggingeikmeier.sites.grinnell.edu
- How to read a codeiamjonas.me
- Reading 8: Mutability & Immutabilityweb.mit.edu
- Some ways to get better at debuggingjvns.ca