This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch][rfc] Allow GDB to search for the right libthread_db.so.1
Hi Paul,
On Thu, Apr 30, 2009 at 04:30, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> On Thu, Apr 23, 2009 at 4:32 AM, Hui Zhu <teawater@gmail.com> wrote:
>> In function thread_db_load, I suggest try_thread_db_load with
>> libthread_db_search_path first.
>> Cause I think if user set a directory, he must want it be loaded.
>
> Hui made two suggestions:
>
> 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.
>
> 2. Allow libthread_db_search_path contain files as well as directories.
3. And in thread_db_load:
+ msym = lookup_minimal_symbol ("nptl_version", NULL, NULL);
+ if (!msym)
+ msym = lookup_minimal_symbol ("__linuxthreads_version", NULL, NULL);
+
+ /* Some really old libpthread versions do not have either of the above. */
+ if (!msym)
+ msym = lookup_minimal_symbol ("__pthread_threads_events", NULL, NULL);
+
+ if (!msym)
+ /* No threads yet */
+ return 0;
You really don't want gdb try it with libthread_db?
If in the future, this code doesn't cover everything. And I think let
gdb try will not affect anything. :)
>
> Both are (IMHO) reasonable, though I don't particularly like either.
>
> Implementing 1) will cause a bit of searching, because most of the time
> the libthread_db which "parallels" libpthread is the right one (at least
> for us), and the search is really there mostly for static executables
> (which are somewhat rare here).
If user set the directory, I think he must want gdb use it directly.
>
> Implementing 2) "clouds" the meaning of libthread_db_search_path somewhat,
> and it is quite unlikely (though certainlyh possible) that libthread_db
> will be called anything other than libthread_db.so.1 on Linux.
Why not let user can set a file to be libthread_db? Maybe this
directory doesn't have soft link, just a "libthread_db-1.0.so".
Thanks,
Hui