4 ms·
I can give you a pretty useful scenario: tracing a sequence (calls, assignments, whatever). Adding a print statement at critical points will allow you to see wh
by tgv 6y ago
I can give you a pretty useful scenario: tracing a sequence (calls, assignments, whatever). Adding a print statement at critical points will allow you to see what happened and in what order (and possibly the time intervals as well). You can copy and paste that in a document, collect other cases, and think a bit about it offline.
If you would do that inside a debugger, you'd have to make a note when you hit a break point. That's not helpful. It gets worse when you can't really halt the program because there's some kind of real-time effect in your problem.
Yes, you can tell debuggers to print messages instead of halting, but that's just like adding a print statement. IMO, it's even better, because when you make a change, your print statement will still be at the correct point, while your breakpoint might have shifted a line or two...
- ehnto 6y agoI think you might underestimate an advanced debugger. In the one I most commonly use I can collate data from different frames with watchers. I haven't personally used it, but I think the debugger in the suggested article even keeps a queryable database of data for every recorded execution. I hear you and others though, I wasn't personally suggesting print debugging should go away, I still use it here and there.