8.5. Connecting to Target

Using gdb, there are two basic methods of connecting to the target machine when you debug a program. These are:

  • Using gdbserver program

  • Using a stub

In this section we shall discuss the gdbserver method in detail because it is the same for all platforms. The stub method differs from platform to platform and you need to create stub file(s) for your target and tailor these into your code.

8.5.1. Using gdbserver with GNU Debugger

The gdbserver utility comes with GNU debugger. I have used gdb version 5.1.1 and you can compile the gdbserver after you compile your debugger. If the host machine is different from the target machine, you must cross-compile the gdbserver program. This utility can run a program on a remote target ...

Get Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming Environment, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.