Build your own Debugger
A Linux debugger built on ptrace: launch a program, set breakpoints, step through it, and read its registers and memory.
- Advanced
- About 15–30 h
- 4 checkpoints
- 1 tutorial · C++
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
A breakpoint is one byte swapped in memory, and a debugger is a process controlling another. Building one explains ptrace, signals, ELF files and DWARF debugging information.
Before you start: Linux on x86-64 (a VM is fine).
You will be able to
- Control a child process with ptrace and signals.
- Set and remove software breakpoints by patching the int3 instruction.
- Read and write the registers and memory of a stopped process.
- Map addresses to source lines using DWARF line tables.
Skills it exercises
Recommended on Operating Systems & Linux.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
Launch and continue
Done when: The debugger starts a program under ptrace, stops before main, and continues it on command.
- Checkpoint 2Self-check
Breakpoints
Done when: A breakpoint at an address stops the program there, and continuing restores the original instruction and resumes correctly.
- Checkpoint 3Self-check
Registers and memory
Done when: Commands print and change registers and memory, and changing a variable changes the program's output.
- Checkpoint 4Self-check
Source-level stepping
Done when: Breakpoints can be set by function name or file:line, and
stepadvances one source line.
Stretch goals
- Backtraces by unwinding the stack.
- Watchpoints with hardware debug registers.
Step-by-step guides
Pick one in a language you know (tutorial languages: C++). They open on the author’s site.
- C++
Writing a Linux Debugger(external site)
C++, ten parts from fork and ptrace to DWARF, stepping and backtraces.
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.