4 ms·
Logging can be of great practical utility, but being able to stop a program and freeze it in its state to figure things out is also pretty nice right. You can w
by lemevi 11y ago
Logging can be of great practical utility, but being able to stop a program and freeze it in its state to figure things out is also pretty nice right. You can walk up and down the stack, inspect the scope and the state of things, walk through line after line of code to try and find things in a way that would take a really long time with logging.
So no, printf is not good enough. That's why people have created debuggers.
- enahs-sf 11y agoWhile I can see the argument for and against printf, with the cpu and memory profiling tools, you can basically figure out where most of the issues in your code are. I'd say for most applications, logging, printf, etc. can get you 80% of the way there. Profiling gets you another 10%. For those last mile apps, sorry, but you have to use GDB.
- TillE 11y agoIf you don't care how long it takes, sure, tracing with printf works. But a debugger accomplishes the same task in minutes rather than hours. Even if you know only the very basics of how to use a debugger, it's an extremely effective tool.
- ska 11y agoIt's not always effective - many developers will often save minutes of thinking by spending hours dicking about in a debugger and setting up state. But it is true that for some types of bugs a step debugger is damn handy. And for some types, mostly a distraction.