aboutsummaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-01-21 17:12:18 +0000
committerTom Tromey <tromey@redhat.com>2010-01-21 17:12:18 +0000
commit0d5392b8b1b1a362a58e90d4f734ff41c6ab7009 (patch)
treeabd88dba4f076b349109b1380778accfe46fdbc8 /gdb/minsyms.c
parent8b315be588fdf31c348a0f62c4314745ad10b79f (diff)
downloadgdb-0d5392b8b1b1a362a58e90d4f734ff41c6ab7009.zip
gdb-0d5392b8b1b1a362a58e90d4f734ff41c6ab7009.tar.gz
gdb-0d5392b8b1b1a362a58e90d4f734ff41c6ab7009.tar.bz2
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 ee730a4..287f9de 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,