* minsyms.c: add new function lookup_minimal_symbol_text, to look

for text symbol only.
	* breakpoint.c (create_longjmp_breakpoint): call
	lookup_minimal_symbol_text instead of lookup_minimal_symbol.
	* symtab.h: add lookup_minimal_symbol_text prototype.
This commit is contained in:
Kung Hsu 1995-04-21 20:02:50 +00:00
parent 66d05e03ad
commit cdd2212f75
2 changed files with 86 additions and 0 deletions

View File

@ -1,3 +1,11 @@
Fri Apr 21 12:57:53 1995 Kung Hsu <kung@mexican.cygnus.com>
* minsyms.c: add new function lookup_minimal_symbol_text, to look
for text symbol only.
* breakpoint.c (create_longjmp_breakpoint): call
lookup_minimal_symbol_text instead of lookup_minimal_symbol.
* symtab.h: add lookup_minimal_symbol_text prototype.
Fri Apr 21 12:03:44 1995 Stan Shebs <shebs@andros.cygnus.com>
* sh-tdep.c (sh-opc.h): Don't include.

View File

@ -176,6 +176,84 @@ lookup_minimal_symbol (name, sfile, objf)
return NULL;
}
/* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME and of text type.
If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, limit the search
to that source file. Returns a pointer to the minimal symbol that
matches, or NULL if no match is found.
*/
struct minimal_symbol *
lookup_minimal_symbol_text (name, sfile, objf)
register const char *name;
const char *sfile;
struct objfile *objf;
{
struct objfile *objfile;
struct minimal_symbol *msymbol;
struct minimal_symbol *found_symbol = NULL;
struct minimal_symbol *found_file_symbol = NULL;
struct minimal_symbol *trampoline_symbol = NULL;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
if (sfile != NULL)
{
char *p = strrchr (sfile, '/');
if (p != NULL)
sfile = p + 1;
}
#endif
for (objfile = object_files;
objfile != NULL && found_symbol == NULL;
objfile = objfile -> next)
{
if (objf == NULL || objf == objfile)
{
for (msymbol = objfile -> msymbols;
msymbol != NULL && SYMBOL_NAME (msymbol) != NULL &&
found_symbol == NULL;
msymbol++)
{
if (SYMBOL_MATCHES_NAME (msymbol, name) &&
(MSYMBOL_TYPE (msymbol) == mst_text ||
MSYMBOL_TYPE (msymbol) == mst_file_text))
{
switch (MSYMBOL_TYPE (msymbol))
{
case mst_file_text:
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
if (sfile == NULL || STREQ (msymbol->filename, sfile))
found_file_symbol = msymbol;
#else
/* We have neither the ability nor the need to
deal with the SFILE parameter. If we find
more than one symbol, just return the latest
one (the user can't expect useful behavior in
that case). */
found_file_symbol = msymbol;
#endif
break;
default:
found_symbol = msymbol;
break;
}
}
}
}
}
/* External symbols are best. */
if (found_symbol)
return found_symbol;
/* File-local symbols are next best. */
if (found_file_symbol)
return found_file_symbol;
return NULL;
}
/* Search through the minimal symbol table for each objfile and find the
symbol whose address is the largest address that is still less than or