Learn GDB: course outline

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.

Start learning GDB

13 levels, from first breakpoint to machine code

  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

How it works