Debug Session (Debugging with GDB)
From Get docs
20.5.3 Putting it All Together
In summary, when your program is ready to debug, you must follow these steps.
- Make sure you have defined the supporting low-level routines (see What You Must Do for the Stub): getDebugChar, putDebugChar, flush_i_cache, memset, exceptionHandler.
- Insert these lines in your program’s startup code, before the main procedure is called:
- For the 680x0 stub only, you need to provide a variable called
exceptionHook. Normally you just use:
void (*exceptionHook)() = 0;
- Compile and link together: your program, the GDB debugging stub for your target architecture, and the supporting subroutines.
- Make sure you have a serial connection between your target machine and the GDB host, and identify the serial port on the host.
- Download your program to your target machine (or get it there by whatever means the manufacturer provides), and start it.
- Start GDB on the host, and connect to the target (see Connecting to a Remote Target).