News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

GDB gains support for remote debugging of multithreaded programs

Jun 17, 2002 — by LinuxDevices Staff — from the LinuxDevices Archive — 1 views

Dan Kegel writes . . .

As Linux becomes more popular with embedded system developers, it's becoming increasingly important for gdb to be able to do remote debugging of multithreaded programs in an embedded Linux target. As of gdb 5.2, gdb's “gdbserver” remote probe did not support this.

At long last, this situation is improving. On 11 June 2002, Daniel Jacobowitz added support for remote debugging of multithreaded programs. As of June 15th, this is only in the CVS tree; hopefully it will make its way to a gdb release soon.

I have tested this feature on x86 and ppc405 linux, and it works — from an x86 Debian system, I successfully debugged multithreaded programs running on remote x86 and ppc405 Linux boxes. There are a few gotchas:

  • It's not well-documented how to build gdbserver for cross-debugging (though it's not as hard as it used to be). I believe you have to configure and make gdb, then configure and make gdbserver. I'll try to post a recipe here soon.
  • When cross-debugging (i.e. when the remote system is running a different OS or on a different processor type), you have to use commands like

    set solib-absolute-prefix /dev/null
    set solib-search-path /opt/hardhat/devkit/ppc/405/target/lib

    when you start gdb so it can find your shared libraries, or it will fail with strange errors. The GDB manual is silent on this important topic; Daniel Jacobowitz told me about it, and I also found some doc about it at Axis Communications.

  • When you start gdb and attach to a remote gdbserver, you must 'continue' rather than 'run', as the program is already started.
  • It's ok to run a stripped binary on the remote system as long as you keep the unstripped binary around for use by gdb on the local system. This is pretty important, since unstripped binaries compiled with -g can be too big to fit on some embedded devices.

Hats off to Daniel Jacobowitz of Montavista Software for getting this feature in, and for his active support of gdb on the gdb mailing list.

Related Web Pages

Copyright 2002 Dan Kegel; reproduced by LinuxDevices.com with permission. Last update: June 17, 2002 — for updates, visit Dan's website.

 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.