--- linux-nat.c | 6 +++--- linux-nat.h | 2 +- linux-thread-db.c | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) --- a/linux-nat.c +++ b/linux-nat.c @@ -683,14 +683,14 @@ static void linux_child_post_attach (int pid) { linux_enable_event_reporting (pid_to_ptid (pid)); - check_for_thread_db (); + check_for_thread_db (NULL); } static void linux_child_post_startup_inferior (ptid_t ptid) { linux_enable_event_reporting (ptid); - check_for_thread_db (); + check_for_thread_db (NULL); } static int @@ -891,7 +891,7 @@ linux_child_follow_fork (struct target_o inferior_ptid = ptid_build (child_pid, child_pid, 0); linux_nat_switch_fork (inferior_ptid); - check_for_thread_db (); + check_for_thread_db (NULL); tp = inferior_thread (); tp->step_resume_breakpoint = step_resume_breakpoint; --- a/linux-nat.h +++ b/linux-nat.h @@ -92,7 +92,7 @@ extern struct lwp_info *lwp_list; #define BUILD_LWP(lwp, pid) ptid_build (pid, lwp, 0) /* Attempt to initialize libthread_db. */ -void check_for_thread_db (void); +void check_for_thread_db (struct objfile *objfile); int thread_db_attach_lwp (ptid_t ptid); --- a/linux-thread-db.c +++ b/linux-thread-db.c @@ -48,6 +48,8 @@ #define LIBTHREAD_DB_SO "libthread_db.so.1" #endif +#define LIBPTHREAD_SO "libpthread.so" + /* GNU/Linux libthread_db support. libthread_db is a library, provided along with libpthread.so, which @@ -590,7 +592,7 @@ check_thread_signals (void) and when new shared libraries are loaded into a running process. */ void -check_for_thread_db (void) +check_for_thread_db (struct objfile *objfile) { td_err_e err; static int already_loaded; @@ -645,6 +647,14 @@ check_for_thread_db (void) { case TD_NOLIBTHREAD: /* No thread library was detected. */ + if (objfile && objfile->obfd && objfile->obfd->filename) + { + if (strstr(objfile->obfd->filename, LIBPTHREAD_SO)) + warning (_("Your %s has been stripped.\n" + "GDB will not see other threads, " + "and multithread debugging will be unreliable."), + objfile->obfd->filename); + } break; case TD_OK: @@ -669,7 +679,7 @@ static void thread_db_new_objfile (struct objfile *objfile) { if (objfile != NULL) - check_for_thread_db (); + check_for_thread_db (objfile); } /* Attach to a new thread. This function is called when we receive a