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. There is another post on this forum that suggested 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 set 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?
Hi,
I found this (http://sourceware.org/gdb/onlinedocs/gdb/Threads.html):
“… If this initialization fails (which could happen because of a version mismatch between libthread_db
and libpthread
), …”
And it’s exactly what gdb warns. So, it seems they have to match, otherwise it won’t work… I think you can copy both libraries from your toolchain. For example:
toolchain-i586/i586-phi-linux-gnu/gcc-4.3.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/sysroot-i586-phi-linux-gnu/lib/libthread_db-1.0.so
and
toolchain-i586/i586-phi-linux-gnu/gcc-4.3.2-glibc-2.14.1-binutils-2.21.1a-kernel-2.6.39-sanitized/sysroot-i586-phi-linux-gnu/lib/libpthread-2.14.1.so
Att,
Fernando Akira Endo
Phi Innovations
Av. José Rocha Bomfim, 214 - Cj. 16
Cond. Praça Capital - Ed. Londres
Center Santa Genebra
13080-650 - Campinas - SP - Brasil
+55 19 3709-1358
2012/7/20 Sam <samuel.hishmeh@gmail.com>
There are 8 files my toolchain:
arm/usr/lib/libthread_db.so
arm/usr/lib/libpthread.so
arm/lib/libthread_db.so.1
arm/lib/libpthread.so.0
arm/lib/libpthread-2.12.2.so
arm/lib/.debug/libpthread-2.12.2.so
arm/lib/.debug/libthread_db-1.0.so
arm/lib/libthread_db-1.0.so
I moved all of these from root file system, and replaced the moved files with the ones in my tool chain. I ran make, and make seg faults before I see any other printout.
I tried just moving and replacing the 2 files you mentioned, lib/libthread_db-1.0.so and lib/libpthread-2.14.1.so, and make complained about not being able to load the shared object file libpthread.so.0 because it did not exist (even though it did). So I replaced that file, libpthread.so.0, with the one from the toolchain, and again Make seg faulted.
Any ideas? Note that I started with a root file system from 2.6.32 kernel (Angstrom-Beagleboard-demo-image-glibc-ipk-2011.1-beagleboard.rootfs.tar.bz2), and copied the linux source into /usr/src, and cross-compiled a new kernel based on 2.6.39. This is likely the reason for the version mismatch.
Note there is one more file in question. /lib/libpthread.a. I have not tried copying it from the toolchain to my root file system. Also, I had one hint, from testing, that a restart is needed after copying the files from the toolchain, and I also I have not tried that.
Sorry, I couldn’t understand, are you recompiling gdb-server? If so, did you ‘make clean’ it?
I couldn’t understand your point regarding the kernel versions either. You just need a toolchain with built-in kernel headers on it to compile the kernel.
Att,
Fernando Akira Endo
Phi Innovations
Av. José Rocha Bomfim, 214 - Cj. 16
Cond. Praça Capital - Ed. Londres
Center Santa Genebra
13080-650 - Campinas - SP - Brasil
+55 19 3709-1358
2012/7/23 Sam <samuel.hishmeh@gmail.com>
I’m not compling gdb-server. I wanted to compile kernel modules natively. The package linux-headers (and a dozen others packages others recommended on forums didn’t work for me). So I found instructions at http://elinux.org/BeagleBoardLinuxKernel combined with http://veter-project.blogspot.com/2012/03/comfortable-kernel-workflow-on.html, to build a custom kernel, and used the kernel source as the linux-headers so I could compile kernel modules.
Hello,
This became a bit confusing… If you’re only compiling modules (externally it seems), you don’t have to mix with the user space (libraries).
If you want to build modules that are already ‘supported’ by the kernel, you have to access its ‘menuconfig’. If you want to build modules externally, you have to point the kernel souce code on the makefile of the module (http://lwn.net/Articles/81398/).
You can also add a new module inside the kernel source (as your second link shows).
Att,
Fernando Akira Endo
Phi Innovations
Av. José Rocha Bomfim, 214 - Cj. 16
Cond. Praça Capital - Ed. Londres
Center Santa Genebra
13080-650 - Campinas - SP - Brasil
+55 19 3709-1358
2012/7/23 Sam <samuel.hishmeh@gmail.com>
Hello,
This became a bit confusing… If you’re only compiling modules (externally it seems), you don’t have to mix with the user space (libraries).
The root file system that I downloaded was originally used with a 2.6.32 kernel, and the user space shared object thread libraries from that root file system were a different version (libpthread and libthread_db) than what was provided by the cross compiler. Not sure if this matters…??
If you want to build modules that are already ‘supported’ by the kernel, you have to access its ‘menuconfig’. If you want to build modules externally, you have to point the kernel souce code on the makefile of the module (http://lwn.net/Articles/81398/).
I only want externally, but I will have to have the kernel source that matches the file system I have for the 2.6.32 kernel, is it possible to checkout the kernel source that matches the demo angstrom file system? (http://www.angstrom-distribution.org/demo/beagleboard/Angstrom-Beagleboard-demo-image-glibc-ipk-2011.1-beagleboard.rootfs.tar.bz2). Checking out the linux-headers package with this file system did not give me the ability to compile kernel modules, I can’t remember what the error was.
Surely there is a pre-packaged root file system and uImage that has the features that I want, which are: ALSA sound support, compile kernel modules natively, and user space thread level debugging. Any idea where I can find one?