Debugging Embedded Devices using GDB

Bugs happen. Identifying and fixing them is part of the development process. This tutorial demonstrates one of the key tools in the embedded Linux developer’s toolbox: the GNU Debugger, GDB. You will begin by using GDB to debug a program running on a target device. You will learn about debug symbols: how build them into programs and libraries, and the places that GDB will go looking for them. Next, you will perform basic debugging tasks, including setting breakpoints, stepping through code, examining variables and modifying variables. After that you will lean about GDB command files and how they can help you by automating certain tasks. You will receive a handy GDB cribsheet to help you with all of this. If time allows, we will discuss how to use GDB to analyse core dumps so that you can perform a post-mortem on a crashed program.

This is a 90 minute tutorial that I first gave at the Embedded Linux Conference Europe in October 2020. It is just a small section taken from my Mastering Embedded Linux training course. If you have any questions or comments, please contact me at training@2net.co.uk

Slides:
https://2net.co.uk/downloads/debugging-with-gdb-csimmonds-elce-2020.pdf

Workbook:
https://2net.co.uk/downloads/debugging-with-gdb-csimmonds-elce-2020-work...

Yocto Project image for Raspberry Pi 3B:
https://2net.co.uk/downloads/core-image-base-raspberrypi3.wic.bz2

SDK
https://2net.co.uk/downloads/sdk-raspberrypi3-toolchain-3.1.3.sh

Code samples:
https://2net.co.uk/downloads/debug-samples-elce2020.tar.gz

GDB quick reference card:
https://2net.co.uk/downloads/gdb-refcard-5.pdf