aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
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
commitde4f826b0f698dc2858f6eda71f2613a89579c50 (patch)
tree13525aa41c328ee4018f4feb9c45ad204fee014f /gdb/ada-lang.c
parentcdfbf930b96d5ae51342f34dd180323a8011f8ef (diff)
downloadgdb-de4f826b0f698dc2858f6eda71f2613a89579c50.zip
gdb-de4f826b0f698dc2858f6eda71f2613a89579c50.tar.gz
gdb-de4f826b0f698dc2858f6eda71f2613a89579c50.tar.bz2
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/ada-lang.c')
-rw-r--r--gdb/ada-lang.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a37ed69..eaa5281 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -40,6 +40,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ui-out.h"
#include "block.h"
#include "infcall.h"
+#include "dictionary.h"
struct cleanup *unresolved_names;
@@ -3433,7 +3434,8 @@ symtab_for_sym (struct symbol *sym)
struct objfile *objfile;
struct block *b;
struct symbol *tmp_sym;
- int i, j;
+ struct dict_iterator iter;
+ int j;
ALL_SYMTABS (objfile, s)
{
@@ -3447,10 +3449,10 @@ symtab_for_sym (struct symbol *sym)
case LOC_BLOCK:
case LOC_CONST_BYTES:
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
- ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym)
+ ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
return s;
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
- ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym)
+ ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
return s;
break;
default:
@@ -3474,7 +3476,7 @@ symtab_for_sym (struct symbol *sym)
j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1)
{
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), j);
- ALL_BLOCK_SYMBOLS (b, i, tmp_sym) if (sym == tmp_sym)
+ ALL_BLOCK_SYMBOLS (b, iter, tmp_sym) if (sym == tmp_sym)
return s;
}
break;
@@ -3947,7 +3949,7 @@ ada_add_block_symbols (struct block *block, const char *name,
domain_enum domain, struct objfile *objfile,
int wild)
{
- int i;
+ struct dict_iterator iter;
int name_len = strlen (name);
/* A matching argument symbol, if any. */
struct symbol *arg_sym;
@@ -3960,7 +3962,7 @@ ada_add_block_symbols (struct block *block, const char *name,
if (wild)
{
struct symbol *sym;
- ALL_BLOCK_SYMBOLS (block, i, sym)
+ ALL_BLOCK_SYMBOLS (block, iter, sym)
{
if (SYMBOL_DOMAIN (sym) == domain &&
wild_match (name, name_len, DEPRECATED_SYMBOL_NAME (sym)))
@@ -3989,7 +3991,7 @@ ada_add_block_symbols (struct block *block, const char *name,
}
else
{
- ALL_BLOCK_SYMBOLS (block, i, sym)
+ ALL_BLOCK_SYMBOLS (block, iter, sym)
{
if (SYMBOL_DOMAIN (sym) == domain)
{
@@ -4034,7 +4036,7 @@ ada_add_block_symbols (struct block *block, const char *name,
arg_sym = NULL;
found_sym = 0;
- ALL_BLOCK_SYMBOLS (block, i, sym)
+ ALL_BLOCK_SYMBOLS (block, iter, sym)
{
struct symbol *sym = BLOCK_SYM (block, i);
@@ -4098,7 +4100,7 @@ fill_in_ada_prototype (struct symbol *func)
{
struct block *b;
int nargs, nsyms;
- int i;
+ struct dict_iterator iter;
struct type *ftype;
struct type *rtype;
size_t max_fields;
@@ -4124,7 +4126,7 @@ fill_in_ada_prototype (struct symbol *func)
max_fields = 8;
TYPE_FIELDS (ftype) =
(struct field *) xmalloc (sizeof (struct field) * max_fields);
- ALL_BLOCK_SYMBOLS (b, i, sym)
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
{
GROW_VECT (TYPE_FIELDS (ftype), max_fields, nargs + 1);
@@ -4697,8 +4699,8 @@ debug_print_lines (struct linetable *lt)
static void
debug_print_block (struct block *b)
{
- int i;
- struct symbol *i;
+ struct dict_iterator iter;
+ struct symbol *sym;
fprintf (stderr, "Block: %p; [0x%lx, 0x%lx]",
b, BLOCK_START (b), BLOCK_END (b));
@@ -4707,10 +4709,8 @@ debug_print_block (struct block *b)
fprintf (stderr, "\n");
fprintf (stderr, "\t Superblock: %p\n", BLOCK_SUPERBLOCK (b));
fprintf (stderr, "\t Symbols:");
- ALL_BLOCK_SYMBOLS (b, i, sym)
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- if (i > 0 && i % 4 == 0)
- fprintf (stderr, "\n\t\t ");
fprintf (stderr, " %s", DEPRECATED_SYMBOL_NAME (sym));
}
fprintf (stderr, "\n");