Hacker News new | ask | show | jobs
by properparity 1359 days ago
Why limit yourself to crusty text when you can have live visualizations of data structures in various formats, graph dx/dy over time of some variable, stop and inspect data on some condition without having to modify code, quickly start execution on a certain line, quickly drill down into struct members, etc.

I mean it does everything a printf() can do - except just better.

4 comments

> Why limit yourself to crusty text when you can have live visualizations of data structures in various formats,

Because that's too fruity, real men (tm) don't use debuggers /s

Programmers are so funny, they'll present themselves as rational and logical, but then follow the advice of some old geezer who thinks syntax highlighting is for pussies rather than admitting that their tools suck and need to be better.

I have a particular chip on my shoulder about this whole printf debugging thing: https://twitter.com/nice_byte/status/1465200027672866816

For a couple months I had no functioning debugger and was left with only Printf's. I do not ever desire to go back to that. It is far too painful. I think my time to find issues likely was 4x+ longer than before.

Some programs simply have too much state, too complex of structures (for performance or memory reasons), or very long runtimes to reasonably debug purely with prints.

The one thing printf does better is force me to stop and think about why.

I find that when I use a debugger I fall into the trap of mindless looking at variables, stopping to inspect data (sometimes changing a variable), drilling down into struct members... (That is your exact list except I've never used a debugger that can graph dx/dy though I'm sure that applies too) All the while forgetting that the real goal is to figure out why the program is in the bad state i the first place.

If you can avoid that trap all those tools of debuggers are useful. I sometimes do use a debugger for each of the above things, but I make it a point to limit the time I spend in the debugger.

I’ve personally never been in a bare-metal environment where the debugger is truly reliable. JVM works great, so does V8 and probably most other VM-style environments, but C++? Swift? Rust? I’ve never seen a truly reliable debugging environment that doesn’t just arbitrarily stop working when I try to inspect a symbol, some subset of the time.

If debuggers were reliable, I’d take them over printf-debugging any day. But to this day I’ve never seen one that is.