aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1996-02-16 22:14:47 +0000
committerFred Fish <fnf@specifix.com>1996-02-16 22:14:47 +0000
commit2ad5709f00b91860c204e1556eb917d42984d40d (patch)
tree87410f5e9a6f1e7d173b33045ed198f332908630 /gdb/objfiles.c
parentef2074c25a901891cec6000824a4cac2d05eb723 (diff)
downloadgdb-2ad5709f00b91860c204e1556eb917d42984d40d.zip
gdb-2ad5709f00b91860c204e1556eb917d42984d40d.tar.gz
gdb-2ad5709f00b91860c204e1556eb917d42984d40d.tar.bz2
* bcache.c, bcache.h: New files to implement a byte cache.
* Makefile.in (SFILES): Add bcache.c. (symtab_h): Add bcache.h. (HFILES_NO_SRCDIR): add bcache.h (COMMON_OBJS): Add bcache.o (bcache.o): New target. * dbxread.c (start_psymtab): Make global_syms & static_syms type "partial_symbol **". * hpread.c (hpread_start_symtab): Ditto. * os9kread.c (os9k_start_psymtab): Ditto. * stabsread.h (start_psymtab): Ditto. * {symfile.c, symfile.h} (start_psymtab_common): Ditto. * maint.c (maintenance_print_statistics): Call print_symbol_bcache_statistics. * objfiles.c (allocate_objfile): Initialize psymbol bcache malloc and free pointers. * solib.c (allocate_rt_common_objfile): Ditto. * symfile.c (reread_symbols): Ditto. (free_objfile): Free psymbol bcache when objfile is freed. (objfile_relocate): Use new indirect psymbol pointers. * objfiles.h (struct objfile): Add psymbol cache. * symfile.c (compare_psymbols): Now passed pointers to pointers to psymbols. (reread_symbols): Free psymbol bcache when freeing other objfile resources. (add_psymbol_to_list, add_psymbol_addr_to_list): Initialize new psymbol using the psymbol bcache. (init_psymbol_list): Psymbol lists now contain pointers rather than the actual psymbols. * symfile.h (psymbol_allocation_list): Psymbol lists now dynamically grown arrays of pointers. (ADD_PSYMBOL_VT_TO_LIST): Initialize new symbol using the psymbol bcache. * symmisc.c (print_partial_symbols): Now takes pointer to pointer to partial symbol. (print_symbol_bcache_statistics): New function to print per objfile bcache statistics. (print_partial_symbol, print_partial_symbols, maintenance_check_symtabs, extend_psymbol_list): Account for change to pointer to pointer to partial symbol. * symtab.c (find_pc_psymbol, lookup_partial_symbol, decode_line_2, make_symbol_completion_list): Account for change to pointer to pointer to partial symbol. * symtab.h (bcache.h): Include. * xcoffread.c (xcoff_start_psymtab): Make global_syms & static_syms type "partial_symbol **".
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index e486550..ed9f1cf 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -159,6 +159,8 @@ allocate_objfile (abfd, mapped)
objfile -> md = md;
objfile -> mmfd = fd;
/* Update pointers to functions to *our* copies */
+ obstack_chunkfun (&objfile -> psymbol_cache.cache, xmmalloc);
+ obstack_freefun (&objfile -> psymbol_cache.cache, mfree);
obstack_chunkfun (&objfile -> psymbol_obstack, xmmalloc);
obstack_freefun (&objfile -> psymbol_obstack, mfree);
obstack_chunkfun (&objfile -> symbol_obstack, xmmalloc);
@@ -186,6 +188,9 @@ allocate_objfile (abfd, mapped)
objfile -> mmfd = fd;
objfile -> flags |= OBJF_MAPPED;
mmalloc_setkey (objfile -> md, 0, objfile);
+ obstack_specify_allocation_with_arg (&objfile -> psymbol_cache.cache,
+ 0, 0, xmmalloc, mfree,
+ objfile -> md);
obstack_specify_allocation_with_arg (&objfile -> psymbol_obstack,
0, 0, xmmalloc, mfree,
objfile -> md);
@@ -228,6 +233,8 @@ allocate_objfile (abfd, mapped)
objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
memset (objfile, 0, sizeof (struct objfile));
objfile -> md = NULL;
+ obstack_specify_allocation (&objfile -> psymbol_cache.cache, 0, 0,
+ xmalloc, free);
obstack_specify_allocation (&objfile -> psymbol_obstack, 0, 0, xmalloc,
free);
obstack_specify_allocation (&objfile -> symbol_obstack, 0, 0, xmalloc,
@@ -433,6 +440,7 @@ free_objfile (objfile)
if (objfile->static_psymbols.list)
mfree (objfile->md, objfile->static_psymbols.list);
/* Free the obstacks for non-reusable objfiles */
+ obstack_free (&objfile -> psymbol_cache.cache, 0);
obstack_free (&objfile -> psymbol_obstack, 0);
obstack_free (&objfile -> symbol_obstack, 0);
obstack_free (&objfile -> type_obstack, 0);
@@ -552,18 +560,18 @@ objfile_relocate (objfile, new_offsets)
}
{
- struct partial_symbol *psym;
+ struct partial_symbol **psym;
for (psym = objfile->global_psymbols.list;
psym < objfile->global_psymbols.next;
psym++)
- if (SYMBOL_SECTION (psym) >= 0)
- SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym));
+ if (SYMBOL_SECTION (*psym) >= 0)
+ SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta, SYMBOL_SECTION (*psym));
for (psym = objfile->static_psymbols.list;
psym < objfile->static_psymbols.next;
psym++)
- if (SYMBOL_SECTION (psym) >= 0)
- SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym));
+ if (SYMBOL_SECTION (*psym) >= 0)
+ SYMBOL_VALUE_ADDRESS (*psym) += ANOFFSET (delta, SYMBOL_SECTION (*psym));
}
{