In summary, when your program is ready to debug, you must follow these steps.
getDebugChar
,putDebugChar
,flush_i_cache
,memset
,exceptionHandler
.
set_debug_traps(); breakpoint();
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 when
continues after stopping on a trap (for example, bus
error). The function indicated by exceptionHook
is called with
one parameter: an int
which is the exception number.
target remote
command.
Its argument specifies how to communicate with the target
machine--either via a devicename attached to a direct serial line, or a
TCP port (usually to a terminal server which in turn has a serial line
to the target). For example, to use a serial line connected to the
device named `/dev/ttyb':
target remote /dev/ttybTo use a TCP connection, use an argument of the form
host:port
. For example, to connect to port 2828 on a
terminal server named manyfarms
:
target remote manyfarms:2828
Now you can use all the usual commands to examine and change data and to step and continue the remote program.
To resume the remote program and stop debugging it, use the detach
command.
Whenever is waiting for the remote program, if you type the interrupt character (often C-C), attempts to stop the program. This may or may not succeed, depending in part on the hardware and the serial drivers the remote system uses. If you type the interrupt character once again, displays this prompt:
Interrupted while waiting for the program. Give up (and stop debugging it)? (y or n)
If you type y, abandons the remote debugging session. (If you decide you want to try again later, you can use `target remote' again to connect once more.) If you type n, goes back to waiting.
Go to the first, previous, next, last section, table of contents.