Hacker News new | ask | show | jobs
by gizmo686 2608 days ago
My problem with debuggers is that they are too good of tools. You use them, solve the bug, and move on. In the process, you might have learned something additional about the code base, but the only improvements to the code are fixing that particular bug. In contrast, when you don't use a debugger, then every now and then when you try to debug, you find that some of your work is not simply a temporary hack to identify the problem, but something that should stay in the code long term to assist in future debugging (be it asserts you added, or additional logging calls). The end result is that the more you debug without a debugger, the more debuggable you code becomes.

I am currently working on a codebase where all the developers are adamant debugger users. The code is practically impossible to debug without the use of a debugger, because no one has ever had to build up the debugging infrastructure.

Complex/diffucult bugs still take about as long to fix, but simple bugs take far longer than they normally do, because every time you use a debugger you are starting from scratch.

2 comments

I am strong fan of debuggers as a tool — but I actually agree with some of this complaint.

I want a language that exposes debugger features as a first class language construct

Think how powerful this pattern could be:

debug(...) { ... }

if the language and runtime specified the semantics needed ...

It could be really useful to have blocks like this in the codebase:

debug(problem_related_to_x) { pause_debugger; }

You could document and then more easily return to the mental context found over time when trying to understand problems related to x ...

And you could put log () statements inside those blocks instead of break points — not stupid text output but something the debugger protocol knows how to represent and present ... these capabilities alone would exceed the utility of print() debugging while supporting all the same workflows ...

I know things like vscode’s logpoints exist — but the fact that these constructs are not représentable in the code and easily shareable really undermines their overall utility ...

These techniques are not mutually exclusive. Using a debugger to help find the bug doesn't prevent you from adding assertions or logging to your code afterwards if you think they can be useful. For that matter, you can use a combination of debugger and asserts/logging to find the bug.