News for hackers. Stuff that matters.
Re:The Grug Brained Developer (2022) by hobs on Tuesday June 17, 2025 @09:08PM (#44305698)
A log is very different than a debugger though, one tells you what happened, one shows you the entire state and doesn't make you assemble it in your head.
Re:The Grug Brained Developer (2022) by demosthanos on Tuesday June 17, 2025 @09:11PM (#44305705)
Your framing makes it sound like the log is worse in some way, but what the log gives you that the debugger makes you assemble in your head is a timeline of when things happen. Being able to see time is a pretty big benefit for most types of software.

I can always drop an entire state object into the log if I need it, but the only way for a debugger to approximate what a log can give me is for me to step through a bunch of break points and hold the time stream in my head.

The one place where a debugger is straight up better is if I know exactly which unit of code is failing and that unit has complicated logic that is worth stepping through line by line. That's what they were designed for, and they're very useful for that, but it's also not the most common kind of troubleshooting I run into.

Re:The Grug Brained Developer (2022) by switchbak on Tuesday June 17, 2025 @10:25PM (#44306116)
In the early 2000’s I whipped up a tool to convert log statements into visual swim lanes like the Chrome profiler does. That thing was a godsend for reasoning about complex parallelism.
Re:The Grug Brained Developer (2022) by EFreethought on Wednesday June 18, 2025 @01:11AM (#44306842)
Would you be willing to share this tool?
Re:The Grug Brained Developer (2022) by switchbak on Tuesday June 24, 2025 @06:27PM (#44371705)
Oh that's long lost to the trashbin of history. As I recall it was a combination of:

- Log4j + MDC's so we could get a timestamp and thread ID easily

- some python scripting

I can't remember if it was PDF or SVG, but I do remember having to choose something that would allow for huge graphs and lots of scrolling!

These days there's better options on github, but nice to see I was on a decent path.

Re:The Grug Brained Developer (2022) by hobs on Tuesday June 17, 2025 @09:20PM (#44305762)
It's not worse or better, but its not really comparable is all I am really saying, I would not use them for the same things.
Re:The Grug Brained Developer (2022) by fingerlocks on Wednesday June 18, 2025 @12:57AM (#44306783)
All these print debugging advocates are blowing my mind. Are most people unaware that both lldb and gdb have conditional pass throughout breakpoints with function hooks? In other words, you can create a breakpoint that just prints its location and doesn’t pause execution.

You can script this so all function entry/exists, or whatever, are logged without touching the code or needing to recompile. You can then bulk toggle these breakpoints, at runtime, so you only see a particular subset when things get interesting.

Modifying the code to print stuff will feel barbaric after driving around a fine tuned debugging experience.

Re:The Grug Brained Developer (2022) by dpkirchner on Wednesday June 18, 2025 @01:40AM (#44306941)
I can't tell you how many times lldb has failed to hit breakpoints or has dumped me in some library without symbols. This was in Xcode while writing an iOS app, maybe it's better in other environments.

Print debugging, while not clever or powerful, has never once failed me.

Re:The Grug Brained Developer (2022) by fingerlocks on Wednesday June 18, 2025 @02:28AM (#44307151)
Sometimes the debugserver is flakey, I’ll give you that. But some that also sounds like UI quirks such as ambiguous breakpoints on a function definition with default initialized default values.

You can attach lldb without Xcode. Or you can open the lldb terminal in Xcode, pause execution, and inspect the breakpoints manually

Re:The Grug Brained Developer (2022) by mort96 on Wednesday June 18, 2025 @02:41AM (#44307219)
I've never had a debugger show me the entire state. I'm not even sure I want to know the entire state, but GDB has a lot of issue with anything but the most basic data structures most of the time, and I always need to explicitly ask for what I want to see by calling things like operator[] (and then hope that the particular operator[] wasn't optimized out of the final binary). It's not exactly a great experience.