forked from Imagelibrary/binutils-gdb
2002-07-11 Daniel Jacobowitz <drow@mvista.com>
Based on patch from Daniel Berlin <dberlin@dberlin.org>. * buildsym.c: Include "demangle.h" for SYMBOL_INIT_DEMANGLED_NAME. (finish_block) For non-function blocks, hash the symbol table. For function blocks, mark the symbol table as unhashed. * minsyms.c (msymbol_hash): Return hash value without taking modulus. (msymbol_hash_iw): Likewise. (add_minsym_to_hash_table): Take modulus of msymbol_hash's return value. (add_minsym_to_demangled_hash_table): Likewise for msymbol_hash_iw. (lookup_minimal_symbol): Likewise for both. * symtab.h (struct block): Add `hashtable' flag. Comment the hashtable. (BLOCK_HASHTABLE, BLOCK_BUCKETS, BLOCK_BUCKET): New macro. (ALL_BLOCK_SYMBOLS): Update. (BLOCK_SHOULD_SORT): Do not sort hashed blocks. (struct symbol): Add `hash_next' pointer. * symtab.c (lookup_block_symbol): Search using the hash table when possible. (find_pc_sect_symtab): Use ALL_BLOCK_SYMBOLS. (search_symbols, find_addr_symbol): Likewise. * dstread.c (process_dst_block): Clear hashtable bit for new block. (read_dst_symtab): Likewise. * jv-lang.c (get_java_class_symtab): Likewise. * mdebugread.c: Include "gdb_assert.h". (shrink_block): Assert that the block being modified is not hashed. * coffread.c (patch_opaque_types): Use ALL_BLOCK_SYMBOLS. * symmisc.c (free_symtab_block): Walk the hash table when freeing symbols. (dump_symtab): Recognize hashed blocks. * printcmd.c (print_frame_args): Assert that function blocks do not have hashed symbol tables. * ada-lang.c (symtab_for_sym): Use ALL_BLOCK_SYMBOLS. (fill_in_ada_prototype, debug_print_block): Likewise. (ada_add_block_symbols): Use ALL_BLOCK_SYMBOLS. Handle hash tables.
This commit is contained in:
@@ -86,11 +86,17 @@ static void
|
||||
free_symtab_block (struct objfile *objfile, struct block *b)
|
||||
{
|
||||
register int i, n;
|
||||
n = BLOCK_NSYMS (b);
|
||||
struct symbol *sym, *next_sym;
|
||||
|
||||
n = BLOCK_BUCKETS (b);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
xmfree (objfile->md, SYMBOL_NAME (BLOCK_SYM (b, i)));
|
||||
xmfree (objfile->md, (PTR) BLOCK_SYM (b, i));
|
||||
for (sym = BLOCK_BUCKET (b, i); sym; sym = next_sym)
|
||||
{
|
||||
next_sym = sym->hash_next;
|
||||
xmfree (objfile->md, SYMBOL_NAME (sym));
|
||||
xmfree (objfile->md, (PTR) sym);
|
||||
}
|
||||
}
|
||||
xmfree (objfile->md, (PTR) b);
|
||||
}
|
||||
@@ -457,8 +463,14 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
|
||||
fprintf_filtered (outfile, " under ");
|
||||
gdb_print_host_address (BLOCK_SUPERBLOCK (b), outfile);
|
||||
}
|
||||
blen = BLOCK_NSYMS (b);
|
||||
fprintf_filtered (outfile, ", %d syms in ", blen);
|
||||
/* drow/2002-07-10: We could save the total symbols count
|
||||
even if we're using a hashtable, but nothing else but this message
|
||||
wants it. */
|
||||
blen = BLOCK_BUCKETS (b);
|
||||
if (BLOCK_HASHTABLE (b))
|
||||
fprintf_filtered (outfile, ", %d buckets in ", blen);
|
||||
else
|
||||
fprintf_filtered (outfile, ", %d syms in ", blen);
|
||||
print_address_numeric (BLOCK_START (b), 1, outfile);
|
||||
fprintf_filtered (outfile, "..");
|
||||
print_address_numeric (BLOCK_END (b), 1, outfile);
|
||||
@@ -474,8 +486,8 @@ dump_symtab (struct objfile *objfile, struct symtab *symtab,
|
||||
if (BLOCK_GCC_COMPILED (b))
|
||||
fprintf_filtered (outfile, ", compiled with gcc%d", BLOCK_GCC_COMPILED (b));
|
||||
fprintf_filtered (outfile, "\n");
|
||||
/* Now print each symbol in this block. */
|
||||
/* FIXMED: Sort? */
|
||||
/* Now print each symbol in this block (in no particular order, if
|
||||
we're using a hashtable). */
|
||||
ALL_BLOCK_SYMBOLS (b, j, sym)
|
||||
{
|
||||
struct print_symbol_args s;
|
||||
|
||||
Reference in New Issue
Block a user