aboutsummaryrefslogtreecommitdiff
path: root/gdb/symmisc.c
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@acorntoolworks.com>1995-08-01 20:14:27 +0000
committerJ.T. Conklin <jtc@acorntoolworks.com>1995-08-01 20:14:27 +0000
commit2b57629364528ef2fd913154e58f626123d51f1c (patch)
tree649b55da772d6aa5e9190ebcfa4bee6a5a31f998 /gdb/symmisc.c
parenta1bdcf913a6f7ee2bbb715dd48b1a75e10a43414 (diff)
downloadgdb-2b57629364528ef2fd913154e58f626123d51f1c.zip
gdb-2b57629364528ef2fd913154e58f626123d51f1c.tar.gz
gdb-2b57629364528ef2fd913154e58f626123d51f1c.tar.bz2
* configure.in: Check for working mmap, ansi headers, string.h,
strings.h, and memory.h. * configure: Regenerated. * gdb_stat.h: New file, "portable" <sys/stat.h>. * gdb_string.h: New file, "portable" <string.h>. * altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c, convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c, gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c, i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c, mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c, rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c, symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c, ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h" instead of <sys/stat.h>. * alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c, ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c, core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c, dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c, exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c, fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c, inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c, m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c, monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c, printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c, remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c, remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c, remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c, remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c, remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c, solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c, symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c, valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include "gdb_string.h" instead of <string.h>. * gdbtk.c: Likewise. * config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h, sparc/xm-sun4os4.h (HAVE_MMAP): Removed. * config/xm-lynx.h, config/i386/xm-ptx.h, config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h, config/mips/xm-irix3.h, config/mips/xm-mips.h, config/mips/xm-news-mips.h, config/mips/xm-riscos.h, config/pa/hppah.h, config/rs6000/xm-rs6000.h, config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h, config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h, config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed. * config/mips/xm-irix3.h, config/mips/xm-mips.h, config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
Diffstat (limited to 'gdb/symmisc.c')
-rw-r--r--gdb/symmisc.c132
1 files changed, 116 insertions, 16 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index daca178..e9af39f 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -1,5 +1,6 @@
/* Do various things to symbol tables (other than lookup), for GDB.
- Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -28,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#include "language.h"
-#include <string.h>
+#include "gdb_string.h"
#ifndef DEV_TTY
#define DEV_TTY "/dev/tty"
@@ -234,6 +235,9 @@ dump_msymbols (objfile, outfile)
case mst_text:
ms_type = 'T';
break;
+ case mst_solib_trampoline:
+ ms_type = 'S';
+ break;
case mst_data:
ms_type = 'D';
break;
@@ -262,6 +266,10 @@ dump_msymbols (objfile, outfile)
{
fprintf_filtered (outfile, " %s", SYMBOL_DEMANGLED_NAME (msymbol));
}
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+ if (msymbol->filename)
+ fprintf_filtered (outfile, " %s", msymbol->filename);
+#endif
fputs_filtered ("\n", outfile);
}
if (objfile -> minimal_symbol_count != index)
@@ -282,7 +290,7 @@ dump_psymtab (objfile, psymtab, outfile)
fprintf_filtered (outfile, "\nPartial symtab for source file %s ",
psymtab -> filename);
- fprintf_filtered (outfile, "(object )");
+ fprintf_filtered (outfile, "(object ");
gdb_print_address (psymtab, outfile);
fprintf_filtered (outfile, ")\n\n");
fprintf_unfiltered (outfile, " Read from object file %s (",
@@ -296,22 +304,26 @@ dump_psymtab (objfile, psymtab, outfile)
" Full symtab was read (at ");
gdb_print_address (psymtab->symtab, outfile);
fprintf_filtered (outfile, " by function at ");
- gdb_print_address (psymtab->read_symtab, outfile);
+ gdb_print_address ((PTR)psymtab->read_symtab, outfile);
fprintf_filtered (outfile, ")\n");
}
fprintf_filtered (outfile, " Relocate symbols by ");
for (i = 0; i < psymtab->objfile->num_sections; ++i)
{
+ if (i != 0)
+ fprintf_filtered (outfile, ", ");
wrap_here (" ");
- print_address_numeric (ANOFFSET (psymtab->section_offsets, i), outfile);
- fprintf_filtered (outfile, ", ");
+ print_address_numeric (ANOFFSET (psymtab->section_offsets, i),
+ 1,
+ outfile);
}
+ fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Symbols cover text addresses ");
- print_address_numeric (psymtab->textlow, outfile);
+ print_address_numeric (psymtab->textlow, 1, outfile);
fprintf_filtered (outfile, "-");
- print_address_numeric (psymtab->texthigh, outfile);
+ print_address_numeric (psymtab->texthigh, 1, outfile);
fprintf_filtered (outfile, "\n");
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
psymtab -> number_of_dependencies);
@@ -365,7 +377,7 @@ dump_symtab (objfile, symtab, outfile)
for (i = 0; i < len; i++)
{
fprintf_filtered (outfile, " line %d at ", l->item[i].line);
- print_address_numeric (l->item[i].pc, outfile);
+ print_address_numeric (l->item[i].pc, 1, outfile);
fprintf_filtered (outfile, "\n");
}
}
@@ -382,9 +394,9 @@ dump_symtab (objfile, symtab, outfile)
gdb_print_address (b, outfile);
fprintf_filtered (outfile, ") ");
fprintf_filtered (outfile, "[");
- print_address_numeric (BLOCK_START (b), outfile);
+ print_address_numeric (BLOCK_START (b), 1, outfile);
fprintf_filtered (outfile, "..");
- print_address_numeric (BLOCK_END (b), outfile);
+ print_address_numeric (BLOCK_END (b), 1, outfile);
fprintf_filtered (outfile, "]");
if (BLOCK_SUPERBLOCK (b))
{
@@ -403,7 +415,7 @@ dump_symtab (objfile, symtab, outfile)
}
if (BLOCK_GCC_COMPILED(b))
fprintf_filtered (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
- fprintf_filtered ('\n', outfile);
+ fprintf_filtered (outfile, "\n");
blen = BLOCK_NSYMS (b);
for (j = 0; j < blen; j++)
{
@@ -435,7 +447,8 @@ maintenance_print_symbols (args, from_tty)
if (args == NULL)
{
- error ("print-symbols takes an output file name and optional symbol file name");
+ error ("\
+Arguments missing: an output file name and an optional symbol file name");
}
else if ((argv = buildargv (args)) == NULL)
{
@@ -486,7 +499,7 @@ print_symbol (args)
if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
{
fprintf_filtered (outfile, "label %s at ", SYMBOL_SOURCE_NAME (symbol));
- print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), 1, outfile);
fprintf_filtered (outfile, "\n");
return 1;
}
@@ -546,7 +559,7 @@ print_symbol (args)
case LOC_STATIC:
fprintf_filtered (outfile, "static at ");
- print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), 1,outfile);
fprintf_filtered (outfile, ",");
break;
@@ -596,7 +609,7 @@ print_symbol (args)
case LOC_LABEL:
fprintf_filtered (outfile, "label at ");
- print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), outfile);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (symbol), 1, outfile);
break;
case LOC_BLOCK:
@@ -604,6 +617,7 @@ print_symbol (args)
gdb_print_address (SYMBOL_BLOCK_VALUE (symbol), outfile);
fprintf_filtered (outfile, ") starting at ");
print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)),
+ 1,
outfile);
fprintf_filtered (outfile, ",");
break;
@@ -834,6 +848,92 @@ maintenance_print_objfiles (ignore, from_tty)
immediate_quit--;
}
+/* Check consistency of psymtabs and symtabs. */
+
+void
+maintenance_check_symtabs (ignore, from_tty)
+ char *ignore;
+ int from_tty;
+{
+ register struct symbol *sym;
+ register struct partial_symbol *psym;
+ register struct symtab *s = NULL;
+ register struct partial_symtab *ps;
+ struct blockvector *bv;
+ register struct objfile *objfile;
+ register struct block *b;
+ int length;
+
+ ALL_PSYMTABS (objfile, ps)
+ {
+ s = PSYMTAB_TO_SYMTAB(ps);
+ if (s == NULL)
+ continue;
+ bv = BLOCKVECTOR (s);
+ b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+ psym = ps->objfile->static_psymbols.list + ps->statics_offset;
+ length = ps->n_static_syms;
+ while (length--)
+ {
+ sym = lookup_block_symbol (b, SYMBOL_NAME (psym),
+ SYMBOL_NAMESPACE (psym));
+ if (!sym)
+ {
+ printf_filtered ("Static symbol `");
+ puts_filtered (SYMBOL_NAME (psym));
+ printf_filtered ("' only found in ");
+ puts_filtered (ps->filename);
+ printf_filtered (" psymtab\n");
+ }
+ psym++;
+ }
+ b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ psym = ps->objfile->global_psymbols.list + ps->globals_offset;
+ length = ps->n_global_syms;
+ while (length--)
+ {
+ sym = lookup_block_symbol (b, SYMBOL_NAME (psym),
+ SYMBOL_NAMESPACE (psym));
+ if (!sym)
+ {
+ printf_filtered ("Global symbol `");
+ puts_filtered (SYMBOL_NAME (psym));
+ printf_filtered ("' only found in ");
+ puts_filtered (ps->filename);
+ printf_filtered (" psymtab\n");
+ }
+ psym++;
+ }
+ if (ps->texthigh < ps->textlow)
+ {
+ printf_filtered ("Psymtab ");
+ puts_filtered (ps->filename);
+ printf_filtered (" covers bad range ");
+ print_address_numeric (ps->textlow, 1, stdout);
+ printf_filtered (" - ");
+ print_address_numeric (ps->texthigh, 1, stdout);
+ printf_filtered ("\n");
+ continue;
+ }
+ if (ps->texthigh == 0)
+ continue;
+ if (ps->textlow < BLOCK_START (b) || ps->texthigh > BLOCK_END (b))
+ {
+ printf_filtered ("Psymtab ");
+ puts_filtered (ps->filename);
+ printf_filtered (" covers ");
+ print_address_numeric (ps->textlow, 1, stdout);
+ printf_filtered (" - ");
+ print_address_numeric (ps->texthigh, 1, stdout);
+ printf_filtered (" but symtab covers only ");
+ print_address_numeric (BLOCK_START (b), 1, stdout);
+ printf_filtered (" - ");
+ print_address_numeric (BLOCK_END (b), 1, stdout);
+ printf_filtered ("\n");
+ }
+ }
+}
+
/* Return the nexting depth of a block within other blocks in its symtab. */