Chapter 19.Debugging remote programs19.1. Connecting to a remote targetOn the gdb host machine, you will need an unstripped copy of your program, since gdb needs symobland debugging information. Start up gdb as usual, using the name of the local copy of your programas the first argument.If you’re using a serial line, you may want to give gdb the -baud option, or use the set remotebaudcommand before the target command.After that, use target remote to establish communications with the target machine. Its argumentspecifies how to communicate--either via a devicename attached to a direct serial line, or a TCP orUDP port (possibly to a terminal server which in turn has a serial line to the target). For example, touse 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 or tcp:host:port. For example,to connect to port 2828 on a terminal server named manyfarms:target remote manyfarms:2828If your remote target is actually running on the same machine as your debugger session (e.g. a simu-lator of your target running on the same host), you can omit the hostname. For example, to connect toport 1234 on your local machine:target remote :1234Note that the colon is still required here.To use a UDP connection, use an argument of the form udp:host:port. For example, to connect toUDP port 2828 on a terminal server named manyfarms:target remote udp:manyfarms:2828When using a UDP connection for remote debugging, you should keep in mind that the ‘U’ stands for"Unreliable". UDP can silently drop packets on busy or unreliable networks, which will cause havocwith your debugging session.Now you can use all the usual commands to examine and change data and to step and continue theremote program.Whenever gdb is waiting for the remote program, if you type the interrupt character (often [C-C]), gdbattempts to stop the program. This may or may not succeed, depending in part on the hardware and