Remote GDB for Embedded Developement

Sometimes it can be tough debugging a program built with a cross compiler for an embedded system. The embedded system might not have enough memory to run gdb. It probably has enough memory to run gdbserver though and this can be extremely handy.

The first step of running a remote gdb session with gdbserver is building gdb for the target platform that runs on the host. Download your desired gdb version and configure it something like this:

./configure --target="target-cpu" --host=i686-host_pc-linux-gnu
--with-headers=/path/to/headers/for/cross/compiler

On the embedded system, run your process under gdbserver and specifiy a port to listen to:

$ gdbserver host:1234 a.out

On your development system with the source code, run the gdb that you built.

$ ./gdb a.out
gdb> target remote 10.0.1.1:1234
gdb> c

Comments are closed.