summaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-07-11 20:46:19 +0000
committerDaniel Jacobowitz <drow@false.org>2002-07-11 20:46:19 +0000
commit261397f84f0369d189de8ddf4c331f282a59ed89 (patch)
treed1128ec86122474bb8fc28de99f4d902e3092e09 /gdb/minsyms.c
parent7c1f909cd5369d517b431f176f33dc4aef79f4a7 (diff)
downloadbinutils-gdb-261397f84f0369d189de8ddf4c331f282a59ed89.tar.gz
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.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 4fa1d911f08..b1ef28ffa5f 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -91,7 +91,7 @@ msymbol_hash_iw (const char *string)
++string;
}
}
- return hash % MINIMAL_SYMBOL_HASH_SIZE;
+ return hash;
}
/* Compute a hash code for a string. */
@@ -102,7 +102,7 @@ msymbol_hash (const char *string)
unsigned int hash = 0;
for (; *string; ++string)
hash = hash * 67 + *string - 113;
- return hash % MINIMAL_SYMBOL_HASH_SIZE;
+ return hash;
}
/* Add the minimal symbol SYM to an objfile's minsym hash table, TABLE. */
@@ -112,7 +112,7 @@ add_minsym_to_hash_table (struct minimal_symbol *sym,
{
if (sym->hash_next == NULL)
{
- unsigned int hash = msymbol_hash (SYMBOL_NAME (sym));
+ unsigned int hash = msymbol_hash (SYMBOL_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
sym->hash_next = table[hash];
table[hash] = sym;
}
@@ -126,7 +126,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
{
if (sym->demangled_hash_next == NULL)
{
- unsigned int hash = msymbol_hash_iw (SYMBOL_DEMANGLED_NAME (sym));
+ unsigned int hash = msymbol_hash_iw (SYMBOL_DEMANGLED_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
sym->demangled_hash_next = table[hash];
table[hash] = sym;
}
@@ -154,8 +154,8 @@ lookup_minimal_symbol (register const char *name, const char *sfile,
struct minimal_symbol *found_file_symbol = NULL;
struct minimal_symbol *trampoline_symbol = NULL;
- unsigned int hash = msymbol_hash (name);
- unsigned int dem_hash = msymbol_hash_iw (name);
+ unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
+ unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
if (sfile != NULL)