diff options
author | Fred Fish <fnf@specifix.com> | 1991-10-24 08:42:20 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1991-10-24 08:42:20 +0000 |
commit | 4a35d6e91b6d8b0f9c7577943dbc8fb453065e60 (patch) | |
tree | 89049df78a7a0447a52fd9172fde5d80d85bf8dc /gdb/symmisc.c | |
parent | ba04ec6e77ce37cf1881aae243124d774df54b81 (diff) | |
download | gdb-4a35d6e91b6d8b0f9c7577943dbc8fb453065e60.zip gdb-4a35d6e91b6d8b0f9c7577943dbc8fb453065e60.tar.gz gdb-4a35d6e91b6d8b0f9c7577943dbc8fb453065e60.tar.bz2 |
Remove the object file specific fields from the partial symbol table
structure and replace them with a pointer to private data for each
different flavor of object file reader to initialize appropriately.
Diffstat (limited to 'gdb/symmisc.c')
-rw-r--r-- | gdb/symmisc.c | 161 |
1 files changed, 146 insertions, 15 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 52f9fd7..fbcc79d 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -3,28 +3,30 @@ This file is part of GDB. -GDB is free software; you can redistribute it and/or modify +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -GDB is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <stdio.h> #include "defs.h" #include "param.h" #include "symtab.h" +#include "bfd.h" +#include "symfile.h" #include "breakpoint.h" #include "command.h" -#include <stdio.h> #include <obstack.h> /* Free all the symtabs that are currently installed, @@ -94,7 +96,6 @@ free_symtab (s) { register int i, n; register struct blockvector *bv; - register struct typevector *tv; switch (s->free_code) { @@ -114,9 +115,6 @@ free_symtab (s) free_symtab_block (BLOCKVECTOR_BLOCK (bv, i)); /* Free the blockvector itself. */ free (bv); - /* Free the type vector. */ - tv = TYPEVECTOR (s); - free (tv); /* Also free the linetable. */ case free_linetable: @@ -141,6 +139,7 @@ free_symtab (s) static int block_depth (); static void print_symbol (); +static void print_partial_symbol (); void print_symtabs (filename) @@ -314,10 +313,6 @@ print_symbol (symbol, depth, outfile) BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))); break; - case LOC_EXTERNAL: - fprintf (outfile, "external at 0x%x", SYMBOL_VALUE_ADDRESS (symbol)); - break; - default: fprintf (outfile, "botched symbol class %x", SYMBOL_CLASS (symbol)); break; @@ -326,6 +321,140 @@ print_symbol (symbol, depth, outfile) fprintf (outfile, "\n"); } +void +print_partial_symtabs (filename) + char *filename; +{ + FILE *outfile; + struct partial_symtab *p; + struct cleanup *cleanups; + extern int fclose(); + + if (filename == 0) + error_no_arg ("file to write partial symbol data in"); + + filename = tilde_expand (filename); + make_cleanup (free, filename); + + outfile = fopen (filename, "w"); + if (outfile == 0) + perror_with_name (filename); + + cleanups = make_cleanup (fclose, outfile); + immediate_quit++; + + for (p = partial_symtab_list; p; p = p->next) + { + fprintf_filtered (outfile, "Partial symtab for source file %s ", + p->filename); + fprintf_filtered (outfile, "(object 0x%x)\n\n", p); + fprintf_filtered (outfile, " Full symbol table %s been read from %s\n", + p->readin ? "has" : "has not yet", + p->symfile_name); + if (p->readin) + fprintf_filtered (outfile, " Was read into symtab at 0x%x by function at 0x%x\n", + p->symtab, p->read_symtab); + fprintf_filtered (outfile, " Relocate symbols by 0x%x\n", p->addr); + fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n", + p->textlow, p->texthigh); + fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n", + p->number_of_dependencies); + if (p->n_global_syms > 0) + print_partial_symbol (global_psymbols.list + p->globals_offset, + p->n_global_syms, "Global", outfile); + if (p->n_static_syms > 0) + print_partial_symbol (static_psymbols.list + p->statics_offset, + p->n_static_syms, "Static", outfile); + fprintf_filtered (outfile, "\n\n"); + } + + immediate_quit--; + do_cleanups (cleanups); +} + +static void +print_partial_symbol (p, count, what, outfile) +struct partial_symbol *p; +int count; +char *what; +FILE *outfile; +{ + char *space; + char *class; + + fprintf_filtered (outfile, " %s partial symbols:\n", what); + while (count-- > 0) + { + fprintf_filtered (outfile, " `%s', ", SYMBOL_NAME(p)); + switch (SYMBOL_NAMESPACE (p)) + { + case UNDEF_NAMESPACE: + fputs_filtered ("undefined namespace, ", outfile); + break; + case VAR_NAMESPACE: + /* This is the usual thing -- don't print it */ + break; + case STRUCT_NAMESPACE: + fputs_filtered ("struct namespace, ", outfile); + break; + case LABEL_NAMESPACE: + fputs_filtered ("label namespace, ", outfile); + break; + default: + fputs_filtered ("<invalid namespace>, ", outfile); + break; + } + switch (SYMBOL_CLASS (p)) + { + case LOC_UNDEF: + fputs_filtered ("undefined", outfile); + break; + case LOC_CONST: + fputs_filtered ("constant int", outfile); + break; + case LOC_STATIC: + fputs_filtered ("static", outfile); + break; + case LOC_REGISTER: + fputs_filtered ("register", outfile); + break; + case LOC_ARG: + fputs_filtered ("pass by value", outfile); + break; + case LOC_REF_ARG: + fputs_filtered ("pass by reference", outfile); + break; + case LOC_REGPARM: + fputs_filtered ("register parameter", outfile); + break; + case LOC_LOCAL: + fputs_filtered ("stack parameter", outfile); + break; + case LOC_TYPEDEF: + fputs_filtered ("type", outfile); + break; + case LOC_LABEL: + fputs_filtered ("label", outfile); + break; + case LOC_BLOCK: + fputs_filtered ("function", outfile); + break; + case LOC_CONST_BYTES: + fputs_filtered ("constant bytes", outfile); + break; + case LOC_LOCAL_ARG: + fputs_filtered ("shuffled arg", outfile); + break; + default: + fputs_filtered ("<invalid location>", outfile); + break; + } + fputs_filtered (", ", outfile); + fprintf_filtered (outfile, "0x%x\n", SYMBOL_VALUE (p)); + p++; + } +} + /* Return the nexting depth of a block within other blocks in its symtab. */ static int @@ -356,5 +485,7 @@ _initialize_symmisc () add_com ("printsyms", class_obscure, print_symtabs, "Print dump of current symbol definitions to file OUTFILE."); + add_com ("printpsyms", class_obscure, print_partial_symtabs, + "Print dump of current partial symbol definitions to file OUTFILE."); } |