Create and use macros for iterating on symtabs, psymtabs, msymbols.

* minsyms.c (iterate_over_msymbols):  Remove; clunky and slow.
* symfile.h, symtab.h (iterate_over_msymbols):  Remove prototype
* coffread.c (coff_symfile_read):  iterate_over_symtabs => ALL_SYMTABS.
(patch_opaque_types):  Avoid dummy args and result.
* objfiles.c (have_partial_symbols, have_full_symbols,
have_minimal_symbols):  explicit iteration => ALL_OBJFILES; simplify.
(iterate_over_objfiles, iterate_over_symtabs,
iterate_over_psymtabs):  Remove, clunky and slow.
* objfiles.h:  Replace iterate_over_* prototypes with ALL_SYMTABS,
ALL_PSYMTABS, and ALL_MSYMBOLS macros.
* symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
dump_objfile):  Remove dummy args and results.  Move filename
comparisons to callers.
(printsyms_command, printpsyms_command, printmsyms_command,
printobjfiles_command):  iterate_over_* => ALL_*.  Compare filenames.
* symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
list_symbols, make_symbol_completion_list):  Replace explicit
iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
Eliminate Dijkstra flag crap, break out of loops with gotos.
(lookup_symtab_1):  Protect '/' tests from short filenames.
(cplus_mangled_symbol):  Move inline into lookup_symbol.
* xcoffexec.c (relocate_objfile_msymbols):  Remove poor hack.
(relocate_minimal_symbol):  Move inline to vmap_symtab.
(vmap_symtab):  Replace iteration with ALL_OBJFILES,
iterate_over_msymbols with ALL_MSYMBOLS.

Misc cleanup prior to release.

* dwarfread.c (dwarf_build_psymtabs):  Remove mainline test.
* mipsread.c (compare_symtabs, compare_psymtabs):  Remove, unused.
* mipsread.c:  Add prototypes for all static functions.

* symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl):  Remove, unused.
* xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl):  Remove 2nd
unused copy!

* buildsym.c (define_symbol):  Handle global register variables
(from Pierre Willard).  Complain if register numbers are too large.
This commit is contained in:
John Gilmore
1992-03-29 23:17:36 +00:00
parent f9e3b3ccc2
commit 84ffdec2cb
8 changed files with 210 additions and 568 deletions

View File

@ -293,30 +293,34 @@ have_full_symbols PARAMS ((void));
extern int
have_minimal_symbols PARAMS ((void));
extern PTR
iterate_over_objfiles PARAMS ((PTR (*func) (struct objfile *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
extern PTR
iterate_over_symtabs PARAMS ((PTR (*func) (struct objfile *, struct symtab *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
extern PTR
iterate_over_psymtabs PARAMS ((PTR (*func) (struct objfile *,
struct partial_symtab *,
PTR arg1, PTR arg2, PTR arg3),
PTR arg1, PTR arg2, PTR arg3));
/* Traverse all object files. ALL_OBJFILES_SAFE works even if you delete
the objfile during the traversal. */
#define ALL_OBJFILES(obj) \
for ((obj)=object_files; (obj)!=NULL; (obj)=(obj)->next)
for ((obj) = object_files; (obj) != NULL; (obj) = (obj)->next)
#define ALL_OBJFILES_SAFE(obj,nxt) \
for ((obj)=object_files; (obj)!=NULL?((nxt)=(obj)->next,1):0; (obj)=(nxt))
for ((obj) = object_files; \
(obj) != NULL? ((nxt)=(obj)->next,1) :0; \
(obj) = (nxt))
/* Traverse all symtabs in all objfiles. */
#define ALL_SYMTABS(objfile, s) \
ALL_OBJFILES (objfile) \
for ((s) = (objfile) -> symtabs; (s) != NULL; (s) = (s) -> next)
/* Traverse all psymtabs in all objfiles. */
#define ALL_PSYMTABS(objfile, p) \
ALL_OBJFILES (objfile) \
for ((p) = (objfile) -> psymtabs; (p) != NULL; (p) = (p) -> next)
/* Traverse all minimal symbols in all objfiles. */
#define ALL_MSYMBOLS(objfile, m) \
ALL_OBJFILES (objfile) \
for ((m) = (objfile) -> msymbols; (m)->name != NULL; (m)++)
#endif /* !defined (OBJFILES_H) */