In summary, when your program is ready to debug, you must follow these steps.
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
GDBcontinues after stopping on a trap (for example, bus error). The function indicated by
exceptionHookis called with one parameter: an
intwhich is the exception number.
target remotecommand. 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
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
Whenever GDB is waiting for the remote program, if you type the interrupt character (often C-C), GDB 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, GDB displays this prompt:
Interrupted while waiting for the program. Give up (and stop debugging it)? (y or n)
If you type y, GDB 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, GDB goes back to waiting.
Go to the first, previous, next, last section, table of contents.