diff options
author | John Gilmore <gnu@cygnus> | 1992-03-29 23:17:36 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1992-03-29 23:17:36 +0000 |
commit | 84ffdec2cbfe29d96552e3bb392bdad524b57eca (patch) | |
tree | bb3a84341b94166bb40fcfcb4bf7dcf12816dc59 /gdb/objfiles.c | |
parent | f9e3b3ccc2cdb773011d31eae24a7474b32e3c0a (diff) | |
download | gdb-84ffdec2cbfe29d96552e3bb392bdad524b57eca.zip gdb-84ffdec2cbfe29d96552e3bb392bdad524b57eca.tar.gz gdb-84ffdec2cbfe29d96552e3bb392bdad524b57eca.tar.bz2 |
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.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 124 |
1 files changed, 9 insertions, 115 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 66bfd56..faf9e96 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -272,17 +272,15 @@ int have_partial_symbols () { struct objfile *ofp; - int havethem = 0; - for (ofp = object_files; ofp; ofp = ofp -> next) + ALL_OBJFILES (ofp) { if (ofp -> psymtabs != NULL) { - havethem++; - break; + return 1; } } - return (havethem); + return 0; } /* Many places in gdb want to test just to see if we have any full @@ -293,17 +291,15 @@ int have_full_symbols () { struct objfile *ofp; - int havethem = 0; - for (ofp = object_files; ofp; ofp = ofp -> next) + ALL_OBJFILES (ofp) { if (ofp -> symtabs != NULL) { - havethem++; - break; + return 1; } } - return (havethem); + return 0; } /* Many places in gdb want to test just to see if we have any minimal @@ -314,119 +310,17 @@ int have_minimal_symbols () { struct objfile *ofp; - int havethem = 0; - for (ofp = object_files; ofp; ofp = ofp -> next) + ALL_OBJFILES (ofp) { if (ofp -> msymbols != NULL) { - havethem++; - break; + return 1; } } - return (havethem); + return 0; } -/* Call the function specified by FUNC for each currently available objfile, - for as long as this function continues to return NULL. If the function - ever returns non-NULL, then the iteration over the objfiles 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 objfile that - the iteration terminated on, or as complex as a pointer to a private - structure containing multiple results. */ - -PTR -iterate_over_objfiles (func, arg1, arg2, arg3) - PTR (*func) PARAMS ((struct objfile *, PTR, PTR, PTR)); - PTR arg1; - PTR arg2; - PTR arg3; -{ - register struct objfile *objfile; - PTR result = NULL; - - for (objfile = object_files; - objfile != NULL && result == NULL; - objfile = objfile -> next) - { - result = (*func)(objfile, arg1, arg2, arg3); - } - return (result); -} - -/* Call the function specified by FUNC for each currently available symbol - table, for as long as this function continues to return NULL. If the - function ever returns non-NULL, then the iteration over the symbol tables - 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 symtab that the iteration terminated on, or as complex as a - pointer to a private structure containing multiple results. */ - -PTR -iterate_over_symtabs (func, arg1, arg2, arg3) - PTR (*func) PARAMS ((struct objfile *, struct symtab *, PTR, PTR, PTR)); - PTR arg1; - PTR arg2; - PTR arg3; -{ - register struct objfile *objfile; - register struct symtab *symtab; - PTR result = NULL; - - for (objfile = object_files; - objfile != NULL && result == NULL; - objfile = objfile -> next) - { - for (symtab = objfile -> symtabs; - symtab != NULL && result == NULL; - symtab = symtab -> next) - { - result = (*func)(objfile, symtab, arg1, arg2, arg3); - } - } - return (result); -} - -/* Call the function specified by FUNC for each currently available partial - symbol table, for as long as this function continues to return NULL. If - the function ever returns non-NULL, then the iteration over the partial - symbol tables 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 partial symbol table that the iteration terminated on, or - as complex as a pointer to a private structure containing multiple - results. */ - -PTR -iterate_over_psymtabs (func, arg1, arg2, arg3) - PTR (*func) PARAMS ((struct objfile *, struct partial_symtab *, - PTR, PTR, PTR)); - PTR arg1; - PTR arg2; - PTR arg3; -{ - register struct objfile *objfile; - register struct partial_symtab *psymtab; - PTR result = NULL; - - for (objfile = object_files; - objfile != NULL && result == NULL; - objfile = objfile -> next) - { - for (psymtab = objfile -> psymtabs; - psymtab != NULL && result == NULL; - psymtab = psymtab -> next) - { - result = (*func)(objfile, psymtab, arg1, arg2, arg3); - } - } - return (result); -} - - /* Look for a mapped symbol file that corresponds to FILENAME and is more recent than MTIME. If MAPPED is nonzero, the user has asked that gdb use a mapped symbol file for this file, so create a new one if one does |