aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.h
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/symfile.h
parentef2074c25a901891cec6000824a4cac2d05eb723 (diff)
downloadfsf-binutils-gdb-2ad5709f00b91860c204e1556eb917d42984d40d.zip
fsf-binutils-gdb-2ad5709f00b91860c204e1556eb917d42984d40d.tar.gz
fsf-binutils-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/symfile.h')
-rw-r--r--gdb/symfile.h47
1 files changed, 28 insertions, 19 deletions
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 6271a72..3c968f6 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -23,10 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This file requires that you first include "bfd.h". */
+/* Partial symbols are stored in the psymbol_cache and pointers to them
+ are kept in a dynamically grown array that is obtained from malloc and
+ grown as necessary via realloc. Each objfile typically has two of these,
+ one for global symbols and one for static symbols. Although this adds
+ a level of indirection for storing or accessing the partial symbols,
+ it allows us to throw away duplicate psymbols and set all pointers
+ to the single saved instance. */
+
struct psymbol_allocation_list {
- struct partial_symbol *list;
- struct partial_symbol *next;
- int size;
+ struct partial_symbol **list; /* Pointer to first partial symbol pointer*/
+ struct partial_symbol **next; /* Pointer to next avail storage for pointer */
+ int size; /* Number of symbols */
};
/* Structure to keep track of symbol reading functions for various
@@ -116,21 +124,22 @@ extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT,LANGUAGE, OBJFILE) \
do { \
register struct partial_symbol *psym; \
+ char *buf = alloca ((NAMELENGTH) + 1); \
+ struct partial_symbol psymbol; \
+ memcpy (buf, (NAME), (NAMELENGTH)); \
+ buf[(NAMELENGTH)] = '\0'; \
+ SYMBOL_NAME (&psymbol) = bcache (buf, (NAMELENGTH) + 1, &(OBJFILE)->psymbol_cache); \
+ VT (&psymbol) = (VALUE); \
+ SYMBOL_SECTION (&psymbol) = 0; \
+ SYMBOL_LANGUAGE (&psymbol) = (LANGUAGE); \
+ PSYMBOL_NAMESPACE (&psymbol) = (NAMESPACE); \
+ PSYMBOL_CLASS (&psymbol) = (CLASS); \
+ SYMBOL_INIT_LANGUAGE_SPECIFIC (&psymbol, (LANGUAGE)); \
+ psym = bcache (&psymbol, sizeof (struct partial_symbol), &(OBJFILE)->psymbol_cache); \
if ((LIST).next >= (LIST).list + (LIST).size) \
- extend_psymbol_list (&(LIST),(OBJFILE)); \
- psym = (LIST).next++; \
- SYMBOL_NAME (psym) = \
- (char *) obstack_alloc (&objfile->psymbol_obstack, \
- (NAMELENGTH) + 1); \
- memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
- SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
- SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
- SYMBOL_SECTION (psym) = 0; \
- PSYMBOL_CLASS (psym) = (CLASS); \
- VT (psym) = (VALUE); \
- SYMBOL_LANGUAGE (psym) = (LANGUAGE); \
- SYMBOL_INIT_LANGUAGE_SPECIFIC (psym, LANGUAGE); \
- OBJSTAT (objfile, n_psyms++); \
+ extend_psymbol_list (&(LIST), (OBJFILE)); \
+ *(LIST).next++ = psym; \
+ OBJSTAT ((OBJFILE), n_psyms++); \
} while (0)
/* Add a symbol with an integer value to a psymtab. */
@@ -174,8 +183,8 @@ new_symfile_objfile PARAMS ((struct objfile *, int, int));
extern struct partial_symtab *
start_psymtab_common PARAMS ((struct objfile *, struct section_offsets *,
char *, CORE_ADDR,
- struct partial_symbol *,
- struct partial_symbol *));
+ struct partial_symbol **,
+ struct partial_symbol **));
/* Sorting your symbols for fast lookup or alphabetical printing. */