From 17a37d488c16b07d3a1f069ef727e2e53c622722 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Fri, 15 May 2009 16:53:45 +0000 Subject: 2009-05-15 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. --- gdb/solib.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gdb/solib.c') diff --git a/gdb/solib.c b/gdb/solib.c index 0eae200..8b330b1 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -684,16 +684,25 @@ update_solib_list (int from_tty, struct target_ops *target) } } -/* Return non-zero if SO is the libpthread shared library. + +/* Return non-zero if NAME is the libpthread shared library. Uses a fairly simplistic heuristic approach where we check the file name against "/libpthread". This can lead to false positives, but this should be good enough in practice. */ +int +libpthread_name_p (const char *name) +{ + return (strstr (name, "/libpthread") != NULL); +} + +/* Return non-zero if SO is the libpthread shared library. */ + static int libpthread_solib_p (struct so_list *so) { - return (strstr (so->so_name, "/libpthread") != NULL); + return libpthread_name_p (so->so_name); } /* GLOBAL FUNCTION -- cgit v1.1