From 6612ad7f9f2fb352fc1bb76a669d2b64fa0b24e2 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Thu, 19 Oct 2006 19:58:23 +0000 Subject: [PATCH] * solib.c (libpthread_solib_p): New function. (solib_add): Always read the symbols from the libpthread library. --- gdb/ChangeLog | 5 +++++ gdb/solib.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6de65e33b9c..1c11ec268f9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2006-10-19 Joel Brobecker + + * solib.c (libpthread_solib_p): New function. + (solib_add): Always read the symbols from the libpthread library. + 2006-10-19 Andrew Stubbs * breakpoint.c (describe_other_breakpoints): Add thread parameter. diff --git a/gdb/solib.c b/gdb/solib.c index c26a000e2b3..4fa9fce65f6 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -615,6 +615,17 @@ update_solib_list (int from_tty, struct target_ops *target) } } +/* Return non-zero if SO 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. */ + +static int +libpthread_solib_p (struct so_list *so) +{ + return (strstr (so->so_name, "/libpthread") != NULL); +} /* GLOBAL FUNCTION @@ -661,8 +672,16 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms) for (gdb = so_list_head; gdb; gdb = gdb->next) if (! pattern || re_exec (gdb->so_name)) { + /* Normally, we would read the symbols from that library + only if READSYMS is set. However, we're making a small + exception for the pthread library, because we sometimes + need the library symbols to be loaded in order to provide + thread support (x86-linux for instance). */ + const int add_this_solib = + (readsyms || libpthread_solib_p (gdb)); + any_matches = 1; - if (readsyms && solib_read_symbols (gdb, from_tty)) + if (add_this_solib && solib_read_symbols (gdb, from_tty)) loaded_any_symbols = 1; } -- 2.30.2