Saturday 10th March, 2012
11:50am to 12:40pm
Brian Kernighan famously quipped, “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
That debugging is hard is a universal truth, however the unmanaged code we write as Cocoa developers does make our life somewhat more difficult. We can’t always stand on the shoulders of @mikeash, @gparker & @bbum when we get a crash in objc_msgSend()!
Kernighan’s second point is even more salient — while it may be tempting to write tricky code, it can become a debugging nightmare. If you anticipate the need to debug code while you’re writing it, you’ll be better off when you’re tracking down yet another heisenbug.
In this talk I’ll discuss the tools you can use to make debugging easier, and some techniques for ensuring you’ve not coded a rope long enough to hang yourself. You’ll walk away with some extra arrows to your debugging quiver, and a better idea of how to write more debuggable code.
• Debugging basics; reproducibility, reduction & deduction
• The challenge of a C-superset and non-open source frameworks/libraries
• Tools that make debugging much easier (gdb/lldb, instruments, hidden debugging facilities etc.)
• Unit tests as a debugging harness, using git-bisect to find when bugs were introduced
• Resolving bugs ‘in the wild’ (symbolication, reproduction etc.)
• Writing more debuggable code (macros, categories, one-shot variables etc.)
Sign in to add slides, notes or videos to this session