Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: Kurvivor19 on October 07, 2016, 01:20:31 PM
-
I am trying to compile and debud a multi-threaded program (pthreads). I have compiled it succesfully, however when i try to run it under gdb, i get "threading debug not available" warning every time.
I am using TinyCore, and i have installed gcc and gdb from extension repository, as usual.
What should i do to be able to debug threads under gdb? Are there extra packages i need to install or some settings that need to be enabled?
-
Do you get this message because the tinycore glibc is stripped?
-
I do not really know the reason, or to be more precise, i do nt fully understand what these messages mean
Here is the full text of warning messages:
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "Set solib-search-path" or "set sysroot"?
warning: File "/tmp/tcloop/glibc_add_lib/lib/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
<skilpped lines about security protection>
warning: Unable to find libthread_db matching inferior's hread library, thread debugging will not be available.
-
You get these messages because the tinycore glibc has the debugging symbols stripped out of it to make it smaller.
Usually this does not impact the debugging of other applications - if you use "threads all" (or whatever the command is in gdb) you should be OK, no?
-
Well, it is the last message, which is
warning: Unable to find libthread_db matching inferior's hread library, thread debugging will not be available.
is what worries me.
No matter what i do, i seem unable to see anythreads beside main one when i list them. It seems that is expected behaviour when libthread_db and libpthread do not match - but why are they not matching? It is certainly strange for libraries from same repository to fail to match.
-
I was recently dubugging something on tinycore and "thread apply all backtrace" showed the different threads.
libthread_db is in the glibc_add_lib extension, but I was not using the extension, are you?
-
That extension was pulled together with gdb
To clarify: do you get any warnings?
-
Yes, but as long as you're not debugging glibc itself it should be OK
-
Well, in my case i still a) get warning about libthread_db and libpthread no matching b) do not see any threads except main one (listing with `thread apply all bt` ot `info threads`) even when several threads are running for sure.
this is very distressing for me
-
I see the same warning in the x86 and x86_64 versions of gdb.
Both libpthread-2.22.so and libthread_db-1.0.so are from the same version of glibc, so I'm not sure why the warnings are given.
As per google, plenty of people have the same problem, but I did not find any obvious solutions :(
-
At stackoverflow, this
You have stripped libpthread.so.0 (don't do that).
is listed as possible reason
If that is the case, could not-stripped libpthread be provided?
-
Or, even, according to: http://stackoverflow.com/questions/866721/how-to-generate-gcc-debug-symbol-outside-the-build-target - symbols can be provided in a separate tgx file, which would be consistent with TinyCore design
I am begging you to do that. I am quite desperate
-
I'm not sure about the script in the link you provided, but if I overwrite libpthread-2.22.so and libthread_db-1.0.so with versions containing debug symbols, I get this:
(gdb) run
Starting program: /usr/local/bin/fifth
warning: Could not load shared library symbols for linux-gate.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 0xb58eab40 (LWP 4402)]
[New Thread 0xb5860b40 (LWP 4403)]
[New Thread 0xb56f2b40 (LWP 4404)]
..which looks promising.
Now I need to think how to make this available...
-
Since i am using old version of tinycore (6, i believe, with 3.16.6 kernel), an instruction for how to build those libraries with symbols would suffice.
-
see the second time glibc is built in:
http://tinycorelinux.net/6.x/x86/release/src/toolchain/compile_tc6_x86
..substitute "sudo make install_root=/tmp/pkg install" for "sudo make install" to avoid overwriting the existing files.
-
To clarify: you mean this part:
cd glibc-2.20
patch -Np1 -i ../glibc-2.20-fhs-1.patch
mkdir ../glibc-build
cd ../glibc-build
echo "CFLAGS += -march=i486 -mtune=i686 -Os -pipe" > configparms
../glibc-2.20/configure --prefix=/usr --libexecdir=/usr/lib/glibc --disable-profile --enable-kernel=3.8.13 --enable-obsolete-rpc
find . -name config.make -type f -exec sed -i 's/-O2/ /g' {} \;
make
touch /etc/ld.so.conf
make install
Is that correct?
From what i understand, that file you linked is a build log for old tinycore from another environment (thus typical cross-compilation activity of first building compiler that can compile to needed target and then using it). I can get sources from the same location
Trying it out now
-
You are a life-saver
gdb_thread-db is indeed the package i needed. Now gdb says that it can debug threads, which i will now commence doing.
Thanks!