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

@ -57,12 +57,14 @@ other things to work on, if you get bored. :-)
#include "defs.h"
#include <varargs.h>
#include <fcntl.h>
#include <string.h>
#include "bfd.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "symfile.h"
#include "objfiles.h"
#include "libbfd.h" /* FIXME Secret Internal BFD stuff (bfd_read) */
#include "elf/dwarf.h"
#include "buildsym.h"
@ -310,7 +312,7 @@ read_structure_scope PARAMS ((struct dieinfo *, char *, char *,
struct objfile *));
static struct type *
decode_array_element_type PARAMS ((char *, char *));
decode_array_element_type PARAMS ((char *));
static struct type *
decode_subscr_data PARAMS ((char *, char *));
@ -436,17 +438,9 @@ dwarf_build_psymtabs (desc, filename, addr, mainline, dbfoff, dbsize,
init_psymbol_list (objfile, 1024);
}
/* From this point on, we don't need to pass mainline around, so zap
baseaddr to zero if we don't need relocation. */
/* Save the relocation factor where everybody can see it. */
if (mainline)
{
baseaddr = 0;
}
else
{
baseaddr = addr;
}
baseaddr = addr;
/* Follow the compilation unit sibling chain, building a partial symbol
table entry for each one. Save enough information about each compilation
@ -934,15 +928,15 @@ DESCRIPTION
*/
static struct type *
decode_array_element_type (scan, end)
decode_array_element_type (scan)
char *scan;
char *end;
{
struct type *typep;
short attribute;
DIEREF dieref;
unsigned short fundtype;
/* FIXME, does this confuse the host and target sizeof's? --gnu */
(void) memcpy (&attribute, scan, sizeof (short));
scan += sizeof (short);
switch (attribute)
@ -1020,7 +1014,7 @@ decode_subscr_data (scan, end)
switch (format)
{
case FMT_ET:
typep = decode_array_element_type (scan, end);
typep = decode_array_element_type (scan);
break;
case FMT_FT_C_C:
(void) memcpy (&fundtype, scan, sizeof (short));
@ -1865,7 +1859,7 @@ read_ofile_symtab (pst)
if (LNFOFF (pst))
{
if (bfd_seek (abfd, LNFOFF (pst), 0) ||
(bfd_read (&lnsize, sizeof(long), 1, abfd) != sizeof(long)))
(bfd_read ((PTR)&lnsize, sizeof(long), 1, abfd) != sizeof(long)))
{
error ("can't read DWARF line number table size");
}
@ -2043,11 +2037,11 @@ init_psymbol_list (objfile, total_symbols)
if (objfile -> global_psymbols.list)
{
mfree (objfile -> md, objfile -> global_psymbols.list);
mfree (objfile -> md, (PTR)objfile -> global_psymbols.list);
}
if (objfile -> static_psymbols.list)
{
mfree (objfile -> md, objfile -> static_psymbols.list);
mfree (objfile -> md, (PTR)objfile -> static_psymbols.list);
}
/* Current best guess is that there are approximately a twentieth