aboutsummaryrefslogtreecommitdiff
path: root/gdb/symmisc.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/symmisc.c
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/symmisc.c')
-rw-r--r--gdb/symmisc.c63
1 files changed, 38 insertions, 25 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index d4b3d68..8485c59 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -63,7 +63,7 @@ static int
block_depth PARAMS ((struct block *));
static void
-print_partial_symbol PARAMS ((struct partial_symbol *, int, char *, GDB_FILE *));
+print_partial_symbols PARAMS ((struct partial_symbol **, int, char *, GDB_FILE *));
struct print_symbol_args {
struct symbol *symbol;
@@ -153,6 +153,20 @@ free_symtab (s)
#if MAINTENANCE_CMDS
void
+print_symbol_bcache_statistics ()
+{
+ struct objfile *objfile;
+
+ immediate_quit++;
+ ALL_OBJFILES (objfile)
+ {
+ printf_filtered ("Cached obstack statistics for '%s':\n", objfile -> name);
+ print_bcache_statistics (&objfile -> psymbol_cache, "partial symbol obstack");
+ }
+ immediate_quit--;
+}
+
+void
print_objfile_statistics ()
{
struct objfile *objfile;
@@ -373,13 +387,13 @@ dump_psymtab (objfile, psymtab, outfile)
}
if (psymtab -> n_global_syms > 0)
{
- print_partial_symbol (objfile -> global_psymbols.list
+ print_partial_symbols (objfile -> global_psymbols.list
+ psymtab -> globals_offset,
psymtab -> n_global_syms, "Global", outfile);
}
if (psymtab -> n_static_syms > 0)
{
- print_partial_symbol (objfile -> static_psymbols.list
+ print_partial_symbols (objfile -> static_psymbols.list
+ psymtab -> statics_offset,
psymtab -> n_static_syms, "Static", outfile);
}
@@ -461,7 +475,7 @@ dump_symtab (objfile, symtab, outfile)
s.depth = depth + 1;
s.outfile = outfile;
catch_errors (print_symbol, &s, "Error printing symbol:\n",
- RETURN_MASK_ERROR);
+ RETURN_MASK_ALL);
}
}
fprintf_filtered (outfile, "\n");
@@ -730,23 +744,22 @@ maintenance_print_psymbols (args, from_tty)
}
static void
-print_partial_symbol (p, count, what, outfile)
- struct partial_symbol *p;
+print_partial_symbols (p, count, what, outfile)
+ struct partial_symbol **p;
int count;
char *what;
GDB_FILE *outfile;
{
-
fprintf_filtered (outfile, " %s partial symbols:\n", what);
while (count-- > 0)
{
- fprintf_filtered (outfile, " `%s'", SYMBOL_NAME(p));
- if (SYMBOL_DEMANGLED_NAME (p) != NULL)
+ fprintf_filtered (outfile, " `%s'", SYMBOL_NAME(*p));
+ if (SYMBOL_DEMANGLED_NAME (*p) != NULL)
{
- fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (p));
+ fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (*p));
}
fputs_filtered (", ", outfile);
- switch (SYMBOL_NAMESPACE (p))
+ switch (SYMBOL_NAMESPACE (*p))
{
case UNDEF_NAMESPACE:
fputs_filtered ("undefined namespace, ", outfile);
@@ -764,7 +777,7 @@ print_partial_symbol (p, count, what, outfile)
fputs_filtered ("<invalid namespace>, ", outfile);
break;
}
- switch (SYMBOL_CLASS (p))
+ switch (SYMBOL_CLASS (*p))
{
case LOC_UNDEF:
fputs_filtered ("undefined", outfile);
@@ -822,7 +835,7 @@ print_partial_symbol (p, count, what, outfile)
/* FIXME-32x64: Need to use SYMBOL_VALUE_ADDRESS, etc.; this
could be 32 bits when some of the other fields in the union
are 64. */
- fprintf_filtered (outfile, "0x%lx\n", SYMBOL_VALUE (p));
+ fprintf_filtered (outfile, "0x%lx\n", SYMBOL_VALUE (*p));
p++;
}
}
@@ -901,7 +914,7 @@ maintenance_check_symtabs (ignore, from_tty)
int from_tty;
{
register struct symbol *sym;
- register struct partial_symbol *psym;
+ register struct partial_symbol **psym;
register struct symtab *s = NULL;
register struct partial_symtab *ps;
struct blockvector *bv;
@@ -920,12 +933,12 @@ maintenance_check_symtabs (ignore, from_tty)
length = ps->n_static_syms;
while (length--)
{
- sym = lookup_block_symbol (b, SYMBOL_NAME (psym),
- SYMBOL_NAMESPACE (psym));
+ sym = lookup_block_symbol (b, SYMBOL_NAME (*psym),
+ SYMBOL_NAMESPACE (*psym));
if (!sym)
{
printf_filtered ("Static symbol `");
- puts_filtered (SYMBOL_NAME (psym));
+ puts_filtered (SYMBOL_NAME (*psym));
printf_filtered ("' only found in ");
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
@@ -937,12 +950,12 @@ maintenance_check_symtabs (ignore, from_tty)
length = ps->n_global_syms;
while (length--)
{
- sym = lookup_block_symbol (b, SYMBOL_NAME (psym),
- SYMBOL_NAMESPACE (psym));
+ sym = lookup_block_symbol (b, SYMBOL_NAME (*psym),
+ SYMBOL_NAMESPACE (*psym));
if (!sym)
{
printf_filtered ("Global symbol `");
- puts_filtered (SYMBOL_NAME (psym));
+ puts_filtered (SYMBOL_NAME (*psym));
printf_filtered ("' only found in ");
puts_filtered (ps->filename);
printf_filtered (" psymtab\n");
@@ -998,7 +1011,7 @@ block_depth (block)
/* Increase the space allocated for LISTP, which is probably
- global_psymbol_list or static_psymbol_list. This space will eventually
+ global_psymbols or static_psymbols. This space will eventually
be freed in free_objfile(). */
void
@@ -1010,15 +1023,15 @@ extend_psymbol_list (listp, objfile)
if (listp->size == 0)
{
new_size = 255;
- listp->list = (struct partial_symbol *)
- xmmalloc (objfile -> md, new_size * sizeof (struct partial_symbol));
+ listp->list = (struct partial_symbol **)
+ xmmalloc (objfile -> md, new_size * sizeof (struct partial_symbol *));
}
else
{
new_size = listp->size * 2;
- listp->list = (struct partial_symbol *)
+ listp->list = (struct partial_symbol **)
xmrealloc (objfile -> md, (char *) listp->list,
- new_size * sizeof (struct partial_symbol));
+ new_size * sizeof (struct partial_symbol *));
}
/* Next assumes we only went one over. Should be good if
program works correctly */