diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-07-12 15:23:10 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-07-12 15:23:10 +0000 |
commit | af5f3db67c5dcbbc7b2038fe781d03301b94783d (patch) | |
tree | 458bedb8fa453f6b845b5ff34fa7874edb6b499c /gdb/symfile.c | |
parent | 120d20f2664d24f5080a5578f8ff93c10f4a8a9c (diff) | |
download | gdb-af5f3db67c5dcbbc7b2038fe781d03301b94783d.zip gdb-af5f3db67c5dcbbc7b2038fe781d03301b94783d.tar.gz gdb-af5f3db67c5dcbbc7b2038fe781d03301b94783d.tar.bz2 |
* bcache.h: Update copyright.
(struct bstring, struct bcache): Move definition to "bcache.c".
Replaced by opaque declaration.
(bcache_xfree): Replace free_bcache.
(bcache_xmalloc, bcache_memory_used): Declare.
* bcache.c: Update copyright.
(struct bstring, struct bcache): Moved to here from "bcache.h".
Update comments.
(bcache_xmalloc, bcache_memory_used): New functions.
(bcache_xfree): Replace function free_bcache.
* Makefile.in (objfiles.o): Add $(bcache_h).
(objfiles_h): Remove $(bcache_h).
(symfile.o): Add $(bcache_h).
* symmisc.c: Update copyright.
(print_symbol_bcache_statistics): Pass psymbol_cache by value.
(print_objfile_statistics): Use bcache_memory_used.
* symfile.c: Include "bcache.h".
(reread_symbols): Use bcache_xfree.
(reread_symbols): Use bcache_xmalloc and bcache_xfree.
(add_psymbol_to_list): Pass psymbol_cache by value.
(add_psymbol_with_dem_name_to_list): Ditto.
* objfiles.h: Update copyright.
(struct bcache): Declare opaque. Do not include "bcache.h".
(struct objfile): Change psymbol_cache and macro_cache to ``struct
bcache'' pointers.
* dwarf2read.c (macro_start_file): Pass macro_cache by value.
* objfiles.c: Include "bcache.h". Update copyright.
(allocate_objfile): Use bcache_xmalloc to create psymbol_cache and
macro_cache.
(free_objfile): Use bcache_xfree.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index d087b1f..2a68201 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -40,6 +40,7 @@ #include "gdb-stabs.h" #include "obstack.h" #include "completer.h" +#include "bcache.h" #include <sys/types.h> #include <fcntl.h> @@ -1740,8 +1741,10 @@ reread_symbols (void) sizeof (objfile->static_psymbols)); /* Free the obstacks for non-reusable objfiles */ - free_bcache (&objfile->psymbol_cache); - free_bcache (&objfile->macro_cache); + bcache_xfree (objfile->psymbol_cache); + objfile->psymbol_cache = bcache_xmalloc (); + bcache_xfree (objfile->macro_cache); + objfile->macro_cache = bcache_xmalloc (); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->type_obstack, 0); @@ -1765,10 +1768,8 @@ reread_symbols (void) objfile->md = NULL; /* obstack_specify_allocation also initializes the obstack so it is empty. */ - obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, - xmalloc, xfree); - obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, - xmalloc, xfree); + objfile->psymbol_cache = bcache_xmalloc (); + objfile->macro_cache = bcache_xmalloc (); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, @@ -2377,7 +2378,7 @@ add_psymbol_to_list (char *name, int namelength, namespace_enum namespace, /* Create local copy of the partial symbol */ memcpy (buf, name, namelength); buf[namelength] = '\0'; - SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache); + SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache); /* val and coreaddr are mutually exclusive, one of them *will* be zero */ if (val != 0) { @@ -2394,7 +2395,7 @@ add_psymbol_to_list (char *name, int namelength, namespace_enum namespace, SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language); /* Stash the partial symbol away in the cache */ - psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache); + psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache); /* Save pointer to partial symbol in psymtab, growing symtab if needed. */ if (list->next >= list->list + list->size) @@ -2429,7 +2430,7 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, memcpy (buf, name, namelength); buf[namelength] = '\0'; - SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, &objfile->psymbol_cache); + SYMBOL_NAME (&psymbol) = bcache (buf, namelength + 1, objfile->psymbol_cache); buf = alloca (dem_namelength + 1); memcpy (buf, dem_name, dem_namelength); @@ -2440,11 +2441,11 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, case language_c: case language_cplus: SYMBOL_CPLUS_DEMANGLED_NAME (&psymbol) = - bcache (buf, dem_namelength + 1, &objfile->psymbol_cache); + bcache (buf, dem_namelength + 1, objfile->psymbol_cache); break; case language_chill: SYMBOL_CHILL_DEMANGLED_NAME (&psymbol) = - bcache (buf, dem_namelength + 1, &objfile->psymbol_cache); + bcache (buf, dem_namelength + 1, objfile->psymbol_cache); /* FIXME What should be done for the default case? Ignoring for now. */ } @@ -2465,7 +2466,7 @@ add_psymbol_with_dem_name_to_list (char *name, int namelength, char *dem_name, SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, language); /* Stash the partial symbol away in the cache */ - psym = bcache (&psymbol, sizeof (struct partial_symbol), &objfile->psymbol_cache); + psym = bcache (&psymbol, sizeof (struct partial_symbol), objfile->psymbol_cache); /* Save pointer to partial symbol in psymtab, growing symtab if needed. */ if (list->next >= list->list + list->size) |