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
I have just a few minor comments on this. Overall, I am heartily
in favor of the idea - I have carried a less elegant version of this
feature in the Debian GDB packages for two years or so.
On Fri, Apr 17, 2009 at 12:13:08PM -0700, Paul Pluzhnikov wrote:
> +#ifndef LIBTHREAD_DB_SO
> +#define LIBTHREAD_DB_SO "libthread_db.so.1"
> +#endif
> +
> +#ifndef LIBTHREAD_DB_SEARCH_PATH
> +#define LIBTHREAD_DB_SEARCH_PATH ""
> +#endif
Do we intend to let anything override these? Otherwise IMHO the
ifndef just confuses the issue.
> +static int
> +try_thread_db_load_1(void *handle)
Space before paren :-)
> + if (info_verbose && strchr(library, '/') == NULL)
Oh, here too.
> + 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;
Why is this symbol lookup necessary? Is it accomplishing the same
thing that searching for a shared library matching "libpthread[-.]"
would? Also see libpthread_solib_p, which uses basically that
method.
> + libthread_db_search_path = xstrdup(LIBTHREAD_DB_SEARCH_PATH);
Space there too :-)
--
Daniel Jacobowitz
CodeSourcery