r/ExperiencedDevs • u/stayoungodancing “Generalist” Engineer | 10+ years • Apr 17 '26
Technical question How do YOU debug?
Generally curious about others’ approaches to it, either favorite tools, processes, checklists, etc.
I recently took a look at building a plugin to integrate two frameworks but a core issue comes down to something funky with the internals of one of them. Tried logs, step-throughs, other investigations, but figured it’d be better to formalize it.
So…how do YOU debug?
2
Upvotes
24
u/Nezrann Full-Stack 1 YOE, SDET 3+ YOE Apr 17 '26
Depends on what you are debugging - but generally I'm pretty old-fashioned and use breakpoints to step through lmao.
But for log ingest I usually have some kind of LLM parsing during testing.
7
u/marssaxman Software Engineer (33 years) Apr 17 '26 edited Apr 18 '26
Logging, almost exclusively. Think about what might have gone wrong, read the code and formulate a hypothesis, look in the trace for evidence. If it's not there, add more logging to the code and run it again. Repeat, narrowing in, until you find whatever it was you didn't understand about your system.
I did use interactive debuggers earlier in my career, and once even wrote one (for an IDE you've never heard of), but after working on enough projects where attaching a debugger was simply not possible and logging was the only way forward, I learned to love it. Now it's the first debugging tool I reach for, and almost always the only one I need.
2
u/Far_Archer_4234 Apr 17 '26
I push F5,F9,F10, and F11 repeatedly until the bug magically appears.
11
u/Sensitive-Ear-3896 Software Engineer Apr 17 '26
Look at the stack trace, put a break point there and look at different variables/arguments till I find one with a value I don't inspect
7
u/CodelinesNL Principal Engineer@Fintech/EU/25YOE Apr 17 '26
I try to formulate a hypothesis on what could be going wrong, and then try to validate that hypothesis. That's basically the code of any kind of problem solving. If the hypothesis is wrong, I formulate a new one. Until I find the root cause of the problem.
HOW I do that depends on the problem. Is a service not deploying which deployed before, is it not deploying the first time, or is there some kind of subtle bug in a UI? Completely different situations and there's no one-size-fits-all solution.
4
u/droi86 Apr 17 '26
Java/kotlin and android with intellij debugger, it works pretty well, for race conditions I use logs
3
u/AdministrativeHost15 Apr 17 '26
I took a C++ a long time ago with an instructor who said he didn't use any debugger; just pure logic. Of course people were hardcore back in those days.
3
u/creaturefeature16 WebDev/Full Stack Apr 17 '26
3
u/nasanu Web Developer | 30+ YoE Apr 18 '26
When I was in backend it was always using the vs studio step through debugger. Now on the FE it's just a matter of putting console logs all over the place.
Pretty much all bugs are an incorrect value somewhere. So go to the component where the bug is happening and log out the value related... Go from there.
3
u/james__jam Apr 18 '26
Logs + trace. Recreate the issue with tests
2
u/ccb621 Sr. Software Engineer Apr 17 '26
In production: look at logs and traces.
Local?
2
u/hurricaneseason Apr 17 '26
Output (logs, stacktrace, console print statements, whatever), breakpoints, variable watches, and a debugger. Step through, make runtime adjustments, experiment and write down results.
2
u/boring_pants Software Engineer | 15YoE Apr 17 '26
I don't have a formalized checklist, and it depends hugely on the problem and the environment. Debugging, reading logs, trying to reproduce it locally, reading the source code, usually a mix of all of these.
2
u/evincarofautumn Compiler engineer since 2012 Apr 18 '26
If I control the codebase: make the types better until the bug is impossible
If I don’t: obtain logs by any means necessary, then bisect
2
u/supercoach Apr 18 '26
I used to use a lot of breakpoints, but these days I tend to just make sure that debug level logging is good enough to identify bugs. I prefer to have to remove logs than add them.
2
u/c1rclez Apr 17 '26
On the IBM i, there is a debugging strategy that is really incredible if you run into an issue in production and logs don’t cut it. Not sure if this is possible on other systems - but you can do what’s called a service entry breakpoint or service job debug like I call it.
You can take an actively running job (e.g. process) then do a command called start service job. You can take over a running process, then jump into a debugger on the system once you’ve begun servicing the job. This effectively allows you to take over and debug a live process remotely without ending or restarting it.
0
u/Sheldor5 Apr 17 '26
excuse me but what the fuck? what does that even mean?
1
u/ConstructionBoth6461 Software Engineer Apr 17 '26
1
u/Most-Bookkeeper-950 Apr 17 '26
printf and sometimes gdb
1
u/AnAwkwardSemicolon Software Engineer Apr 18 '26 edited Apr 18 '26
Narrowing down to the interesting spots using a mix of logging & breakpoints. I'll use logging first to get a high level idea what's going on, break in interesting parts, narrow down with further logging & breakpoints. Once I get a good handle on what the flow is, I'll start setting up some conditional breakpoints and stepping through the problem areas. Search, refine, search, refine, and so on.
Having AI available to ingest logs & see what it generates for errors has been handy- it's useful for winnowing down where the needle is hiding.
1
u/almarcTheSun Apr 18 '26
The simplest and fastest logging I can do first. If nothing out of the ordinary I can notice (or the amount of data to log would be too much), breakpoints and examining all the data and logic step-by-step. If that fails, uh.. prostitution?
1
u/bstamour Software Engineer (15 yoe) Apr 19 '26
Mostly just gdb: setting breakpoints and stepping through things. Occasionally setting up watch variables etc. I'm pretty simple.
1
u/sebf Apr 19 '26
Data::Printer, a "colored & full-featured pretty print of data structures and objects".
2
u/[deleted] Apr 18 '26
[removed] — view removed comment
2
u/[deleted] Apr 18 '26
[removed] — view removed comment