summaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-01-21 17:12:15 +0000
committerTom Tromey <tromey@redhat.com>2010-01-21 17:12:15 +0000
commit56ff1af56823251daaa909753c00911cd792a876 (patch)
treef0aa0a3ac8245dc63449b712ffb882ff6958a10b /gdb/minsyms.c
parentbfc7edb055a61bd8cf5dee7cefab1313bdc98ea1 (diff)
downloadgdb-56ff1af56823251daaa909753c00911cd792a876.tar.gz
PR symtab/11198:
* symtab.h (lookup_minimal_symbol_and_objfile): Declare. * minsyms.c (lookup_minimal_symbol_and_objfile): New function. * glibc-tdep.c (find_minsym_and_objfile): Remove. (glibc_skip_solib_resolver): Use lookup_minimal_symbol_and_objfile.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index ee730a449a9..287f9de875e 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -693,6 +693,37 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc)
{
return lookup_minimal_symbol_by_pc_section (pc, NULL);
}
+
+/* Find the minimal symbol named NAME, and return both the minsym
+ struct and its objfile. This only checks the linkage name. Sets
+ *OBJFILE_P and returns the minimal symbol, if it is found. If it
+ is not found, returns NULL. */
+
+struct minimal_symbol *
+lookup_minimal_symbol_and_objfile (const char *name,
+ struct objfile **objfile_p)
+{
+ struct objfile *objfile;
+ unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
+
+ ALL_OBJFILES (objfile)
+ {
+ struct minimal_symbol *msym;
+
+ for (msym = objfile->msymbol_hash[hash];
+ msym != NULL;
+ msym = msym->hash_next)
+ {
+ if (strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
+ {
+ *objfile_p = objfile;
+ return msym;
+ }
+ }
+ }
+
+ return 0;
+}
/* Return leading symbol character for a BFD. If BFD is NULL,