Demystifying Debuggers, Part 2: The Anatomy of a Running Program

193 points
1/21/1970
3 days ago
by robenkleene

Comments


ghxst

If you're curious about learning how to use debuggers and getting more familiar with them, I came across https://microcorruption.com/debugger/Tutorial and found it to be quite fun and engaging.

For those who use debuggers regularly, would you be willing to share how you learned to use them or any tips and resources that helped you?

I also want to say that the effort behind articles like these is really appreciated. It’s valuable knowledge to share, especially since it seems like the friends I teach are more overwhelmed by them nowadays (maybe I just suck at teaching, but I'll keep trying).

2 days ago

mvuksano

> For those who use debuggers regularly, would you be willing to share how you learned to use them or any tips and resources that helped you?

I use debuggers a lot. I learnt the most when I implemented my own toy debugger. Everything made a lot more sense afterwards. It also made me realize that debuggers give you only a limited view of what is really going on in a CPU. If you want to truly understand how a program is executed on a CPU you'll need to learn a lot more about CPUs and likely about the specific CPU you work with.

2 days ago

ghxst

That's a cool idea and I think a fair argument. I learned a lot from watching Ben Eater on YouTube, he manages to explain (and demonstrate!) how CPUs and many other components work really well.

Out of curiosity, what language did you write your toy debugger in?

2 days ago

mortsnort

Author, it would be helpful to link part 1 at the beginning of the article for people who missed it.

2 days ago

mciancia

2 days ago

emeryberger

Debuggers are great, and even better with LLMs! https://github.com/plasma-umass/ChatDBG https://arxiv.org/abs/2403.16354

3 days ago

[deleted]
3 days ago

righthand

[flagged]

3 days ago

ehnto

One of the reasons I am not yet worried about LLMs is that this is not actually possible, at sufficient levels of domain complexity, and contextual complexity. The domain complexity that LLMs start failing is pretty low at the moment.

As well, as domain complexity increases so does the required amount of precision, and again I find LLMs start getting less precise when put in the deep end. You don't tend to find this kind of software in your "programmers programming". You tend to find this kind of software in industry, where large businesses consist of wild business rules built up over decades, and that has been half-codified into software. I just don't see LLMs swooping in to take that over.

3 days ago

RobRivera

What is the best diet for trolls these days?

3 days ago

metadat

This is a fair question, though it's probably still mostly the same as pre-LLM: spoiled data, heinous cackling laughter, various darkweb fungi, and occasional raw flesh.

3 days ago

righthand

Ah yes the petty responses of the “bigger” “smarter” person.

3 days ago

metadat

You're good in my book. Happy holidays. :)

3 days ago

righthand

I’m sorry, but if LLMs are going to change the way we code, and the way we code is not even print debugging for junior developers. I know very few senior developers that use a debugger at all. I don’t understand why my question is trolling.

What is the best diet for those easily triggered?

3 days ago

rfleury

Are you out of your mind? LLMs will require much more debugging, not less.

Separately, I have no idea which “senior developers” you know, but with or without LLMs, debugging is an immensely important part of development across the industry.

3 days ago

draven

Senior here, I started to use LLMs recently but I still use a debugger. Working with complex code it helps me find the difference between what I think should be happening and what really happens. I don't think a LLM could do better for this task.

Also, I use debuggers for print debugging: insert a breakpoint which doesn't suspend execution but prints something (perhaps conditionnaly.) That way no need to recompile the whole thing and restart it after adding a print statement.

3 days ago

troupo

> if LLMs are going to change the way we code

They are not

> the way we code is not even print debugging for junior developers.

what

> I know very few senior developers that use a debugger at all

I know very few, too, and it's their loss. Debugging is immeasurably more useful to understand and get to the root of the problem in a complex system than printf'ing and logging.

> What is the best diet for those easily triggered?

The best diet for you is to unplug from the hype trains on Twitter and HN.

3 days ago

norir

> Debugging is immeasurably more useful to understand and get to the root of the problem in a complex system

I try to write systems that aren't so complex that I need a debugger but get the same job done. And I choose not to work on systems already so complex that their usage is mandatory. I do not consider this a loss at all. Systems that I write can almost uniformly rebuild and rerun their tests in under a second. I can add (pretty) prints and see the results faster than I can switch to a different tab to run a debugger. I have never introduced or encountered a bug that required advanced debugging techniques besides getting a stacktrace from a crashing problem. YMMV.

3 days ago

righthand

They did, as never before were people talking to a chat bot to have code generated. Seems different to me, but please more talking down and pettiness.

3 days ago

jemmyw

I don't think LLMs have anything to do with it. I've rarely seen devs reach for a debugger until they really really need to. In web dev it can be pretty hard, you need a reproducible bug or production server access. I can probably count on one hand the number of times a bug occurred that stumped me to that point.

If anything, I can see LLMs making debuggers more used because they'll help you with getting setup and interpreting what is going on.

3 days ago

ehnto

I am not trying to sell anyone on debugging, but honestly if you have a good debugger and it's easy to drop into, you'll find it way easier and faster than print debugging. I don't know why people put themselves through the pain of writing print all over the place when you can just, pause the program and see literally everything, all the way up the stack.

3 days ago

jemmyw

There are different levels of debugger. I use language ones all the time. But this article is talking process debugging. If you dev native compiled apps then that's probably second nature. But if you do dev on a scripted or runtime language then it is, as I said in my previous comment, rarely applicable but occasionally very helpful.

3 days ago

troupo

John Carmack: It still boggles my mind how hostile to debuggers and IDEs Silicon Valley VC- backed companies are

https://youtu.be/tzr7hRXcwkw?si=LX7LhGYUHmPAWVNJ

3 days ago

hun3

Have fun brute forcing heisenbugs and LLM hallucinations

3 days ago

righthand

I use a debugger, tell that to all the people using LLMs.

3 days ago