3 ms·
When it comes to debugging, nothing beats a few strategic print statements to inspect variables or a well-placed panic to obtain a stack trace. I respectfully
by hartror 16y ago
When it comes to debugging, nothing beats a few strategic print statements to inspect variables or a well-placed panic to obtain a stack trace.
I respectfully disagree with this statement.
Beyond simple issues a debugger is invaluable for following program flow and inspecting variable/memory states.
And why does "missing .. patience" mean you are more likely to use a debugger over a print statement?
- supersillyus 16y agoIn the last decade, I think I've pulled out a debugger only a handful of times. Apparently many people use them, but for me, understanding my code, writing tests, and tossing in some printfs has always been the way. I don't have a problem with debuggers, butfor me it is usually about having theories and testing them. This testing can happen in a debugger or in a print statement or in a test, but a test always seems like the best idea, and a print statement usually seems more straightforward to me than trying to stop and inspect my program while it is running.
- itsnotvalid 16y agoMost of the time, for me, debuggers are only used on assembly code, which it is not as easy to insert a print statement or a hook.
- barrkel 16y agoYou use this "my" word a lot. I personally use debuggers for debugging other people's code, code that's possibly decades old, that doesn't have enough modularity for good unit tests, and whose bugs in any case often only show up in complex multithreaded integration scenarios. GDB only acquired multiprocessing debugging support this year; to my mind it's pretty primitive.