[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
17.4.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 section What You Must Do for the Stub):
getDebugChar
,putDebugChar
,flush_i_cache
,memset
,exceptionHandler
. -
Insert these lines near the top of your program:
set_debug_traps(); breakpoint();
-
For the 680x0 stub only, you need to provide a variable called
exceptionHook
. Normally you just use:void (*exceptionHook)() = 0;
but if before calling
set_debug_traps
, you set it to point to a function in your program, that function is called whenNo value for GDBN
continues after stopping on a trap (for example, bus error). The function indicated byexceptionHook
is called with one parameter: anint
which is the exception number. - Compile and link together: your program, the No value for GDBN debugging stub for your target architecture, and the supporting subroutines.
- Make sure you have a serial connection between your target machine and the No value for GDBN 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 No value for GDBN on the host, and connect to the target (see section Connecting to a Remote Target).