This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch][rfc] Allow GDB to search for the right

On Thu, Apr 30, 2009 at 12:11 PM, Paul Pluzhnikov
<> wrote:

> On Thu, Apr 30, 2009 at 11:55 AM, Joel Brobecker <> wrote:
>>> 1. If libthread_db_search_path is set, use it *before* trying to load
>>> ? ?libthread_db from the same directory where libpthread was loaded in the
>>> ? ?inferior.
>> From my naive perspective (never really had a need for this feature),
>> it seems better to check the path before checking the path that was
>> used by the inferior. ?Otherwise, if the local host has a library
>> at the same location but that's different from the library used
>> by the inferior, we wouldn't be able to force the debugger to use
>> a different library, would we?
> Assume inferior is using remote:/a/b/c/

Actually, in case of remote debugging gdb will not use libthread_db at all
(gdbserver uses it).

> I'll invert the order of search, get rid of symbol lookup, and send an
> updated patch shortly.


Note that documentation changed slightly to reflect the new search order.

Tested on Linux/x86_64, no regressions.
Also tested by running with several incompatible versions of libpthread.

Paul Pluzhnikov

2009-04-30  Paul Pluzhnikov  <>

	* NEWS: Mention set/show libthread-db-search-path.

	* gdb_thread_db.h (LIBTHREAD_DB_SEARCH_PATH): New define.
	(LIBTHREAD_DB_SO): Moved from linux-thread-db.c

	* linux-thread-db.c (libthread_db_search_path): New setting.
	(thread_db_handle): New variable (replaces using_thread_db).
	(try_thread_db_load_1): New function.
	(try_thread_db_load, thread_db_load_search): Likewise.
	(dladdr_to_soname): Likewise.
	(thread_db_load): Iterate over possibly multiple libthread_db's.
	(check_for_thread_db): Attempt to load new libthread_db.
	(thread_db_detach, thread_db_wait): Unload libthread_db.
	(thread_db_mourn_inferior): Likewise.
	(_initialize_thread_db): Add new libthread-db-search-path option.
	Defer loading of libthread_db to check_for_thread_db.

	* solib.c (libpthread_name_p): New function.
	(libpthread_solib_p): Call it.

	* solib.h (libpthread_name_p): New prototype.


2009-04-30  Paul Pluzhnikov  <>

	* gdb.texinfo (Threads): Document libthread-db-search-path.

Attachment: gdb-thread-db.20090430.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]