mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 16:05:56 +08:00
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:
@ -76,42 +76,6 @@ compare_minimal_symbols PARAMS ((const void *, const void *));
|
||||
static int
|
||||
compact_minimal_symbols PARAMS ((struct minimal_symbol *, int));
|
||||
|
||||
/* Call the function specified by FUNC for each currently available minimal
|
||||
symbol, for as long as this function continues to return NULL. If the
|
||||
function ever returns non-NULL, then the iteration over the minimal
|
||||
symbols is terminated and the result is returned to the caller.
|
||||
|
||||
The function called has full control over the form and content of the
|
||||
information returned via the non-NULL result, which may be as simple as a
|
||||
pointer to the minimal symbol that the iteration terminated on, or as
|
||||
complex as a pointer to a private structure containing multiple results. */
|
||||
|
||||
PTR
|
||||
iterate_over_msymbols (func, arg1, arg2, arg3)
|
||||
PTR (*func) PARAMS ((struct objfile *, struct minimal_symbol *,
|
||||
PTR, PTR, PTR));
|
||||
PTR arg1;
|
||||
PTR arg2;
|
||||
PTR arg3;
|
||||
{
|
||||
register struct objfile *objfile;
|
||||
register struct minimal_symbol *msymbol;
|
||||
char *result = NULL;
|
||||
|
||||
for (objfile = object_files;
|
||||
objfile != NULL && result == NULL;
|
||||
objfile = objfile -> next)
|
||||
{
|
||||
for (msymbol = objfile -> msymbols;
|
||||
msymbol != NULL && msymbol -> name != NULL && result == NULL;
|
||||
msymbol++)
|
||||
{
|
||||
result = (*func)(objfile, msymbol, arg1, arg2, arg3);
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Look through all the current minimal symbol tables and find the first
|
||||
minimal symbol that matches NAME. If OBJF is non-NULL, it specifies a
|
||||
particular objfile and the search is limited to that objfile. Returns
|
||||
@ -345,7 +309,7 @@ discard_minimal_symbols (foo)
|
||||
while (msym_bunch != NULL)
|
||||
{
|
||||
next = msym_bunch -> next;
|
||||
free (msym_bunch);
|
||||
free ((PTR)msym_bunch);
|
||||
msym_bunch = next;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user