MirkoBanchi
MirkoBanchi

Reputation: 2253

cross-gdb: fix a mismatch between libthread_db and libpthread

I' ve a cross-gdb configured with --host=i686-pc-linux-gnu --target=powerpc-e300c3-linux-gnu. i can correctly debug an application on a remote board with gdbserver but i get an error about a version mismatch between libthread_db and libpthread so i can't debug threads correctly (gdb recognizes only one thread instead of three threads). Maybe it's is due to a different version of libc: on host machine i've libc2.15 and on target machine lib2.5. I tried to rebuid libc2.5 for host in order to link gdb against to it but it's an hell. Before i get crazy to rebuild it, could someone confirm that it's a libc problem?

Upvotes: 2

Views: 5610

Answers (1)

Employed Russian
Employed Russian

Reputation: 213375

I tried to rebuid libc2.5 for host in order to link gdb against to it

That's not what you need.

What you need, is for gdb to find and load libthread_db.so.1, that matches your target libpthread.so.0.

For this, you need to

  1. build libc-2.5 for host, and
  2. set GDB's libthread-db-search-path such that it finds the libthread_db.so.1 built in step 1.

You don't actually need to build the entire libc in step 1. Something like this should suffice:

mkdir build && cd build
../configure --prefix=/usr
make -C ../nptl_db objdir=`pwd`

Update:

i have GDB 6.6 and there isn't libthread-db-search-path. What is another way to specify that path?

That GDB will just dlopen("libthread_db.so.1", ...). So to make it find the right libthread_db.so.1, you need to adjust LD_LIBRARY_PATH. Using bash:

LD_LIBRARY_PATH=/tmp/glibc-2.5/build/nptl_db gdb /path/to/target/a.out

Upvotes: 2

Related Questions