Despite its low cost and popularity as a workstation debugger, the GNU debugger, gdb, is an extremely powerful and flexible tool for embedded systems development. This is partly because an increasing number of embedded systems are based on the same powerful, 32-bit processors found in some desktop workstations. However, it is also because the diverse, high-end workstation market demands flexible, powerful tools, and such tools can also be used to make great embedded systems.

The following paragraphs describe how the GNU debugger works, and how you can implement a remote debugging agent that allows gdb to debug application code running on your embedded system. The text introduces the basics of gdb’s communications protocol, then provides example implementations for the commands gdb needs to step code, read and write registers, and handle breakpoints.