aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKung Hsu <kung@cygnus>1995-04-21 20:02:50 +0000
committerKung Hsu <kung@cygnus>1995-04-21 20:02:50 +0000
commitcdd2212f7514672add02f490e7f7ab19c67d3a6e (patch)
tree6cfa1b3195c25ec6dc19db736f0bcbbfc7f56cd2 /gdb
parent66d05e03ad416a1038df2d26ddcdaf97be94e189 (diff)
downloadgdb-cdd2212f7514672add02f490e7f7ab19c67d3a6e.zip
gdb-cdd2212f7514672add02f490e7f7ab19c67d3a6e.tar.gz
gdb-cdd2212f7514672add02f490e7f7ab19c67d3a6e.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/minsyms.c78
2 files changed, 86 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 24d28a2..b589afb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index c04a353..75281ce 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -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