reverse-step multithread error
Asked Answered
T

1

6

I get the following message in gdb (version 7.1):

[Thread debugging using libthread_db enabled]

and the command reverse-step

results with the following error message:

(gdb) reverse-step
Target multi-thread does not support this command

I am debugging a serial code right now, so I definitely do not need multi-threading. Can I turn this off somehow so that I get the latest reverse-debug commands to work? Also, if the code is parallelised with OpenMPI, there will be no need for multi-thread debugging at all, right?

Edit: Is this set as a compilation flag that can be just excluded?

Teddi answered 8/7, 2011 at 13:56 Comment(0)
T
10

You don't mention which version of GDB you're using, but since a little while, the parameter libthread-db-search-path is available.

(gdb) set libthread-db-search-path /tmp
(gdb) start
Temporary breakpoint 1 at 0x400632: file threads.c, line 14.
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

will tell GDB to lookup it's helper library (libthread-db.so) in a directory where it isn't, so multithread debugging won't be enabled!

I'm not sure about OpenMPI parallel applications are multiprocesses (in contrast with OpenMP where they are multithreaded), so it won't change anything for you.

EDIT: Multithread debugging is usually only enabled when libpthread.so or equivalent is loaded by your process (ldd your-process to check if it's linked as a shared library) so if you don't need it, there might be a problem in your compilation script.

Tosha answered 8/7, 2011 at 14:15 Comment(3)
Thanks a lot! I set the libthread-db-search-path, but still, I get: [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". I will need to take a more careful look into this. The multithreading is enabled by default, and the piece of code that I'm working on is serial (for the moment). Gdb version: GNU gdb (GDB) 7.2-ubuntuTeddi
strange, I doubled checked it's working in my machine! if you're desperate, you can always remove/rename your /lib/libthread_db.so.1 library :)Tosha
/tmp is one of the worst directories you could use. Anyone on the system could install a malicious /tmp/libthread_db.so.1 and you would then be pwned.Intersidereal

© 2022 - 2024 — McMap. All rights reserved.