Unable to Debug Multi-Threaded Application with gdb

angstrom-linux, beagleboard, debugging, gdb, multithreading

Solution

warning: Unable to find libthread_db matching inferior's thread library

This means that your `/lib/libthread_db.so.1` does not match your `/lib/libpthread.so.0`. Such mismatch could be the result of you installing different versions of `libc` and `libthread_db` packages, or updating one or the other outside of the package management system. It could also be an error in your packages (i.e. they may not be built correctly).

You should ignore `/lib/.debug/*` -- that is not the library you are looking for.

Problem

I am debugging a multi-threaded application with gdb, but when I start the program in gdb I get the warning: warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. I can still debug, but I can't debug anything other than the main thread. I have read forums that suggest installing the packages libthread-db1 and glibc-dbg, but this does not correct the problem for me. On my machine I have the 3 files `/lib/libthread_db.so.1`, `/lib/.debug/libthread_db-1.0.so`, and `/lib/libthread_db-1.0.so`. I tried creating symbolic links in `/lib` with the name `libthread_db.so`, one time pointing at the `/lib/libthread_db.so.1` file, and another time pointing at the `/lib/libthread_db-1.0.so` file, and also I created the symbolic link `/lib/.debug/libthread_db.so` pointing to `/lib/.debug/libthread_db-1.0.so`, all with no luck. In gdb I have tried setting `libthread-db-search-path` to `/lib` (with the symlink once set to `libthread_db.so.1`, and once to `libthread_db-1.0.so`, and also set to `/lib/.debug`. Any suggestions? I am using Angstrom Linux v2.6.39 for the BeagleBoard-xm.

Original source