In this recipe, we will learn how to run a sample application in a debugger on a target system, as well as try out some basic debugging techniques.
GDB is an open source and widely used interactive debugger. Unlike most of the debuggers that come as part of Integrated Development Environment (IDE) products, the GDB is a standalone, command-line debugger. This means that it does not depend on any particular IDE. As you can see in the example, you can use a plain text editor to work on the code of your application, while still being able to debug it interactively, use breakpoints, view the content of variables and stack traces, and much more.
The user interface of the GDB is minimalist. You run with it in the same way as you work with a Linux console— by typing in commands and analyzing their output. This simplicity makes it extremely...