[uClinux-dev] tips on thread aware gdb?

Javier Cardona javier at cozybit.com
Tue Oct 25 13:11:28 EDT 2005

Hi everyone,

I'm struggling to get a thread aware version of gdb working on my target 
(M5275EVB).  I'm using gdb 6.3 with patches to resolve several problems 
(qOffset support, fix SIGILL on continue).  

Now it's pretty much functional except for thread support.  I've applied a 
patch from Andreas Schwab 
( http://sources.redhat.com/ml/gdb-patches/2004-11/msg00419.html ) that 
supposedly enables it.  But thread support under gdb seems to be linked to 
shared library support.  

So far I've explored two paths:  

1. Statically link libpthread_db.a and call thread_db_init() when the host 
sends the 'info threads' command.  (In the original call this call happens 
when libpthread_db.so is loaded).

I'm having version mismatch errors from td_ta_new().  And even disabling the 
version check, the function returns a generic error (TD_ERROR).

Pause.  Try second path.

2.  Enable shared library support and try to produce a libpthread_db.so that 
gdbserver can use.  The first step, enabling shared bin flat format in the 
kernel produces an image that does not boot.

BINFMT_FLAT: library 0 is younger than 1, killing init!
BINFMT_FLAT: failed to load library 1, killing init!
BINFMT_FLAT: library 0 is younger than 1, killing sh!
BINFMT_FLAT: failed to load library 1, killing sh!

I've checked that init and sh were newer than lib1.so.  An e-mail on this list  
suggests that the problem is the opposite:  that the older lib1.so is making 
calls to the newer init.  And I got confused as well...

So bottom line.  If anyone out there has successfully built a thread aware 
gdbserver/gdb for m68knommu I would really appreciate knowing the details.


Javier Cardona
cozybit Inc.

More information about the uClinux-dev mailing list