As part of our annual team seminar, I’ve updated the tutorial from the Rencontre de la Communauté Française de Compilation:


  • Presentation slides PDF
  • Exercise sheet MD
  • The exercise files TGZ

Understanding, Scripting and Extending GDB

Aussois 2017

The talk was divided in three parts:

  • GDB Under the Hood: an introduction to GDB internals
  • Your turn: Programming GDB in Python: discover with simple examples/commands to run in the CLI
  • Your turn: New GDB Functionnalities: extend GDB with new commands and try them. I provide the command template, you fill the gaps


  • GDB Under the Hood

    • Help from the compiler
    • Help from the OS
    • Help from the CPU
    • Internal algorithms
  • Your turn: Programming GDB in Python

  • Python Interface Capabilities
  • Ex. 1: (re)discovering gdb-cli and
  • Ex. 2: gdb simple scripting

  • Your turn: New GDB Functionnalities

    • Section breakpoints
    • Return true breakpoints
    • Register watchpoint
    • Step into next call
    • Faking function execution

Run the docker image with:

mkdir -p $HOST_DIR
docker run -it -v $HOST_DIR:/home/gdb/host --cap-add sys_ptrace kpouget/