Debugging Techniques
Debugging is the systematic process of finding and fixing defects in software. It covers strategies like reproducing failures, isolating variables, reading error messages, using debuggers and logging, forming hypotheses, and narrowing the search space until the root cause is identified.
itSoftware engineering | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Debugging Techniques
Debugging is the work of explaining a difference between what you expected and what you observed. The code change comes after the explanation. Until you can say what went wrong with evidence, you are guessing with a compiler.
What did people do before a method existed for this? Stare at the program, change something that looked suspicious, run it again, and hope. Sometimes that worked. Often it produced a second mystery stacked on the first. The modern habit is quieter and slightly less theatrical: write down the failure, map the path from input to output, form one hypothesis, and run the smallest test that could kill it.
Three ideas carry the rest. First, state the difference precisely: expected behavior, actual behavior, and the conditions under which it happens. Vague reports create large search spaces; a quoted search term after a July deploy is already a boundary you can test. Second, run an evidence loop: observe, hypothesize, predict, test, update. A useful hypothesis names a mechanism and predicts an observation; "the cache is bad" does neither. Third, match the evidence to the question. A reproducer finds trigger conditions. Logs give event context. Metrics show aggregate change. Traces follow a request across components. A debugger exposes state at one point. Version bisection finds the first bad revision. Collect evidence with a purpose, not as a ritual.
The surprise worth keeping: reproduction is not root cause. Proving you can trigger the symptom under known conditions is necessary, and it is still only the first measurement. Mitigation, diagnosis, and correction are three different outcomes, and one action rarely buys all three. Pausing in a debugger can also change timing enough to hide a race, which is the universe's way of reminding you that the instrument is part of the experiment.
Where to next: the Course tab walks the evidence loop and the system model in full. The Cheatsheet is the working reference for framing a failure, choosing evidence, and driving a debugger. Field Notes carries the practitioner judgment: the streetlight anti-pattern, local-only reproducers, and when time spent on one theory is itself a signal. The Quiz checks whether the method stuck, and Reference links the SRE troubleshooting chapter, GDB, DevTools, git bisect, and pdb for the tools behind the loop.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://sre.google/sre-book/effective-troubleshooting/
Supports
- The general observe, hypothesize, test, and update troubleshooting model
- Precise problem reports, system knowledge, telemetry, logs, traces, and controlled experiments
- Warnings about irrelevant symptoms, improbable theories, spurious correlations, and confusing correlation with causation
- Course claims about mitigation, diagnosis, evidence collection, and systematic troubleshooting
- Quiz questions 1, 2, 6, 8, 9, and 10
- The first study-path rationale
- https://sourceware.org/gdb/current/onlinedocs/gdb
Supports
- Breakpoints, watchpoints, catchpoints, stack inspection, thread behavior, and source-level debugger limits
- The debugger overview in the introduction, slides, cheatsheet, and narration
- Quiz questions 3, 4, 5, and 9
- The GDB study-path rationale
- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Breakpoints.html
Supports
- Breakpoints pausing at selected locations and watchpoints stopping when expressions change
- Quiz question 3
- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Conditions.html
Supports
- Conditional breakpoints stopping only when their condition evaluates as required
- Quiz question 4
- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Continuing-and-Stepping.html
Supports
- Step entering called functions and next continuing within the current stack frame
- Quiz question 5
- https://sourceware.org/gdb/current/onlinedocs/gdb.html/Threads.html
Supports
- Debugger interactions with multithreaded execution and timing-sensitive behavior
- Quiz question 9
- https://developer.chrome.com/docs/devtools/javascript/breakpoints
Supports
- Line, conditional, log, DOM, request, event, exception, and function breakpoint purposes
- The browser-debugging material and quiz questions 3 and 4
- The Chrome DevTools study-path rationale
- https://git-scm.com/docs/git-bisect
Supports
- Binary search between known good and bad revisions, skipped revisions, and automated classification
- Regression narrowing across the introduction, slides, cheatsheet, and narration
- Quiz question 7
- The Git study-path rationale
- https://docs.python.org/3/library/pdb.html
Supports
- Python commands for breakpoints, stack frames, stepping, source inspection, and expression evaluation
- The Python debugger study-path rationale
- https://www.brendangregg.com/methodology.html
Supports
- Streetlight anti-pattern and USE method framing for field notes
- Bounded methodology windows as a switching signal
- https://12factor.net/dev-prod-parity
Supports
- Local-only reproducer investigating the wrong system (field notes tradeoff)
- https://arxiv.org/abs/2105.02162
Supports
- Long debugging sessions concentrate cost (field notes difficulty)
- https://robert.ocallahan.org/2014/03/introducing-rr.html
Supports
- Record-and-replay changing the cost of reproduction (field notes shift)
- Timeline event: Mozilla announces rr
- https://americanhistory.si.edu/collections/object/nmah_334663
Supports
- Timeline event: The Harvard Mark II logbook records a moth
- https://aosabook.org/en/v2/gdb.html
Supports
- Timeline event: Richard Stallman writes GDB
- https://nnethercote.github.io/2022/07/27/twenty-years-of-valgrind.html
Supports
- Timeline event: Valgrind 1.0 released
- https://git-scm.com/docs/git-bisect-lk2009
Supports
- Timeline event: Git 1.5.4 adds bisect skip
- https://hacks.mozilla.org/2017/10/saying-goodbye-to-firebug/
Supports
- Timeline event: Firebug ships for Firefox
- https://blog.chromium.org/2018/09/10-years-of-chrome-devtools.html
Supports
- Timeline event: Chrome ships with a built-in inspector
- https://github.com/rr-debugger/rr/wiki/News
Supports
- Timeline event: rr 4.0.0 stabilizes reverse execution
- https://sourceware.org/gdb/
Supports
- Product landscape entry: GDB
- https://lldb.llvm.org/
Supports
- Product landscape entry: LLDB
- https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/
Supports
- Product landscape entry: WinDbg
- https://developer.chrome.com/docs/devtools
Supports
- Product landscape entry: Chrome DevTools
- https://github.com/go-delve/delve
Supports
- Product landscape entry: Delve
- https://github.com/microsoft/debugpy
Supports
- Product landscape entry: debugpy
- https://www.jetbrains.com/pycharm/
Supports
- Product landscape entry: PyCharm
- https://visualstudio.microsoft.com/
Supports
- Product landscape entry: Visual Studio
- https://rr-project.org/
Supports
- Product landscape entry: rr
- https://sentry.io/
Supports
- Product landscape entry: Sentry
- https://www.wireshark.org/
Supports
- Product landscape entry: Wireshark
- https://valgrind.org/
Supports
- Product landscape entry: Valgrind
- https://strace.io/
Supports
- Product landscape entry: strace
