From cbd705375949178b1929fa12075ee9e8e0da7601 Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Tue, 31 Aug 2010 17:26:08 +0000 Subject: Enable custom bcache hash function. 2010-08-25 Sami Wagiaalla * psymtab.c (add_psymbol_to_bcache): Remove 'static' from 'static partial_symbol psymbol'. (psymbol_hash): New function. (psymbol_compare): New function. * bcache.c (hash_continue): New. (hash): Use hash_continue. * bcache.c: Add hash_function and compare_function pointers to bcache struct. (bcache_full): Use bcache->hash_function, and bcache->compare_function. (bcache_compare): New function. (bcache_xmalloc): Take hash_function and compare_function arguments and initialize the bcach's pointers. Updated comment. * objfiles.c (allocate_objfile): Updated. * symfile.c (reread_symbols): Updated. * python/py-type.c (typy_richcompare): Updated. --- gdb/symfile.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gdb/symfile.c') diff --git a/gdb/symfile.c b/gdb/symfile.c index 2cb6b7f..048b8a8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2432,11 +2432,12 @@ reread_symbols (void) /* Free the obstacks for non-reusable objfiles */ bcache_xfree (objfile->psymbol_cache); - objfile->psymbol_cache = bcache_xmalloc (); + objfile->psymbol_cache = bcache_xmalloc (psymbol_hash, + psymbol_compare); bcache_xfree (objfile->macro_cache); - objfile->macro_cache = bcache_xmalloc (); + objfile->macro_cache = bcache_xmalloc (NULL, NULL); bcache_xfree (objfile->filename_cache); - objfile->filename_cache = bcache_xmalloc (); + objfile->filename_cache = bcache_xmalloc (NULL,NULL); if (objfile->demangled_names_hash != NULL) { htab_delete (objfile->demangled_names_hash); @@ -2458,9 +2459,10 @@ reread_symbols (void) memset (&objfile->msymbol_demangled_hash, 0, sizeof (objfile->msymbol_demangled_hash)); - objfile->psymbol_cache = bcache_xmalloc (); - objfile->macro_cache = bcache_xmalloc (); - objfile->filename_cache = bcache_xmalloc (); + objfile->psymbol_cache = bcache_xmalloc (psymbol_hash, + psymbol_compare); + objfile->macro_cache = bcache_xmalloc (NULL, NULL); + objfile->filename_cache = bcache_xmalloc (NULL, NULL); /* obstack_init also initializes the obstack so it is empty. We could use obstack_specify_allocation but gdb_obstack.h specifies the alloc/dealloc -- cgit v1.1