O'Reilly logo

Linux: Embedded Development by Chris Simmonds, Alex González, Alexandru Vaduva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Starting to debug

Now that you have gdbserver installed on the target and a cross GDB on the host you can start a debug session.

Connecting GDB and gdbserver

The connection between GDB and gdbserver can be through a network or a serial interface. In the case of a network connection, you launch gdbserver with the TCP port number to listen on and, optionally, an IP address to accept connections from. In most cases you don't care which IP address is going to connect, so you can just give the port number. In this example gdbserver waits for a connection on port 10000 from any host:

# gdbserver :10000 ./hello-world
Process hello-world created; pid = 103
Listening on port 10000

Next, start the copy of GDB from your toolchain, giving the same program as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required