2003-06-11 David Carlton <carlton@bactrian.org>

* dictionary.h: New.
	* dictionary.c: New.
	* block.h: Add opaque declaration for struct dictionary.
	(struct block): Add 'dict' member; delete 'hashtable', 'nsyms',
	'sym' members.
	(BLOCK_DICT): New macro.
	Delete macros BLOCK_HASHTABLE, BLOCK_NSYMS, BLOCK_SYM,
	BLOCK_BUCKETS, BLOCK_BUCKET, BLOCK_HASHTABLE_SIZE,
	BLOCK_SHOULD_SORT.
	(ALL_BLOCK_SYMBOLS): Update definition.
	* Makefile.in (SFILES): Add dictionary.c.
	(dictionary_h): New.
	(COMMON_OBS): Add dictionary.o.
	(dictionary.o): New.
	(ada-lang.o): Depend on dictionary_h.
	(buildsym.o, coffread.o, jv-lang.o, mdebugread.o, objfiles.o)
	(stack.o, symmisc.o, symtab.o, tracepoint.o, valops.o)
	(mi-cmd-stack.o): Ditto.
	(gdbtk-cmds.o): Update dependencies.
	(gdbtk-stack.o): Ditto.
	* ada-lang.c: Include dictionary.h.
	(symtab_for_sym): Update uses of ALL_BLOCK_SYMBOLS.
	(fill_in_ada_prototype, debug_print_block): Ditto.
	(ada_add_block_symbols): Update uses of ALL_BLOCK_SYMBOLS; replace
	explicit iteration by use of ALL_BLOCK_SYMBOLS.  Delete variable
	'is_sorted'.
	* mdebugread.c: Include dictionary.h.
	(struct parse_stack): Delete 'maxsyms' member.
	(parse_symbol): Update calls to new_block.  Delete calls to
	shrink_block.  Use dictionary methods.
	(psymtab_to_symtab_1): Delete calls to sort_symtab_syms.
	Update calls to new_symtab.  Don't maintain maxsyms data.
	(mylookup_symbol): Update use of ALL_BLOCK_SYMBOLS.
	(add_symbol): Just call dict_add_symbol.
	(new_symtab): Delete 'maxsyms' argument.
	(new_symtab): Update calls to new_block.
	(new_block): Delete 'maxsyms' argument; add 'function' argument.
	(shrink_block): Delete function.
	(fixup_sigtramp): Update call to new_block.  Add symbol via
	dict_add_symbol.
	* jv-lang.c: Include dictionary.h.
	(get_java_class_symtab): Set the BLOCK_DICT of the blocks
	appropriately.  Set class_symtab->free_func.  Make sure the
	blockvector is big enough to hold two blocks.
	(add_class_symtab_symbol): Use dictionary methods.
	(free_class_block): New function.
	(type_from_class): Replace explicit iteration by
	ALL_BLOCK_SYMBOLS.
	* symtab.h (struct symtab): Replace 'free_ptr' method by
	'free_func'.
	* dwarf2read.c (psymtab_to_symtab_1): Delete call to
	sort_symtab_syms.
	* dwarfread.c (psymtab_to_symtab_1): Delete call to
	sort_symtab_syms.
	* coffread.c (coff_symfile_read): Delete call to sort_symtab_syms.
	Include dictionary.h.
	(patch_opaque_types): Update use of ALL_BLOCK_SYMBOLS.
	* dbxread.c (dbx_psymtab_to_symtab_1): Delete call to
	sort_symtab_syms.
	* objfiles.c: Include dictionary.h.
	(objfile_relocate): Update use of ALL_BLOCK_SYMBOLS.
	* buildsym.c: Include dictionary.h.
	(finish_block): Use dictionary methods.
	(end_symtab): Set free_func to NULL, not free_ptr.
	* tracepoint.c: Include dictionary.h.
	(add_local_symbols): Update use of ALL_BLOCK_SYMBOLS.
	(scope_info): Ditto.
	* stack.c: Include dictionary.h.
	(print_block_frame_locals): Update use of ALL_BLOCK_SYMBOLS.
	(print_block_frame_labels, print_frame_arg_vars)
	(print_frame_args): Ditto.
	* symmisc.c (free_symtab_block): Use dictionary methods.
	(dump_symtab): Ditto.
	(free_symtab): Replace use of 'free_ptr' by 'free_func'.
	Include	dictionary.h.
	* symfile.h: Delete declarations of sort_block_syms,
	sort_symtab_syms.
	* symfile.c (sort_block_syms): Delete.
	(sort_symtab_syms): Delete.
	* symtab.c: Include dictionary.h.
	(lookup_block_symbol): Use dictionary iterators.
	(find_pc_sect_symtab): Update use of ALL_BLOCK_SYMBOLS.
	(search_symbols, make_symbol_completion_list): Ditto.
	(make_symbol_overload_list): Ditto.
	* valops.c (value_of_local): Use dict_empty.
	Include dictionary.h.

