4.3. Running Applications from GDB

You can run GDB, the GNU Debugger, on your host system to debug programs running remotely on a target board or system.

While this section explains the alternatives for using GDB to run and debug application programs, explaining the use of the GDB command-line interface is beyond the scope of this document. Please refer to the GDB manual for further instructions.

4.3.1. Using GDB as a Native Debugger

On IA32 GNU/Linux host systems, if you have built your program with appropriate linker options to find the sysroot on your host, you can use the GDB provided with Sourcery G++ Lite to debug your application running locally on the host as you would any native application.

4.3.2. Connecting to an External GDB Server

Sourcery G++ Lite includes a program called gdbserver that can be used to debug a program running on a remote IA32 GNU/Linux target. Follow the instructions in Chapter 3, “Sourcery G++ Lite for IA32 GNU/Linux” to install and run gdbserver on your target system.

From within GDB, you can connect to a running gdbserver or other debugging stub that uses the GDB remote protocol using:

(gdb) target remote host:port

where host is the host name or IP address of the machine the stub is running on, and port is the port number it is listening on for TCP connections.