2

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?

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

6 Comments

Thank you. I'll try to do that. However i have GDB 6.6 and there isn't libthread-db-search-path. What is another way to specify that path?
libc by default doesn't allow to launch configure inside src root dir so i have a dir build and launch inside it ../configure --prefix=/usr but make -C ../nptl_db doesn't work due to path of config.make...any idea?
@MirkoBanchi I've updated the answer for both of your comments.
Thanks. However for now i can't rebuild ntpl_db
@MirkoBanchi None of the versions of GDB I've seen do that. You can see what GDB is doing by also setting LD_DEBUG=libs before invoking it.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.