4.3. Running Applications from GDB
Prev | Chapter 4. Using Sourcery G++ from the Command Line | Next

## 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.

When starting GDB, give it the pathname to the program you want to debug as a command-line argument. For example, if you have built the factorial program as described in Section 4.1, “Building an Application”, enter:

    > c6x-uclinux-gdb factorial.gdb

For uClinux you must specify the ELF binary, not the FLT binary that you load onto your target.

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. 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 C6000 uClinux target. Follow the instructions in Chapter 3, “Sourcery G++ Lite for C6000 uClinux” 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.

Prev | Up | Next
4.2. Running Applications on the Target System | Home | Chapter 5. Next Steps with Sourcery G++