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

@ -147,6 +147,9 @@ struct complaint invalid_member_complaint =
struct complaint range_type_base_complaint =
{"base type %d of range type is not defined", 0, 0};
struct complaint reg_value_complaint =
{"register number too large in symbol %s", 0, 0};
int
hashname (name)
@ -340,7 +343,7 @@ really_free_pendings (foo)
for (next = free_pendings; next; next = next1)
{
next1 = next->next;
free (next);
free ((PTR)next);
}
free_pendings = 0;
@ -348,7 +351,7 @@ really_free_pendings (foo)
for (bnext = pending_blocks; bnext; bnext = bnext1)
{
bnext1 = bnext->next;
free (bnext);
free ((PTR)bnext);
}
#endif
pending_blocks = 0;
@ -356,14 +359,14 @@ really_free_pendings (foo)
for (next = file_symbols; next; next = next1)
{
next1 = next->next;
free (next);
free ((PTR)next);
}
file_symbols = 0;
for (next = global_symbols; next; next = next1)
{
next1 = next->next;
free (next);
free ((PTR)next);
}
global_symbols = 0;
}
@ -607,7 +610,7 @@ pop_subfile ()
name = link->name;
subfile_stack = link->next;
header_file_prev_index = link->prev_index;
free (link);
free ((PTR)link);
return name;
}
@ -820,7 +823,7 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile)
if (global_stabs) {
patch_block_stabs (global_symbols, global_stabs, objfile);
free (global_stabs);
free ((PTR)global_stabs);
global_stabs = 0;
}
@ -892,10 +895,10 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile)
#endif
}
if (subfile->line_vector)
free (subfile->line_vector);
free ((PTR)subfile->line_vector);
nextsub = subfile->next;
free (subfile);
free ((PTR)subfile);
}
#ifdef IBM6000_TARGET
@ -1393,17 +1396,32 @@ define_symbol (valu, string, desc, type, objfile)
#endif /* no BELIEVE_PCC_PROMOTION_TYPE. */
case 'P':
/* Parameter which is in a register. */
SYMBOL_CLASS (sym) = LOC_REGPARM;
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS)
{
complain (&reg_value_complaint, SYMBOL_NAME (sym));
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
add_symbol_to_list (sym, &local_symbols);
break;
case 'r':
/* Register variable (either global or local). */
SYMBOL_CLASS (sym) = LOC_REGISTER;
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS)
{
complain (&reg_value_complaint, SYMBOL_NAME (sym));
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
}
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
add_symbol_to_list (sym, &local_symbols);
if (within_function)
add_symbol_to_list (sym, &local_symbols);
else
add_symbol_to_list (sym, &file_symbols);
break;
case 'S':
@ -2631,7 +2649,9 @@ read_struct_type (pp, type, objfile)
for the derived classes, but for the fact that by then,
we don't remember who needs what. */
#if 0
int predicted_fieldno = -1;
#endif
/* Now we must record the virtual function table pointer's
field information. */
@ -3164,14 +3184,14 @@ read_range_type (pp, typenums, objfile)
/* a signed type */
/* FIXME -- the only way to distinguish `int' from `long' is to look
at its name! */
if ((n3 == (1 << (8 * sizeof (long) - 1)) - 1) &&
if ((n3 ==(long)(((unsigned long)1 << (8 * sizeof (long) - 1)) - 1)) &&
long_kludge_name && long_kludge_name[0] == 'l' /* long */)
return (lookup_fundamental_type (objfile, FT_LONG));
if (n3 == (1 << (8 * sizeof (int) - 1)) - 1)
if (n3 == (long)(((unsigned long)1 << (8 * sizeof (int) - 1)) - 1))
return (lookup_fundamental_type (objfile, FT_INTEGER));
if (n3 == (1 << (8 * sizeof (short) - 1)) - 1)
if (n3 == ( 1 << (8 * sizeof (short) - 1)) - 1)
return (lookup_fundamental_type (objfile, FT_SHORT));
if (n3 == (1 << (8 * sizeof (char) - 1)) - 1)
if (n3 == ( 1 << (8 * sizeof (char) - 1)) - 1)
return (lookup_fundamental_type (objfile, FT_CHAR));
}