* minsyms.c (lookup_minimal_symbol): Update comment.

(lookup_minimal_symbol_text): Update comment.  Use the hash table.
	(lookup_minimal_symbol_solib_trampoline): Likewise.
This commit is contained in:
Daniel Jacobowitz 2003-01-08 18:38:47 +00:00
parent aab3ea25c5
commit 72a5efb365
2 changed files with 36 additions and 24 deletions

View file

@ -1,3 +1,9 @@
2003-01-08 Daniel Jacobowitz <drow@mvista.com>
* minsyms.c (lookup_minimal_symbol): Update comment.
(lookup_minimal_symbol_text): Update comment. Use the hash table.
(lookup_minimal_symbol_solib_trampoline): Likewise.
2003-01-08 Andrew Cagney <cagney@redhat.com> 2003-01-08 Andrew Cagney <cagney@redhat.com>
* d10v-tdep.c (d10v_init_extra_frame_info): Use * d10v-tdep.c (d10v_init_extra_frame_info): Use

View file

@ -1,5 +1,6 @@
/* GDB routines for manipulating the minimal symbol tables. /* GDB routines for manipulating the minimal symbol tables.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
@ -135,14 +136,15 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
/* Look through all the current minimal symbol tables and find the /* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit first minimal symbol that matches NAME. If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, limit the search the search to that objfile. If SFILE is non-NULL, the only file-scope
to that source file. Returns a pointer to the minimal symbol that symbols considered will be from that source file (global symbols are
still preferred). Returns a pointer to the minimal symbol that
matches, or NULL if no match is found. matches, or NULL if no match is found.
Note: One instance where there may be duplicate minimal symbols with Note: One instance where there may be duplicate minimal symbols with
the same name is when the symbol tables for a shared library and the the same name is when the symbol tables for a shared library and the
symbol tables for an executable contain global symbols with the same symbol tables for an executable contain global symbols with the same
names (the dynamic linker deals with the duplication). */ names (the dynamic linker deals with the duplication). */
struct minimal_symbol * struct minimal_symbol *
lookup_minimal_symbol (register const char *name, const char *sfile, lookup_minimal_symbol (register const char *name, const char *sfile,
@ -248,12 +250,13 @@ lookup_minimal_symbol (register const char *name, const char *sfile,
} }
/* Look through all the current minimal symbol tables and find the /* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME and of text type. first minimal symbol that matches NAME and has text type. If OBJF
If OBJF is non-NULL, limit is non-NULL, limit the search to that objfile. If SFILE is non-NULL,
the search to that objfile. If SFILE is non-NULL, limit the search the only file-scope symbols considered will be from that source file
to that source file. Returns a pointer to the minimal symbol that (global symbols are still preferred). Returns a pointer to the minimal
matches, or NULL if no match is found. symbol that matches, or NULL if no match is found.
*/
This function only searches the mangled (linkage) names. */
struct minimal_symbol * struct minimal_symbol *
lookup_minimal_symbol_text (register const char *name, const char *sfile, lookup_minimal_symbol_text (register const char *name, const char *sfile,
@ -264,6 +267,8 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile,
struct minimal_symbol *found_symbol = NULL; struct minimal_symbol *found_symbol = NULL;
struct minimal_symbol *found_file_symbol = NULL; struct minimal_symbol *found_file_symbol = NULL;
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING #ifdef SOFUN_ADDRESS_MAYBE_MISSING
if (sfile != NULL) if (sfile != NULL)
{ {
@ -279,10 +284,9 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile,
{ {
if (objf == NULL || objf == objfile) if (objf == NULL || objf == objfile)
{ {
for (msymbol = objfile->msymbols; for (msymbol = objfile->msymbol_hash[hash];
msymbol != NULL && SYMBOL_NAME (msymbol) != NULL && msymbol != NULL && found_symbol == NULL;
found_symbol == NULL; msymbol = msymbol->hash_next)
msymbol++)
{ {
if (SYMBOL_MATCHES_NAME (msymbol, name) && if (SYMBOL_MATCHES_NAME (msymbol, name) &&
(MSYMBOL_TYPE (msymbol) == mst_text || (MSYMBOL_TYPE (msymbol) == mst_text ||
@ -323,12 +327,13 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile,
} }
/* Look through all the current minimal symbol tables and find the /* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME and of solib trampoline type. first minimal symbol that matches NAME and is a solib trampoline. If OBJF
If OBJF is non-NULL, limit is non-NULL, limit the search to that objfile. If SFILE is non-NULL,
the search to that objfile. If SFILE is non-NULL, limit the search the only file-scope symbols considered will be from that source file
to that source file. Returns a pointer to the minimal symbol that (global symbols are still preferred). Returns a pointer to the minimal
matches, or NULL if no match is found. symbol that matches, or NULL if no match is found.
*/
This function only searches the mangled (linkage) names. */
struct minimal_symbol * struct minimal_symbol *
lookup_minimal_symbol_solib_trampoline (register const char *name, lookup_minimal_symbol_solib_trampoline (register const char *name,
@ -338,6 +343,8 @@ lookup_minimal_symbol_solib_trampoline (register const char *name,
struct minimal_symbol *msymbol; struct minimal_symbol *msymbol;
struct minimal_symbol *found_symbol = NULL; struct minimal_symbol *found_symbol = NULL;
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING #ifdef SOFUN_ADDRESS_MAYBE_MISSING
if (sfile != NULL) if (sfile != NULL)
{ {
@ -353,10 +360,9 @@ lookup_minimal_symbol_solib_trampoline (register const char *name,
{ {
if (objf == NULL || objf == objfile) if (objf == NULL || objf == objfile)
{ {
for (msymbol = objfile->msymbols; for (msymbol = objfile->msymbol_hash[hash];
msymbol != NULL && SYMBOL_NAME (msymbol) != NULL && msymbol != NULL && found_symbol == NULL;
found_symbol == NULL; msymbol = msymbol->hash_next)
msymbol++)
{ {
if (SYMBOL_MATCHES_NAME (msymbol, name) && if (SYMBOL_MATCHES_NAME (msymbol, name) &&
MSYMBOL_TYPE (msymbol) == mst_solib_trampoline) MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)