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

or

  • 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 GDB.py 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

presentation

  • 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 gdb.py
  • 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:

HOST_DIR=$HOME/tuto-gdb_data
mkdir -p $HOST_DIR
docker run -it -v $HOST_DIR:/home/gdb/host --cap-add sys_ptrace kpouget/tuto-gdb.py