summaryrefslogtreecommitdiff
path: root/gdb/block.h
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-06-11 23:29:49 +0000
committerDavid Carlton <carlton@bactrian.org>2003-06-11 23:29:49 +0000
commit6afb912169008ca88ae1acb2746d32027594cdf2 (patch)
tree198086cb3584312551286fa92b1a8fcef27eb0c3 /gdb/block.h
parent9c7a09f028d4e7a7c9c59e88d14f55a50d1fa801 (diff)
downloadgdb-6afb912169008ca88ae1acb2746d32027594cdf2.tar.gz
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.
Diffstat (limited to 'gdb/block.h')
-rw-r--r--gdb/block.h58
1 files changed, 11 insertions, 47 deletions
diff --git a/gdb/block.h b/gdb/block.h
index 2917bc32977..aa69a896f6a 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -29,6 +29,7 @@ struct symtab;
struct block_namespace_info;
struct using_direct;
struct obstack;
+struct dictionary;
/* All of the name-scope contours of the program
are represented by `struct block' objects.
@@ -77,6 +78,10 @@ struct block
struct block *superblock;
+ /* This is used to store the symbols in the block. */
+
+ struct dictionary *dict;
+
/* Used for language-specific info. */
union
@@ -104,34 +109,6 @@ struct block
of this flag is undefined. */
unsigned char gcc_compile_flag;
-
- /* The symbols for this block are either in a simple linear list or
- in a simple hashtable. Blocks which correspond to a function
- (which have a list of symbols corresponding to arguments) use
- a linear list, as do some older symbol readers (currently only
- mdebugread and dstread). Other blocks are hashed.
-
- The hashtable uses the same hash function as the minsym hashtables,
- found in minsyms.c:minsym_hash_iw. Symbols are hashed based on
- their demangled name if appropriate, and on their name otherwise.
- The hash function ignores space, and stops at the beginning of the
- argument list if any.
-
- The table is laid out in NSYMS/5 buckets and symbols are chained via
- their hash_next field. */
-
- /* If this is really a hashtable of the symbols, this flag is 1. */
-
- unsigned char hashtable;
-
- /* Number of local symbols. */
-
- int nsyms;
-
- /* The symbols. If some of them are arguments, then they must be
- in the order in which we would like to print them. */
-
- struct symbol *sym[1];
};
#define BLOCK_START(bl) (bl)->startaddr
@@ -139,28 +116,15 @@ struct block
#define BLOCK_FUNCTION(bl) (bl)->function
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
+#define BLOCK_DICT(bl) (bl)->dict
#define BLOCK_NAMESPACE(bl) (bl)->language_specific.cplus_specific.namespace
-#define BLOCK_HASHTABLE(bl) (bl)->hashtable
-
-/* For blocks without a hashtable (BLOCK_HASHTABLE (bl) == 0) only. */
-#define BLOCK_NSYMS(bl) (bl)->nsyms
-#define BLOCK_SYM(bl, n) (bl)->sym[n]
-
-/* For blocks with a hashtable, but these are valid for non-hashed blocks as
- well - each symbol will appear to be one bucket by itself. */
-#define BLOCK_BUCKETS(bl) (bl)->nsyms
-#define BLOCK_BUCKET(bl, n) (bl)->sym[n]
-
-/* Macro used to set the size of a hashtable for N symbols. */
-#define BLOCK_HASHTABLE_SIZE(n) ((n)/5 + 1)
-/* Macro to loop through all symbols in a block BL, in no particular order.
- i counts which bucket we are in, and sym points to the current symbol. */
+/* Macro to loop through all symbols in a block BL, in no particular
+ order. ITER helps keep track of the iteration, and should be a
+ struct dict_iterator. SYM points to the current symbol. */
-#define ALL_BLOCK_SYMBOLS(bl, i, sym) \
- for ((i) = 0; (i) < BLOCK_BUCKETS ((bl)); (i)++) \
- for ((sym) = BLOCK_BUCKET ((bl), (i)); (sym); \
- (sym) = (sym)->hash_next)
+#define ALL_BLOCK_SYMBOLS(block, iter, sym) \
+ ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
struct blockvector
{