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

  1. Stopping a programBreakpoints and line-by-line execution
  2. Into and out of functionsstep, next and finish
  3. The call stackEach call has its own frame and its own variables
  4. Pointers are addressesA pointer holds the address of another object
  5. Bytes behind the valuesTyped values are interpretations of raw bytes
  6. Objects that outlive a callDynamically allocated objects are reached only through pointers
  7. Who changed this?Watchpoints stop on data changes instead of code locations
  8. Input and a write past the endProgram input, and observing an out-of-bounds write
  9. Tidying up breakpointsListing, disabling and deleting breakpoints
  10. Getting through loopsdisplay, until and advance
  11. What if?Changing variables and calling functions from the debugger
  12. Why did it crash?Reading a crash: signal, backtrace and frames
  13. Under the sourceInstructions, registers and the return address