2003-06-11  David Carlton  <carlton@bactrian.org>

	* generic/gdbtk-stack.c: Include dictionary.h.
	(gdb_block_vars): Update use of ALL_BLOCK_SYMBOLS.
	(gdb_get_blocks, gdb_get_vars_command): Ditto.
	* generic/gdbtk-cmds.c: Include dictionary.h.
	(gdb_listfuncs): Update use of ALL_BLOCK_SYMBOLS.

2003-06-11  David Carlton  <carlton@bactrian.org>

	* mi-cmd-stack.c: Include dictionary.h.
	(list_args_or_locals): Update use of ALL_BLOCK_SYMBOLS.
This commit is contained in:
David Carlton
2003-06-11 23:29:49 +00:00
parent cdfbf930b9
commit de4f826b0f
21 changed files with 1330 additions and 372 deletions

View File

@@ -42,6 +42,7 @@
#include "block.h"
#include "stack.h"
#include "gdb_assert.h"
#include "dictionary.h"
/* Prototypes for exported functions. */
@@ -211,7 +212,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
{
struct block *b = NULL;
int first = 1;
register int i;
struct dict_iterator iter;
register struct symbol *sym;
struct value *val;
/* Offset of next stack argument beyond the one we have seen that is
@@ -230,11 +231,8 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
if (func)
{
b = SYMBOL_BLOCK_VALUE (func);
/* Function blocks are order sensitive, and thus should not be
hashed. */
gdb_assert (BLOCK_HASHTABLE (b) == 0);
ALL_BLOCK_SYMBOLS (b, i, sym)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
QUIT;
@@ -1311,14 +1309,15 @@ backtrace_full_command (char *arg, int from_tty)
Return 1 if any variables were printed; 0 otherwise. */
static int
print_block_frame_locals (struct block *b, register struct frame_info *fi,
int num_tabs, register struct ui_file *stream)
print_block_frame_locals (struct block *b, struct frame_info *fi,
int num_tabs, struct ui_file *stream)
{
register int i, j;
register struct symbol *sym;
register int values_printed = 0;
struct dict_iterator iter;
int j;
struct symbol *sym;
int values_printed = 0;
ALL_BLOCK_SYMBOLS (b, i, sym)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
switch (SYMBOL_CLASS (sym))
{
@@ -1350,11 +1349,11 @@ static int
print_block_frame_labels (struct block *b, int *have_default,
register struct ui_file *stream)
{
register int i;
struct dict_iterator iter;
register struct symbol *sym;
register int values_printed = 0;
ALL_BLOCK_SYMBOLS (b, i, sym)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
{
@@ -1532,7 +1531,7 @@ print_frame_arg_vars (register struct frame_info *fi,
{
struct symbol *func = get_frame_function (fi);
register struct block *b;
register int i;
struct dict_iterator iter;
register struct symbol *sym, *sym2;
register int values_printed = 0;
@@ -1543,7 +1542,7 @@ print_frame_arg_vars (register struct frame_info *fi,
}
b = SYMBOL_BLOCK_VALUE (func);
ALL_BLOCK_SYMBOLS (b, i, sym)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
switch (SYMBOL_CLASS (sym))
{