Introduction to the GNU Project Debugger : GDB

Pierre Aubert




Prerequisites

Compiler

We are going to use the GCC-7 compiler (you can possibly use an old compiler for this tutorial but I don't have one). If you are stucked with an other compiler or with an older version of GCC you can install it with Anaconda (in your tutorial environement) :
conda install gcc7


Follow with Container

This lecture can be followed with a docker image via apptainer on your laptop or on a remote server or via docker:

  • Light image 145 MB OK : docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_gdb/introduction_gdb_alpine_light:latest
  • Code server 326 MB OK : docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_gdb/introduction_gdb_alpine_micromamba_code_server:latest
  • Jupyter-hub OK : docker://gitlab-registry.in2p3.fr/cta-lapp/cours/introduction_gdb/introduction_gdb_alpine_micromamba_vscode:latest


Usages are explained in the lecture demo.

Debugger

We wille use gdb (>= 7.11.1) to debug our programs.

Intallation

On Ubuntu :
sudo apt-get install gdb


On Fedora :
sudo yum install gdb


On OSX :



With :

brew install gdb


or :

port install gdb


Compilation tools

We will use CMake and Make to compile our programs.

The correction of the whole tutorial is available here.