That said, I was pleasantly surprised I was able to attach a debugger to that system. Some bugs really needed it.
Printf debugging is ok
91–100 of 152 posts
Re: Printf debugging is ok
#92Earlier quoted context omitted.
> The crashes/bugs I deal with are rarely straight down failures, they are often the 1 out of 100 runs kind, so printf debugging is the only way to go really. Another thing I’ve found helpful, is to write out a “system state dump” (say in JSON) to a file whenever certain errors happen. Like we had a production system that was randomly hanging and running out of DB connections. So now whenever the DB connection pool i…
Why not just dump a core, rather than going to all that effort?
Not my original idea, I got it from some Oracle products which have a similar feature (most notably Oracle Database)
Re: Printf debugging is ok
#93Of course it's okay, and at the same time no one will use it as soon as something else is more convenient & effective. Been waiting for "something else" ~30 years & counting.
That counts for a lot to me. Anti-printf people have to go a long way to convince me that it's somehow not ok. I use debuggers every day. I use some form of printf debugging every day. I use whatever affordance I can get my hands on, and I ignore the peanut gallery.
Re: Printf debugging is ok
#94Earlier quoted context omitted.
To be frank, I actually find debugger to rarely be useful. When it is useful, it is super useful - but those occasions aren't that numerous, so I can totally believe that many people may get away without learning how to use it. It feels like 90% of my time in gdb is reading backtraces after segfaults, which I wouldn't really consider to be a use of a debugger. I'm still glad I can use it for the other 10%, but it's j…
GDB is a dog shit trash debugger. I keep forgetting that Linux and Mac have shit tools. I suppose if the only debugger available to me were GDB I would also prefer printf debugging! The typical modern dev loves to shit on Windows. But Visual Studio (the adult version, not VSCode) is still a best-in-class debugger. Xcode is bloated as hell but did help me last week. Linux has… poor bastards.
Re: Printf debugging is ok
#95Earlier quoted context omitted.
Things like variable watchpoints mean that debuggers are still the better option.
You can add the condition to the print statement and grep for it if it gets too verbose.
Re: Printf debugging is ok
#96Re: Printf debugging is ok
#97Sometimes a series of print-statements are better for helping you understand exactly when and how a bug occurs. This is particularly true in situations where the debugger is difficult or impossible to use (e.g., multi-threading). Of course, in that situation, logging may be better, but that's just glorified printf.
Re: Printf debugging is ok
#98If it's a one-off situation, as opposed to something that should be part of your long-term test cases? Then yes, using print-statements is fine. Everyone does it, this isn't (or shouldn't be) controversial. Sometimes a series of print-statements are better for helping you understand exactly when and how a bug occurs. This is particularly true in situations where the debugger is difficult or impossible to use (e.g., m…
Re: Printf debugging is ok
#99If it's a one-off situation, as opposed to something that should be part of your long-term test cases? Then yes, using print-statements is fine. Everyone does it, this isn't (or shouldn't be) controversial. Sometimes a series of print-statements are better for helping you understand exactly when and how a bug occurs. This is particularly true in situations where the debugger is difficult or impossible to use (e.g., m…
the glorified printf :) I prefer over non glorified, as it goes to log for future reference etc, imho it has advantages over regular printf.
Re: Printf debugging is ok
#100[1]: https://andydote.co.uk/2024/11/24/print-debugging-tracing/