• gdbserver is launched on the target system, with the arguments: • Either a device name (to use a serial line) or a TCP hostname and port number, and • The path and filename of the executable to be debugged • :It then waits passively for the host gdb to communicate with it. • gdb is run on the host, with the arguments: • The path and filename of the executable (and any sources) on the host, and • A device name (for a serial line) or the IP address and port number needed for connection to the target system. Example for debugging a program called hello_world on a remote target using TCP ("2159" is the
registered TCP port number for remote GDB): remote@~$ gdbserver :2159 hello_world Process hello_world created; pid = 2509 Listening on port 2159 local@~$ gdb -q hello_world Reading symbols from /home/user/hello_world...done. (gdb) target remote 192.168.0.11:2159 Remote debugging using 192.168.0.11:2159 0x002f3850 in ?? () from /lib/ld-linux.so.2 (gdb) continue Continuing. Program received signal SIGSEGV, Segmentation fault. 0x08048414 in main () at hello_world.c:10 10 printf("x[%d] = %g\n", i, x[i]); (gdb) == Alternatives ==