The GNU Debugger (GDB) is the standard debugger for the GNU software system. Though we will be using it to debug C, GDB supports multiple languages. GDB has the basic functionality of setting break points, printing variables, and stepping through individual lines of code. The tool is further useful when paired with OpenOCD (to be introduced in the next lab) to debug code running on a microcontroller.
Before starting GDB, you can check if your system has GDB installed using which gdb. Use apt-get to install it if not! GDB is run via command line in Ubuntu. The basic commands are:
For a complete tutorial check out: Debugging with GDB.