* symmisc.c (print_objfile_statistics): Print memory use statistics

for objfile psymbol, symbol, and type obstacks.
	Update copyright to 1996.
This commit is contained in:
Fred Fish 1996-01-03 22:00:45 +00:00
parent 655492f4ff
commit ef4d61874b
2 changed files with 62 additions and 5194 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* Do various things to symbol tables (other than lookup), for GDB.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
@ -16,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "symtab.h"
@ -152,6 +152,43 @@ free_symtab (s)
#if MAINTENANCE_CMDS
void
print_objfile_statistics ()
{
struct objfile *objfile;
immediate_quit++;
ALL_OBJFILES (objfile)
{
printf_filtered ("Statistics for '%s':\n", objfile -> name);
if (OBJSTAT (objfile, n_stabs) > 0)
printf_filtered (" Number of \"stab\" symbols read: %d\n",
OBJSTAT (objfile, n_stabs));
if (OBJSTAT (objfile, n_minsyms) > 0)
printf_filtered (" Number of \"minimal symbols read: %d\n",
OBJSTAT (objfile, n_minsyms));
if (OBJSTAT (objfile, n_psyms) > 0)
printf_filtered (" Number of \"partial symbols read: %d\n",
OBJSTAT (objfile, n_psyms));
if (OBJSTAT (objfile, n_syms) > 0)
printf_filtered (" Number of \"full symbols read: %d\n",
OBJSTAT (objfile, n_syms));
if (OBJSTAT (objfile, n_types) > 0)
printf_filtered (" Number of \"types defined: %d\n",
OBJSTAT (objfile, n_types));
if (OBJSTAT (objfile, sz_strtab) > 0)
printf_filtered (" Space used by a.out string tables: %d\n",
OBJSTAT (objfile, sz_strtab));
printf_filtered (" Total memory used for psymbol obstack: %d\n",
obstack_memory_used (&objfile -> psymbol_obstack));
printf_filtered (" Total memory used for symbol obstack: %d\n",
obstack_memory_used (&objfile -> symbol_obstack));
printf_filtered (" Total memory used for type obstack: %d\n",
obstack_memory_used (&objfile -> type_obstack));
}
immediate_quit--;
}
static void
dump_objfile (objfile)
struct objfile *objfile;
@ -546,13 +583,14 @@ print_symbol (args)
break;
case LOC_CONST_BYTES:
fprintf_filtered (outfile, "const %u hex bytes:",
TYPE_LENGTH (SYMBOL_TYPE (symbol)));
{
unsigned i;
for (i = 0; i < TYPE_LENGTH (SYMBOL_TYPE (symbol)); i++)
struct type *type = check_typedef (SYMBOL_TYPE (symbol));
fprintf_filtered (outfile, "const %u hex bytes:",
TYPE_LENGTH (type));
for (i = 0; i < TYPE_LENGTH (type); i++)
fprintf_filtered (outfile, " %02x",
(unsigned)SYMBOL_VALUE_BYTES (symbol) [i]);
(unsigned)SYMBOL_VALUE_BYTES (symbol) [i]);
fprintf_filtered (outfile, ",");
}
break;
@ -622,6 +660,10 @@ print_symbol (args)
fprintf_filtered (outfile, ",");
break;
case LOC_UNRESOLVED:
fprintf_filtered (outfile, "unresolved");
break;
case LOC_OPTIMIZED_OUT:
fprintf_filtered (outfile, "optimized out");
break;
@ -766,6 +808,9 @@ print_partial_symbol (p, count, what, outfile)
case LOC_LOCAL_ARG:
fputs_filtered ("shuffled arg", outfile);
break;
case LOC_UNRESOLVED:
fputs_filtered ("unresolved", outfile);
break;
case LOC_OPTIMIZED_OUT:
fputs_filtered ("optimized out", outfile);
break;