Hacker News new | ask | show | jobs
by bjourne 1406 days ago
My preferred debug method is to have a program that I run to verify that it misbehaves. Then I remove some part of the source code, rerun it and verify that it still misbehaves. If it doesn't misbehave, I reinstate the removed code and I remove a part of the reinstated code that I suspect is misbehaving and then I rerun the program. This continues until I have found the offending line, at which point fixing the bug usually becomes trivial. Debuggers are nigh useless in this workflow.

I do use a lot of analysis tools like Valgrind which imho are way more useful than debuggers. Linters and static analysis tools can also be really useful for early bug detection.