## 4 Writing a new GDB backend

Typically, either the low-level I/O routines are used for debugging, or LEDs, if present. It is much easier to use GDb for debugging an application. There are several different techniques used to have GDB work remotely. Commonly more than one kind of GDB interface is used to cober a wide variety of development needs.

The most common style of GDB backend is an exception handler for breakpoints. This is also called a gdb stub, and is requires the two additional lines of init code in your `main()` routine. The GDB stubs all use the GDB remote protocol. When the application gets a breakpoint exception, it communicates to GDB on the host.

Another common style of interfacing GDB to a target is by using an existing ROM monitor. These break down into two main kinds, a similar protocol to the GDB remote protocol, and an interface that uses the ROM monitor directly. This kind has GDB simulating a human operator, and all GDB does is work as a command formatter and parser.