Learn GDB interactively, right in your browser
GDB Lab is a free, interactive GDB course. You learn the debugger by using it: each of the 13 levels gives you a small, realistic C program and a debugging task to solve by typing real GDB commands.
It all runs directly in your browser. GDB, GCC and the program you are debugging run on a small Linux machine emulated inside the tab, so there is nothing to install, no account to create, and nothing is sent to a server.
Loading the debugger… this needs JavaScript and WebAssembly.
How it works
- A real GDB terminal. The genuine GNU debugger, with command history and Tab completion. What you practise is exactly what you will type on your own machine.
- Realistic exercises. Find the statement that corrupts a variable, read a crash backtrace, follow a linked list on the heap, watch a buffer overflow overwrite its neighbour.
- See what GDB sees. A live view of the call stack, variables, pointers and raw memory stays in sync with the terminal as you step.
- Feedback as you go. Each level checks what you actually did in the debugger, with hints when you are stuck.
- Experiment freely. Edit and recompile any program in the playground, then debug your own version.
The course: 13 hands-on GDB exercises
- Stopping a programBreakpoints and line-by-line execution
- Into and out of functionsstep, next and finish
- The call stackEach call has its own frame and its own variables
- Pointers are addressesA pointer holds the address of another object
- Bytes behind the valuesTyped values are interpretations of raw bytes
- Objects that outlive a callDynamically allocated objects are reached only through pointers
- Who changed this?Watchpoints stop on data changes instead of code locations
- Input and a write past the endProgram input, and observing an out-of-bounds write
- Tidying up breakpointsListing, disabling and deleting breakpoints
- Getting through loopsdisplay, until and advance
- What if?Changing variables and calling functions from the debugger
- Why did it crash?Reading a crash: signal, backtrace and frames
- Under the sourceInstructions, registers and the return address