aboutsummaryrefslogtreecommitdiff
path: root/gdb/xcoffexec.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-03-29 23:17:36 +0000
committerJohn Gilmore <gnu@cygnus>1992-03-29 23:17:36 +0000
commit84ffdec2cbfe29d96552e3bb392bdad524b57eca (patch)
treebb3a84341b94166bb40fcfcb4bf7dcf12816dc59 /gdb/xcoffexec.c
parentf9e3b3ccc2cdb773011d31eae24a7474b32e3c0a (diff)
downloadfsf-binutils-gdb-84ffdec2cbfe29d96552e3bb392bdad524b57eca.zip
fsf-binutils-gdb-84ffdec2cbfe29d96552e3bb392bdad524b57eca.tar.gz
fsf-binutils-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/xcoffexec.c')
-rw-r--r--gdb/xcoffexec.c61
1 files changed, 5 insertions, 56 deletions
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index d64dec4..544aa47 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -355,48 +355,6 @@ map_vmap (bfd *bf, bfd *arch)
}
-#define FASTER_MSYMBOL_RELOCATION 1
-
-#ifdef FASTER_MSYMBOL_RELOCATION
-
-/* Used to relocate an object file's minimal symbols. */
-
-static void
-reloc_objfile_msymbols (objf, addr)
-struct objfile *objf;
-CORE_ADDR addr;
-{
- register struct minimal_symbol *msymbol;
- int ii;
-
- for (msymbol = objf->msymbols, ii=0;
- msymbol && ii < objf->minimal_symbol_count; ++msymbol, ++ii)
-
- if (msymbol->address < TEXT_SEGMENT_BASE)
- msymbol->address += addr;
-}
-
-#else /* !FASTER_MSYMBOL_RELOCATION */
-
-/* Called via iterate_over_msymbols to relocate minimal symbols */
-
-static int
-relocate_minimal_symbol (objfile, msymbol, arg1, arg2, arg3)
- struct objfile *objfile;
- struct minimal_symbol *msymbol;
- PTR arg1;
- PTR arg2;
- PTR arg3;
-{
- if (msymbol->address < TEXT_SEGMENT_BASE)
- msymbol -> address += (int) arg1;
-
- /* return 0, otherwise `iterate_over_msymbols()' will stop at the
- first iteration. */
- return 0;
-}
-#endif /* FASTER_MSYMBOL_RELOCATION */
-
/* true, if symbol table and minimal symbol table are relocated. */
int symtab_relocated = 0;
@@ -411,11 +369,12 @@ struct stat *vip;
{
register struct symtab *s;
register struct objfile *objfile;
+ register struct minimal_symbol *msymbol;
/*
* for each symbol table generated from the vp->bfd
*/
- for (objfile = object_files; objfile != NULL; objfile = objfile -> next)
+ ALL_OBJFILES (objfile)
{
for (s = objfile -> symtabs; s != NULL; s = s -> next) {
@@ -463,25 +422,15 @@ struct stat *vip;
for (; s; s = s->next)
if (!s->nonreloc || LINETABLE(s))
vmap_symtab_1(s, vp, old_start);
-
-#ifdef FASTER_MSYMBOL_RELOCATION
- /* we can rely on the fact that at least one symtab in this objfile
- will get relocated. Thus, we can be sure that minimal symbol
- vector is guaranteed for relocation. */
-
- reloc_objfile_msymbols (objfile, vp->tstart - old_start);
-#endif
break;
}
}
}
if (vp->tstart != old_start) {
-#ifndef FASTER_MSYMBOL_RELOCATION
- (void) iterate_over_msymbols (relocate_minimal_symbol,
- (PTR) (vp->tstart - old_start),
- (PTR) NULL, (PTR) NULL);
-#endif
+ ALL_MSYMBOLS (objfile, msymbol)
+ if (msymbol->address < TEXT_SEGMENT_BASE)
+ msymbol -> address += vp->tstart - old_start;
/* breakpoints need to be relocated as well. */
fixup_breakpoints (0, TEXT_SEGMENT_BASE, vp->tstart - old_start);