aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/.Sanitize2
-rw-r--r--gdb/ChangeLog30
-rw-r--r--gdb/Makefile.in22
-rw-r--r--gdb/buildsym.c5
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/complaints.c154
-rw-r--r--gdb/complaints.h46
-rw-r--r--gdb/dbxread.c32
-rw-r--r--gdb/defs.h37
-rw-r--r--gdb/dwarfread.c227
-rw-r--r--gdb/elfread.c6
-rw-r--r--gdb/gdbtypes.c3
-rw-r--r--gdb/mipsread.c29
-rw-r--r--gdb/partial-stab.h3
-rw-r--r--gdb/remote-vx.c2
-rw-r--r--gdb/stabsread.c17
-rw-r--r--gdb/symfile.c120
-rw-r--r--gdb/symfile.h242
-rw-r--r--gdb/utils.c37
19 files changed, 530 insertions, 496 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize
index f0be8cd..28ebf29 100644
--- a/gdb/.Sanitize
+++ b/gdb/.Sanitize
@@ -61,6 +61,8 @@ call-cmds.h
coffread.c
command.c
command.h
+complaints.c
+complaints.h
config
configure.in
convex-pinsn.c
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index de5942e..c248d25 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,33 @@
+Tue Dec 15 04:14:24 1992 Fred Fish (fnf@cygnus.com)
+
+ * complaints.c: New file, code moved from utils.c.
+ * complaints.c (complain): Made into a varargs function.
+ * complaints.h: New file, code moved from symfile.h.
+ * Makefile.in (SFILES_MAINDIR): Add complaints.c.
+ * Makefile.in (HFILES): Add complaints.h.
+ * Makefile.in (OBS): Add complaints.o.
+ * symfile.c (complaint_root, stop_whining, complaint_series,
+ complain, clear_complaints, add_show_from_set for stop_whining):
+ Moved to complaints.c.
+ * symfile.h (struct complaint, complaint_root decl, complain
+ prototype, clear_complaints prototype): Moved to complaints.h.
+ * buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
+ gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
+ complaints.h. Remove casts from arguments to complain(),
+ which is now a varargs function, and remove unnecessary
+ placeholder zero args.
+ * defs.h (begin_line): Add prototype.
+ * defs.h (vprintf_filtered): Add prototype.
+ * dwarfread.c (varargs.h): Remove, no longer needed.
+ * dwarfread.c (dwarfwarn): Remove prototype and function.
+ * dwarfread.c (complaints): Define a bunch of complaints.
+ * dwarfread.c (SQUAWK): Remove macro defs, convert all
+ usages to standard complain() calls.
+ * utils.c (begin_line): New function that ensures that
+ whatever gets filter-printed next starts on its own line.
+ * utils.c (vprintf_filtered): New func, like vfprintf_filtered,
+ but to stdout (calls vfprintf_filtered internally).
+
Tue Dec 15 02:01:00 1992 John Gilmore (gnu@cygnus.com)
* remote.c: Avoid printf_filtered line limit. Suggested by
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fee05da..622f32b 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -201,7 +201,8 @@ SFILES_MAINDIR = \
mem-break.c target.c \
dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c stabsread.c \
ieee-float.c language.c parse.c buildsym.c objfiles.c \
- minsyms.c mipsread.c maint.c ch-exp.y c-lang.c ch-lang.c m2-lang.c
+ minsyms.c mipsread.c maint.c ch-exp.y c-lang.c ch-lang.c m2-lang.c \
+ complaints.c
# Source files in subdirectories (which will be handled separately by
# 'make gdb.tar.Z').
@@ -210,14 +211,12 @@ SFILES_MAINDIR = \
SFILES_SUBDIR = \
${srcdir}/vx-share/dbgRpcLib.h \
${srcdir}/vx-share/ptrace.h \
- ${srcdir}/vx-share/reg.h \
${srcdir}/vx-share/vxTypes.h \
${srcdir}/vx-share/vxWorks.h \
${srcdir}/vx-share/wait.h \
${srcdir}/vx-share/xdr_ld.h \
${srcdir}/vx-share/xdr_ptrace.h \
${srcdir}/vx-share/xdr_rdb.h \
- ${srcdir}/vx-share/xdr_regs.h \
${srcdir}/nindy-share/b.out.h \
${srcdir}/nindy-share/block_io.h \
${srcdir}/nindy-share/coff.h \
@@ -225,12 +224,6 @@ SFILES_SUBDIR = \
${srcdir}/nindy-share/env.h \
${srcdir}/nindy-share/stop.h \
${srcdir}/nindy-share/ttycntl.h \
- ${srcdir}/29k-share/include/coff.h \
- ${srcdir}/29k-share/include/error.h \
- ${srcdir}/29k-share/include/macros.h \
- ${srcdir}/29k-share/include/main.h \
- ${srcdir}/29k-share/include/memspcs.h \
- ${srcdir}/29k-share/include/miniint.h \
${srcdir}/29k-share/udi/udiphcfg.h \
${srcdir}/29k-share/udi/udiphsun.h \
${srcdir}/29k-share/udi/udiproc.h \
@@ -270,7 +263,7 @@ HFILES= breakpoint.h buildsym.h call-cmds.h command.h defs.h \
nm-sun2.h nm-sun3.h nm-sun386.h nm-sun4os4.h nm-trash.h \
nm-ultra3.h nm-hppab.h nm-hppah.h nm-umax.h nm-sysv4.h \
nm-apollo68b.h nm-apollo68v.h nm-vax.h nm-hp300bsd.h \
- nm-hp300hpux.h c-lang.h ch-lang.h m2-lang.h
+ nm-hp300hpux.h c-lang.h ch-lang.h m2-lang.h complaints.h
REMOTE_EXAMPLES = m68k-stub.c i386-stub.c sparc-stub.c rem-multi.shar
@@ -310,7 +303,7 @@ OBS = version.o main.o blockframe.o breakpoint.o findvar.o stack.o source.o \
ieee-float.o putenv.o parse.o language.o $(YYOBJ) \
buildsym.o objfiles.o minsyms.o maint.o demangle.o \
dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o \
- stabsread.o core.o c-lang.o ch-lang.o m2-lang.o
+ stabsread.o core.o c-lang.o ch-lang.o m2-lang.o complaints.o
RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES)
@@ -431,7 +424,6 @@ alldeps.mak: ${srcdir}/config
-e 's!xdr_ld.o!vx-share/xdr_ld.c!' \
-e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \
-e 's!xdr_rdb.o!vx-share/xdr_rdb.c!' \
- -e 's!xdr_regs.o!vx-share/xdr_regs.c!' \
-e 's!udr.o!29k-share/udi/udr.c!' \
-e 's!udip2soc.o!29k-share/udi/udip2soc.c!' \
-e 's/\.o/.c/' \
@@ -610,8 +602,7 @@ make-proto-gdb-1: ${TARFILES} ${TARDIRS} gdb.info
for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done
mkdir proto-gdb.dir/vx-share proto-gdb.dir/nindy-share \
proto-gdb.dir/29k-share
- mkdir proto-gdb.dir/29k-share/include proto-gdb.dir/29k-share/udi
- mkdir proto-gdb.dir/29k-share/dfe
+ mkdir proto-gdb.dir/29k-share/udi
cd proto-gdb.dir/config ; \
for i in $(SFILES_SUBDIR) $(NONSRC_SUBDIR) $(ALLDEPFILES_SUBDIR); \
do ln -s ../../$$i ../$$i ; done
@@ -775,9 +766,6 @@ xdr_ptrace.o: ${srcdir}/vx-share/xdr_ptrace.c
xdr_rdb.o: ${srcdir}/vx-share/xdr_rdb.c
${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/vx-share/xdr_rdb.c
-xdr_regs.o: ${srcdir}/vx-share/xdr_regs.c
- ${CC} -c ${INTERNAL_CFLAGS} ${srcdir}/vx-share/xdr_regs.c
-
nindy.o: ${srcdir}/nindy-share/nindy.c
${CC} -c ${INTERNAL_CFLAGS} -DSTRIP='"$(tooldir)/bin/strip"' \
${srcdir}/nindy-share/nindy.c
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index a25190a..73ca9b2 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symtab.h"
#include "symfile.h" /* Needed for "struct complaint" */
#include "objfiles.h"
+#include "complaints.h"
#include <string.h>
/* Ask buildsym.h to define the vars it normally declares `extern'. */
@@ -260,7 +261,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile)
}
else
{
- complain (&innerblock_anon_complaint, 0);
+ complain (&innerblock_anon_complaint);
}
BLOCK_START (pblock->block) = BLOCK_START (block);
BLOCK_END (pblock->block) = BLOCK_END (block);
@@ -345,7 +346,7 @@ make_blockvector (objfile)
> BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)))
{
complain (&blockvector_complaint,
- (char *) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
+ BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
}
}
}
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 1086d4c..6df6492 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
+#include "complaints.h"
#include <obstack.h>
#include <string.h>
@@ -614,8 +615,7 @@ coff_end_symtab (objfile)
if (BLOCK_START(pb->block) < BLOCK_START(pbnext->block)) {
struct block *tmp = pb->block;
- complain (&misordered_blocks_complaint,
- (char *) BLOCK_START (pb->block));
+ complain (&misordered_blocks_complaint, BLOCK_START (pb->block));
pb->block = pbnext->block;
pbnext->block = tmp;
swapped = 1;
@@ -1069,7 +1069,7 @@ read_coff_symtab (symtab_offset, nsyms, objfile)
/* main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains line number of '{' } */
if (cs->c_naux != 1)
- complain (&bf_no_aux_complaint, (char *) cs->c_symnum);
+ complain (&bf_no_aux_complaint, cs->c_symnum);
fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
new = (struct coff_context_stack *)
@@ -1094,12 +1094,12 @@ read_coff_symtab (symtab_offset, nsyms, objfile)
new = coff_context_stack;
if (new == 0)
{
- complain (&ef_complaint, (char *) cs->c_symnum);
+ complain (&ef_complaint, cs->c_symnum);
within_function = 0;
break;
}
if (cs->c_naux != 1) {
- complain (&ef_no_aux_complaint, (char *) cs->c_symnum);
+ complain (&ef_no_aux_complaint, cs->c_symnum);
fcn_last_line = 0x7FFFFFFF;
} else {
fcn_last_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
@@ -1446,7 +1446,7 @@ enter_linenos (file_offset, first_line, last_line)
if (file_offset < linetab_offset)
{
- complain (&lineno_complaint, (char *) file_offset);
+ complain (&lineno_complaint, file_offset);
if (file_offset > linetab_size) /* Too big to be an offset? */
return;
file_offset += linetab_offset; /* Try reading at that linetab offset */
diff --git a/gdb/complaints.c b/gdb/complaints.c
new file mode 100644
index 0000000..b8ab240
--- /dev/null
+++ b/gdb/complaints.c
@@ -0,0 +1,154 @@
+/* Support for complaint handling during symbol reading in GDB.
+ Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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 2 of the License, or
+(at your option) any later version.
+
+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 this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "defs.h"
+#include "complaints.h"
+#include "gdbcmd.h"
+#include <varargs.h>
+
+/* Structure to manage complaints about symbol file contents. */
+
+struct complaint complaint_root[1] = {
+ {
+ (char *) NULL, /* Complaint message */
+ 0, /* Complaint counter */
+ complaint_root /* Next complaint. */
+ }
+};
+
+/* How many complaints about a particular thing should be printed before
+ we stop whining about it? Default is no whining at all, since so many
+ systems have ill-constructed symbol files. */
+
+static unsigned int stop_whining = 0;
+
+/* Should each complaint be self explanatory, or should we assume that
+ a series of complaints is being produced?
+ case 0: self explanatory message.
+ case 1: First message of a series that must start off with explanation.
+ case 2: Subsequent message, when user already knows we are reading
+ symbols and we can just state our piece. */
+
+static int complaint_series = 0;
+
+/* External variables and functions referenced. */
+
+extern int info_verbose;
+
+
+/* Functions to handle complaints during symbol reading. */
+
+/* Print a complaint about the input symbols, and link the complaint block
+ into a chain for later handling. */
+
+/* VARARGS */
+void
+complain (va_alist)
+ va_dcl
+{
+ va_list args;
+ struct complaint *complaint;
+ char *val;
+
+ va_start (args);
+ complaint = va_arg (args, struct complaint *);
+ complaint -> counter++;
+ if (complaint -> next == NULL)
+ {
+ complaint -> next = complaint_root -> next;
+ complaint_root -> next = complaint;
+ }
+ if (complaint -> counter > stop_whining)
+ {
+ return;
+ }
+ wrap_here ("");
+
+ switch (complaint_series + (info_verbose << 1))
+ {
+
+ /* Isolated messages, must be self-explanatory. */
+ case 0:
+ begin_line ();
+ puts_filtered ("During symbol reading, ");
+ wrap_here ("");
+ vprintf_filtered (complaint -> message, args);
+ puts_filtered (".\n");
+ break;
+
+ /* First of a series, without `set verbose'. */
+ case 1:
+ begin_line ();
+ puts_filtered ("During symbol reading...");
+ vprintf_filtered (complaint -> message, args);
+ puts_filtered ("...");
+ wrap_here ("");
+ complaint_series++;
+ break;
+
+ /* Subsequent messages of a series, or messages under `set verbose'.
+ (We'll already have produced a "Reading in symbols for XXX..."
+ message and will clean up at the end with a newline.) */
+ default:
+ vprintf_filtered (complaint -> message, args);
+ puts_filtered ("...");
+ wrap_here ("");
+ }
+ va_end (args);
+}
+
+/* Clear out all complaint counters that have ever been incremented.
+ If sym_reading is 1, be less verbose about successive complaints,
+ since the messages are appearing all together during a command that
+ reads symbols (rather than scattered around as psymtabs get fleshed
+ out into symtabs at random times). If noisy is 1, we are in a
+ noisy symbol reading command, and our caller will print enough
+ context for the user to figure it out. */
+
+void
+clear_complaints (sym_reading, noisy)
+ int sym_reading;
+ int noisy;
+{
+ struct complaint *p;
+
+ for (p = complaint_root -> next; p != complaint_root; p = p -> next)
+ {
+ p -> counter = 0;
+ }
+
+ if (!sym_reading && !noisy && complaint_series > 1)
+ {
+ /* Terminate previous series, since caller won't. */
+ puts_filtered ("\n");
+ }
+
+ complaint_series = sym_reading ? 1 + noisy : 0;
+}
+
+_initialize_complaints ()
+{
+ add_show_from_set
+ (add_set_cmd ("complaints", class_support, var_zinteger,
+ (char *) &stop_whining,
+ "Set max number of complaints about incorrect symbols.",
+ &setlist),
+ &showlist);
+
+}
diff --git a/gdb/complaints.h b/gdb/complaints.h
new file mode 100644
index 0000000..f7ff5a5
--- /dev/null
+++ b/gdb/complaints.h
@@ -0,0 +1,46 @@
+/* Definitions for complaint handling during symbol reading in GDB.
+ Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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 2 of the License, or
+(at your option) any later version.
+
+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 this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+
+/* Support for complaining about things in the symbol file that aren't
+ catastrophic.
+
+ Each such thing gets a counter. The first time we have the problem,
+ during a symbol read, we report it. At the end of symbol reading,
+ if verbose, we report how many of each problem we had. */
+
+struct complaint
+{
+ char *message;
+ unsigned counter;
+ struct complaint *next;
+};
+
+/* Root of the chain of complaints that have at some point been issued.
+ This is used to reset the counters, and/or report the total counts. */
+
+extern struct complaint complaint_root[1];
+
+/* Functions that handle complaints. (in complaints.c) */
+
+extern void
+complain ();
+
+extern void
+clear_complaints PARAMS ((int, int));
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index c6935d7..a859597 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -71,6 +71,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "stabsread.h"
#include "gdb-stabs.h"
#include "demangle.h"
+#include "language.h" /* Needed inside partial-stab.h */
+#include "complaints.h"
#include "aout/aout64.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */
@@ -348,7 +350,7 @@ add_old_header_file (name, instance)
add_this_object_header_file (i);
return;
}
- complain (&repeated_header_complaint, (char *)symnum);
+ complain (&repeated_header_complaint, symnum);
complain (&repeated_header_name_complaint, name);
}
@@ -919,7 +921,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
symbol table. Read them in first. */
hp_symbuf_end = hp_symbuf_idx = 0;
- bfd_seek (abfd, HP_SYMTAB_OFFSET (objfile), 0);
+ bfd_seek (abfd, HP_SYMTAB_OFFSET (objfile), L_SET);
for (hp_symnum = 0; hp_symnum < HP_SYMCOUNT (objfile); hp_symnum++)
{
@@ -980,7 +982,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
objfile);
}
}
- bfd_seek (abfd, DBX_SYMTAB_OFFSET (objfile), 0);
+ bfd_seek (abfd, DBX_SYMTAB_OFFSET (objfile), L_SET);
#endif
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
@@ -1018,7 +1020,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
#define SET_NAMESTRING()\
if (((unsigned)bufp->n_strx + file_string_table_offset) >= \
DBX_STRINGTAB_SIZE (objfile)) { \
- complain (&string_table_offset_complaint, (char *) symnum); \
+ complain (&string_table_offset_complaint, symnum); \
namestring = "foo"; \
} else \
namestring = bufp->n_strx + file_string_table_offset + \
@@ -1535,7 +1537,6 @@ read_ofile_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
However, there is no reason not to accept
the GCC_COMPILED_FLAG_SYMBOL anywhere. */
- processing_gcc_compilation = 0;
if (strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL) == 0)
processing_gcc_compilation = 1;
else if (strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0)
@@ -1614,6 +1615,12 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
static CORE_ADDR function_start_offset;
char *colon_pos;
+#ifndef BLOCK_ADDRESS_FUNCTION_RELATIVE
+ /* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
+ function start address, so just use the text offset. */
+ function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
+#endif
+
/* Something is wrong if we see real data before
seeing a source file name. */
@@ -1671,9 +1678,6 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
absolute, or relative to the N_SO, depending on
BLOCK_ADDRESS_ABSOLUTE. */
function_start_offset = valu;
-#else
- /* Default on ordinary systems */
- function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
#endif
within_function = 1;
@@ -1686,7 +1690,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
}
/* Stack must be empty now. */
if (context_stack_depth != 0)
- complain (&lbrac_unmatched_complaint, (char *) symnum);
+ complain (&lbrac_unmatched_complaint, symnum);
new = push_context (0, valu);
new->name = define_symbol (valu, name, desc, type, objfile);
@@ -1708,7 +1712,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
#ifndef SUN_FIXED_LBRAC_BUG
if (valu < last_pc_address) {
/* Patch current LBRAC pc value to match last handy pc value */
- complain (&lbrac_complaint, 0);
+ complain (&lbrac_complaint);
valu = last_pc_address;
}
#endif
@@ -1730,7 +1734,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
new = pop_context();
if (desc != new->depth)
- complain (&lbrac_mismatch_complaint, (char *) symnum);
+ complain (&lbrac_mismatch_complaint, symnum);
/* Some compilers put the variable decls inside of an
LBRAC/RBRAC block. This macro should be nonzero if this
@@ -1762,7 +1766,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
/* FIXME Muzzle a compiler bug that makes end < start. */
if (new->start_addr > valu)
{
- complain(&lbrac_rbrac_complaint, 0);
+ complain (&lbrac_rbrac_complaint);
new->start_addr = valu;
}
/* Make a block for the local symbols within. */
@@ -2059,9 +2063,9 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
struct objfile *objfile;
struct section_offsets *section_offsets;
int mainline;
- unsigned int staboffset;
+ file_ptr staboffset;
unsigned int stabsize;
- unsigned int stabstroffset;
+ file_ptr stabstroffset;
unsigned int stabstrsize;
{
int val;
diff --git a/gdb/defs.h b/gdb/defs.h
index 2ec8a0c..34d47f7 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -41,6 +41,7 @@ typedef unsigned int CORE_ADDR;
extern int quit_flag;
extern int immediate_quit;
+extern int sevenbit_strings;
extern void
quit PARAMS ((void));
@@ -184,6 +185,9 @@ extern int
query ();
extern void
+begin_line PARAMS ((void));
+
+extern void
wrap_here PARAMS ((char *));
extern void
@@ -199,6 +203,9 @@ extern void
puts_filtered PARAMS ((char *));
extern void
+vprintf_filtered ();
+
+extern void
vfprintf_filtered ();
extern void
@@ -223,7 +230,7 @@ extern char *
n_spaces PARAMS ((int));
extern void
-printchar PARAMS ((int, FILE *, int));
+gdb_printchar PARAMS ((int, FILE *, int));
extern char *
strdup_demangled PARAMS ((const char *));
@@ -334,7 +341,10 @@ extern unsigned output_radix;
/* Baud rate specified for communication with serial target systems. */
extern char *baud_rate;
-/* Languages represented in the symbol table and elsewhere. */
+/* Languages represented in the symbol table and elsewhere.
+ This should probably be in language.h, but since enum's can't
+ be forward declared to satisfy opaque references before their
+ actual definition, needs to be here. */
enum language
{
@@ -342,31 +352,12 @@ enum language
language_auto, /* Placeholder for automatic setting */
language_c, /* C */
language_cplus, /* C++ */
+ /* start-sanitize-chill */
language_chill, /* Chill */
+ /* end-sanitize-chill */
language_m2 /* Modula-2 */
};
-/* Return a format string for printf that will print a number in the local
- (language-specific) hexadecimal format. Result is static and is
- overwritten by the next call. local_hex_format_custom takes printf
- options like "08" or "l" (to produce e.g. %08x or %lx). */
-
-#define local_hex_format() (current_language->la_hex_format)
-
-extern char *
-local_hex_format_custom PARAMS ((char *)); /* language.c */
-
-/* Return a string that contains a number formatted in the local
- (language-specific) hexadecimal format. Result is static and is
- overwritten by the next call. local_hex_string_custom takes printf
- options like "08" or "l". */
-
-extern char *
-local_hex_string PARAMS ((int)); /* language.c */
-
-extern char *
-local_hex_string_custom PARAMS ((int, char *)); /* language.c */
-
/* Host machine definition. This will be a symlink to one of the
xm-*.h files, built by the `configure' script. */
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 6d63543..5e22da5 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -52,11 +52,12 @@ other things to work on, if you get bored. :-)
#include "demangle.h"
#include "expression.h" /* Needed for enum exp_opcode in language.h, sigh... */
#include "language.h"
+#include "complaints.h"
-#include <varargs.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
+
#ifndef NO_SYS_FILE
#include <sys/file.h>
#endif
@@ -66,11 +67,117 @@ other things to work on, if you get bored. :-)
#define L_SET 0
#endif
-#ifdef MAINTENANCE /* Define to 1 to compile in some maintenance stuff */
-#define SQUAWK(stuff) dwarfwarn stuff
-#else
-#define SQUAWK(stuff)
-#endif
+/* Some macros to provide DIE info for complaints. */
+
+#define DIE_ID (curdie!=NULL ? curdie->die_ref : 0)
+#define DIE_NAME (curdie!=NULL && curdie->at_name!=NULL) ? curdie->at_name : ""
+
+/* Complaints that can be issued during DWARF debug info reading. */
+
+struct complaint no_bfd_get_N =
+{
+ "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0
+};
+
+struct complaint malformed_die =
+{
+ "DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0
+};
+
+struct complaint bad_die_ref =
+{
+ "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0
+};
+
+struct complaint unknown_attribute_form =
+{
+ "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0
+};
+
+struct complaint unknown_attribute_length =
+{
+ "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0
+};
+
+struct complaint unexpected_fund_type =
+{
+ "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0
+};
+
+struct complaint unknown_type_modifier =
+{
+ "DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0
+};
+
+struct complaint volatile_ignored =
+{
+ "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0
+};
+
+struct complaint const_ignored =
+{
+ "DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0
+};
+
+struct complaint botched_modified_type =
+{
+ "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0
+};
+
+struct complaint op_deref2 =
+{
+ "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0
+};
+
+struct complaint op_deref4 =
+{
+ "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0
+};
+
+struct complaint basereg_not_handled =
+{
+ "DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0
+};
+
+struct complaint dup_user_type_allocation =
+{
+ "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0
+};
+
+struct complaint dup_user_type_definition =
+{
+ "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0
+};
+
+struct complaint missing_tag =
+{
+ "DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0
+};
+
+struct complaint bad_array_element_type =
+{
+ "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0
+};
+
+struct complaint subscript_data_items =
+{
+ "DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0
+};
+
+struct complaint unhandled_array_subscript_format =
+{
+ "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0
+};
+
+struct complaint unknown_array_subscript_format =
+{
+ "DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0
+};
+
+struct complaint not_row_major =
+{
+ "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
+};
#ifndef R_FP /* FIXME */
#define R_FP 14 /* Kludge to get frame pointer register number */
@@ -372,9 +479,6 @@ read_lexical_block_scope PARAMS ((struct dieinfo *, char *, char *,
struct objfile *));
static void
-dwarfwarn ();
-
-static void
scan_partial_symbols PARAMS ((char *, char *, struct objfile *));
static void
@@ -714,55 +818,6 @@ record_minimal_symbol (name, address, ms_type, objfile)
LOCAL FUNCTION
- dwarfwarn -- issue a DWARF related warning
-
-DESCRIPTION
-
- Issue warnings about DWARF related things that aren't serious enough
- to warrant aborting with an error, but should not be ignored either.
- This includes things like detectable corruption in DIE's, missing
- DIE's, unimplemented features, etc.
-
- In general, running across tags or attributes that we don't recognize
- is not considered to be a problem and we should not issue warnings
- about such.
-
-NOTES
-
- We mostly follow the example of the error() routine, but without
- returning to command level. It is arguable about whether warnings
- should be issued at all, and if so, where they should go (stdout or
- stderr).
-
- We assume that curdie is valid and contains at least the basic
- information for the DIE where the problem was noticed.
-*/
-
-static void
-dwarfwarn (va_alist)
- va_dcl
-{
- va_list ap;
- char *fmt;
-
- va_start (ap);
- fmt = va_arg (ap, char *);
- warning_setup ();
- fprintf (stderr, "warning: DWARF ref 0x%x: ", curdie -> die_ref);
- if (curdie -> at_name)
- {
- fprintf (stderr, "'%s': ", curdie -> at_name);
- }
- vfprintf (stderr, fmt, ap);
- fprintf (stderr, "\n");
- fflush (stderr);
- va_end (ap);
-}
-
-/*
-
-LOCAL FUNCTION
-
read_lexical_block_scope -- process all dies in a lexical block
SYNOPSIS
@@ -826,7 +881,7 @@ lookup_utype (die_ref)
utypeidx = (die_ref - dbroff) / 4;
if ((utypeidx < 0) || (utypeidx >= numutypes))
{
- dwarfwarn ("reference to DIE (0x%x) outside compilation unit", die_ref);
+ complain (&bad_die_ref, DIE_ID, DIE_NAME);
}
else
{
@@ -870,12 +925,12 @@ alloc_utype (die_ref, utypep)
if ((utypeidx < 0) || (utypeidx >= numutypes))
{
utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- dwarfwarn ("reference to DIE (0x%x) outside compilation unit", die_ref);
+ complain (&bad_die_ref, DIE_ID, DIE_NAME);
}
else if (*typep != NULL)
{
utypep = *typep;
- SQUAWK (("internal error: dup user type allocation"));
+ complain (&dup_user_type_allocation, DIE_ID, DIE_NAME);
}
else
{
@@ -1002,7 +1057,7 @@ struct_type (dip, thisdie, enddie, objfile)
/* Should never happen */
TYPE_CODE (type) = TYPE_CODE_UNDEF;
tpart1 = "???";
- SQUAWK (("missing class, structure, or union tag"));
+ complain (&missing_tag, DIE_ID, DIE_NAME);
break;
}
/* Some compilers try to be helpful by inventing "fake" names for
@@ -1210,7 +1265,7 @@ decode_array_element_type (scan)
scan += SIZEOF_ATTRIBUTE;
if ((nbytes = attribute_size (attribute)) == -1)
{
- SQUAWK (("bad array element type attribute 0x%x", attribute));
+ complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
}
else
@@ -1237,7 +1292,7 @@ decode_array_element_type (scan)
typep = decode_mod_u_d_type (scan);
break;
default:
- SQUAWK (("bad array element type attribute 0x%x", attribute));
+ complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
break;
}
@@ -1326,7 +1381,7 @@ decode_subscript_data_item (scan, end)
if (nexttype == NULL)
{
/* Munged subscript data or other problem, fake it. */
- SQUAWK (("can't decode subscript data items"));
+ complain (&subscript_data_items, DIE_ID, DIE_NAME);
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
}
typep = create_array_type ((struct type *) NULL, nexttype, indextype,
@@ -1339,12 +1394,12 @@ decode_subscript_data_item (scan, end)
case FMT_UT_C_X:
case FMT_UT_X_C:
case FMT_UT_X_X:
- SQUAWK (("array subscript format 0x%x not handled yet", format));
+ complain (&unhandled_array_subscript_format, DIE_ID, DIE_NAME, format);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
typep = create_array_type ((struct type *) NULL, typep, typep, 0, 1);
break;
default:
- SQUAWK (("unknown array subscript format %x", format));
+ complain (&unknown_array_subscript_format, DIE_ID, DIE_NAME, format);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
typep = create_array_type ((struct type *) NULL, typep, typep, 0, 1);
break;
@@ -1382,7 +1437,7 @@ dwarf_read_array_type (dip)
if (dip -> at_ordering != ORD_row_major)
{
/* FIXME: Can gdb even handle column major arrays? */
- SQUAWK (("array not row major; not handled correctly"));
+ complain (&not_row_major, DIE_ID, DIE_NAME);
}
if ((sub = dip -> at_subscr_data) != NULL)
{
@@ -1412,7 +1467,7 @@ dwarf_read_array_type (dip)
{
/* Double ick! Not only is a type already in our slot, but
someone has decorated it. Complain and leave it alone. */
- SQUAWK (("duplicate user defined array type definition"));
+ complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
}
}
}
@@ -1521,7 +1576,7 @@ read_subroutine_type (dip, thisdie, enddie)
}
else
{
- SQUAWK (("duplicate user defined function type definition"));
+ complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
}
}
@@ -2142,7 +2197,8 @@ locval (loc)
else
{
stack[++stacki] = 0;
- SQUAWK (("BASEREG %d not handled!", regno));
+
+ complain (&basereg_not_handled, DIE_ID, DIE_NAME, regno);
}
break;
case OP_ADDR:
@@ -2159,10 +2215,10 @@ locval (loc)
break;
case OP_DEREF2:
/* pop, deref and push 2 bytes (as a long) */
- SQUAWK (("OP_DEREF2 address 0x%x not handled", stack[stacki]));
+ complain (&op_deref2, DIE_ID, DIE_NAME, stack[stacki]);
break;
case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */
- SQUAWK (("OP_DEREF4 address 0x%x not handled", stack[stacki]));
+ complain (&op_deref4, DIE_ID, DIE_NAME, stack[stacki]);
break;
case OP_ADD: /* pop top 2 items, add, push result */
stack[stacki - 1] += stack[stacki];
@@ -2668,7 +2724,8 @@ scan_partial_symbols (thisdie, enddie, objfile)
temp = dbbase + di.at_sibling - dbroff;
if ((temp < thisdie) || (temp >= enddie))
{
- dwarfwarn ("reference to DIE (0x%x) outside compilation unit", di.at_sibling);
+ complain (&bad_die_ref, DIE_ID, DIE_NAME,
+ di.at_sibling);
}
else
{
@@ -3166,7 +3223,7 @@ decode_modified_type (modifiers, modcount, mtype)
}
break;
default:
- SQUAWK (("botched modified type decoding (mtype 0x%x)", mtype));
+ complain (&botched_modified_type, DIE_ID, DIE_NAME, mtype);
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
break;
}
@@ -3184,17 +3241,16 @@ decode_modified_type (modifiers, modcount, mtype)
typep = lookup_reference_type (typep);
break;
case MOD_const:
- SQUAWK (("type modifier 'const' ignored")); /* FIXME */
+ complain (&const_ignored, DIE_ID, DIE_NAME); /* FIXME */
break;
case MOD_volatile:
- SQUAWK (("type modifier 'volatile' ignored")); /* FIXME */
+ complain (&volatile_ignored, DIE_ID, DIE_NAME); /* FIXME */
break;
default:
if (!(MOD_lo_user <= (unsigned char) modifier
&& (unsigned char) modifier <= MOD_hi_user))
{
- SQUAWK (("unknown type modifier %u",
- (unsigned char) modifier));
+ complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier);
}
break;
}
@@ -3337,7 +3393,7 @@ decode_fund_type (fundtype)
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
{
- SQUAWK (("unexpected fundamental type 0x%x", fundtype));
+ complain (&unexpected_fund_type, DIE_ID, DIE_NAME, fundtype);
}
}
@@ -3440,7 +3496,7 @@ basicdieinfo (dip, diep, objfile)
if ((dip -> die_length < SIZEOF_DIE_LENGTH) ||
((diep + dip -> die_length) > (dbbase + dbsize)))
{
- dwarfwarn ("malformed DIE, bad length (%d bytes)", dip -> die_length);
+ complain (&malformed_die, DIE_ID, DIE_NAME, dip -> die_length);
dip -> die_length = 0;
}
else if (dip -> die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG))
@@ -3508,7 +3564,7 @@ completedieinfo (dip, objfile)
diep += SIZEOF_ATTRIBUTE;
if ((nbytes = attribute_size (attr)) == -1)
{
- SQUAWK (("unknown attribute length, skipped remaining attributes"));;
+ complain (&unknown_attribute_length, DIE_ID, DIE_NAME);
diep = end;
continue;
}
@@ -3665,8 +3721,7 @@ completedieinfo (dip, objfile)
diep += strlen (diep) + 1;
break;
default:
- SQUAWK (("unknown attribute form (0x%x)", form));
- SQUAWK (("unknown attribute length, skipped remaining attributes"));;
+ complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
diep = end;
break;
}
@@ -3724,7 +3779,7 @@ target_to_host (from, nbytes, signextend, objfile)
rtnval = bfd_get_8 (objfile -> obfd, (bfd_byte *) from);
break;
default:
- dwarfwarn ("no bfd support for %d byte data object", nbytes);
+ complain (&no_bfd_get_N, DIE_ID, DIE_NAME, nbytes);
rtnval = 0;
break;
}
@@ -3780,7 +3835,7 @@ attribute_size (attr)
nbytes = TARGET_FT_POINTER_SIZE (objfile);
break;
default:
- SQUAWK (("unknown attribute form (0x%x)", form));
+ complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
nbytes = -1;
break;
}
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 7379436..8c21243 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -43,6 +43,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "objfiles.h"
#include "buildsym.h"
#include "gdb-stabs.h"
+#include "complaints.h"
#include <string.h>
#define STREQ(a,b) (strcmp((a),(b))==0)
@@ -373,13 +374,12 @@ elf_symtab_read (abfd, addr, objfile)
sizeof (*sectinfo));
memset ((PTR) sectinfo, 0, sizeof (*sectinfo));
if (!filesym)
- complain (&section_info_complaint, (char *)sym->name);
+ complain (&section_info_complaint, sym->name);
else
sectinfo->filename = (char *)filesym->name;
}
if (sectinfo->sections[index])
- complain (&section_info_dup_complaint,
- (char *)sectinfo->filename);
+ complain (&section_info_dup_complaint, sectinfo->filename);
symaddr = sym -> value;
/* Relocate all non-absolute symbols by base address. */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e3ec14a..392fec3 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "value.h"
#include "demangle.h"
+#include "complaints.h"
/* Alloc a new type structure and fill it with some defaults. If
OBJFILE is non-NULL, then allocate the space for the type structure
@@ -733,7 +734,7 @@ check_stub_type (type)
struct symbol *sym;
if (name == NULL)
{
- complain (&stub_noname_complaint, 0);
+ complain (&stub_noname_complaint);
return;
}
sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0,
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 15e5d8b..0760f1e 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -58,6 +58,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#include "buildsym.h"
#include "stabsread.h"
+#include "complaints.h"
#ifdef USG
#include <sys/types.h>
@@ -1135,7 +1136,7 @@ data: /* Common code for symbols describing data */
tsym = ((SYMR*)cur_fdr->isymBase)
+ tsym->index-1;
}
- else complain (&block_member_complaint, (char *)tsym->st);
+ else complain (&block_member_complaint, tsym->st);
}
/* In an stBlock, there is no way to distinguish structs,
@@ -1292,7 +1293,7 @@ data: /* Common code for symbols describing data */
/* End of file. Pop parse stack and ignore. Higher
level code deals with this. */
;
- } else complain (&stEnd_complaint, (char *)sh->sc);
+ } else complain (&stEnd_complaint, sh->sc);
pop_parse_stack(); /* restore previous lexical context */
break;
@@ -1328,7 +1329,7 @@ data: /* Common code for symbols describing data */
case stConstant:
break; /* constant */
default:
- complain(&unknown_mips_symtype_complaint, (char *)sh->st);
+ complain(&unknown_mips_symtype_complaint, sh->st);
break;
}
sh->st = stParsed;
@@ -1390,7 +1391,7 @@ parse_type(ax, bs, bigend)
tax = ax;
ecoff_swap_tir_in (bigend, &tax->a_ti, t);
if (t->bt > (sizeof (map_bt)/sizeof (*map_bt))) {
- complain (&basic_type_complaint, (char *)t->bt);
+ complain (&basic_type_complaint, t->bt);
return builtin_type_int;
}
if (map_bt[t->bt]) {
@@ -1426,7 +1427,7 @@ parse_type(ax, bs, bigend)
break;
case btTypedef:
default:
- complain (&basic_type_complaint, (char *)t->bt);
+ complain (&basic_type_complaint, t->bt);
return builtin_type_int;
}
}
@@ -1606,7 +1607,7 @@ upgrade_type(tpp, tq, ax, bigend)
TYPE_LENGTH(TYPE_TARGET_TYPE(t)) = id >> 3;
}
if (id != rf)
- complain (&array_bitsize_complaint, (char *)rf);
+ complain (&array_bitsize_complaint, rf);
TYPE_LENGTH(t) = (upper < 0) ? 0 :
(upper - lower + 1) * (rf >> 3);
@@ -1622,7 +1623,7 @@ upgrade_type(tpp, tq, ax, bigend)
return 0;
default:
- complain (&unknown_type_qual_complaint, (char *)tq);
+ complain (&unknown_type_qual_complaint, tq);
return 0;
}
}
@@ -1650,7 +1651,7 @@ parse_procedure (pr, bound, have_stabs)
/* Static procedure at address pr->adr. Sigh. */
if (sh == (SYMR*)-1) {
- complain (&pdr_static_symbol_complaint, (char *)pr->adr);
+ complain (&pdr_static_symbol_complaint, pr->adr);
return;
}
sh_name = (char*)sh->iss;
@@ -1937,7 +1938,7 @@ parse_partial_symbols (end_of_text_seg, objfile, section_offsets)
break;
default:
ms_type = mst_unknown;
- complain (&unknown_ext_complaint, (char *)esh->asym.iss);
+ complain (&unknown_ext_complaint, esh->asym.iss);
}
prim_record_minimal_symbol ((char *)esh->asym.iss,
esh->asym.value,
@@ -2114,8 +2115,8 @@ parse_partial_symbols (end_of_text_seg, objfile, section_offsets)
default:
/* Both complaints are valid: one gives symbol name,
the other the offending symbol type. */
- complain (&unknown_sym_complaint, (char *)sh->iss);
- complain (&unknown_st_complaint, (char *)sh->st);
+ complain (&unknown_sym_complaint, sh->iss);
+ complain (&unknown_st_complaint, sh->st);
cur_sdx++;
continue;
}
@@ -2147,7 +2148,7 @@ parse_partial_symbols (end_of_text_seg, objfile, section_offsets)
class = LOC_LABEL;
break;
default:
- complain (&unknown_ext_complaint, (char *)sh->iss);
+ complain (&unknown_ext_complaint, sh->iss);
/* Fall through, pretend it's global. */
case stGlobal:
class = LOC_STATIC;
@@ -2206,7 +2207,7 @@ parse_partial_symbols (end_of_text_seg, objfile, section_offsets)
for (s_idx = s_id0; s_idx < fh->crfd; s_idx++) {
RFDT *rh = (RFDT *) (fh->rfdBase) + s_idx;
if (*rh < 0 || *rh >= hdr->ifdMax)
- complain(&bad_file_number_complaint, (char *)*rh);
+ complain(&bad_file_number_complaint, *rh);
else
pst->dependencies[s_idx-s_id0] = fdr_to_pst[*rh].pst;
}
@@ -2401,7 +2402,7 @@ psymtab_to_symtab_1(pst, filename)
/* Handle encoded stab line number. */
record_line (current_subfile, sh->index, valu);
}
- else complain (&stab_unknown_complaint, (char *)sh->iss);
+ else complain (&stab_unknown_complaint, sh->iss);
}
st = end_symtab (pst->texthigh, 0, 0, pst->objfile);
end_stabs ();
diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h
index 2c2c0f8..b7fc445 100644
--- a/gdb/partial-stab.h
+++ b/gdb/partial-stab.h
@@ -642,6 +642,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
default:
/* If we haven't found it yet, ignore it. It's probably some
new type we don't know about yet. */
- complain (&unknown_symtype_complaint, local_hex_string(CUR_SYMBOL_TYPE));
+ complain (&unknown_symtype_complaint,
+ local_hex_string (CUR_SYMBOL_TYPE));
continue;
}
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index 90a0ef1..1f862a6 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -809,7 +809,7 @@ vx_lookup_symbol (name, pAddr)
status = net_clnt_call (VX_SYMBOL_INQ, xdr_wrapstring, &name,
xdr_SYMBOL_ADDR, &symbolAddr);
if (status != RPC_SUCCESS) {
- complain (&cant_contact_target, 0);
+ complain (&cant_contact_target);
return -1;
}
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index dfbd3cb..ec7900b 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -29,10 +29,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "obstack.h"
#include "symtab.h"
#include "gdbtypes.h"
-#include "symfile.h" /* Needed for "struct complaint" */
+#include "symfile.h"
#include "objfiles.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native */
#include "buildsym.h"
+#include "complaints.h"
/* Ask stabsread.h to define the vars it normally declares `extern'. */
#define EXTERN /**/
@@ -943,7 +944,7 @@ struct type *
error_type (pp)
char **pp;
{
- complain (&error_type_complaint, 0);
+ complain (&error_type_complaint);
while (1)
{
/* Skip to end of symbol. */
@@ -1229,7 +1230,7 @@ read_type (pp, objfile)
(*pp)++;
return_type = read_type (pp, objfile);
if (*(*pp)++ != ';')
- complain (&invalid_member_complaint, (char *) symnum);
+ complain (&invalid_member_complaint, symnum);
type = allocate_stub_method (return_type);
if (typenums[0] != -1)
*dbx_lookup_type (typenums) = type;
@@ -1504,7 +1505,7 @@ read_member_functions (fip, pp, type, objfile)
case '.':
break;
default:
- complain (&const_vol_complaint, (char *) (long) **pp);
+ complain (&const_vol_complaint, **pp);
break;
}
@@ -1565,7 +1566,7 @@ read_member_functions (fip, pp, type, objfile)
default:
/* error */
- complain (&member_fn_complaint, (char *) (long) (*pp)[-1]);
+ complain (&member_fn_complaint, (*pp)[-1]);
/* Fall through into normal member function. */
case '.':
@@ -1659,7 +1660,7 @@ read_cpp_abbrev (fip, pp, type, objfile)
name = type_name_no_tag (context);
if (name == NULL)
{
- complain (&invalid_cpp_type_complaint, (char *) symnum);
+ complain (&invalid_cpp_type_complaint, symnum);
name = "FOO";
}
fip -> list -> field.name =
@@ -1791,7 +1792,7 @@ read_one_struct_field (fip, pp, p, type, objfile)
stuff. */
if (fip -> list -> field.bitpos == 0 && fip -> list -> field.bitsize == 0)
{
- complain (&dbx_class_complaint, 0);
+ complain (&dbx_class_complaint);
/* Ignore this field. */
fip -> list = fip -> list -> next;
}
@@ -2908,7 +2909,7 @@ read_range_type (pp, typenums, objfile)
TYPE_TARGET_TYPE (result_type) = *dbx_lookup_type(rangenums);
if (TYPE_TARGET_TYPE (result_type) == 0) {
- complain (&range_type_base_complaint, (char *) rangenums[1]);
+ complain (&range_type_base_complaint, rangenums[1]);
TYPE_TARGET_TYPE (result_type) = lookup_fundamental_type (objfile, FT_INTEGER);
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 96c994f..908ff09 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcmd.h"
#include "breakpoint.h"
#include "language.h"
+#include "complaints.h"
#include <obstack.h>
#include <assert.h>
@@ -44,6 +45,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int readnow_symbol_files; /* Read full symbols immediately */
+struct complaint oldsyms_complaint = {
+ "Replacing old symbols for `%s'", 0, 0
+};
+
+struct complaint empty_symtab_complaint = {
+ "Empty symbol table found for `%s'", 0, 0
+};
+
/* External variables and functions referenced. */
extern int info_verbose;
@@ -96,20 +105,6 @@ int symbol_reloading = SYMBOL_RELOADING_DEFAULT;
int symbol_reloading = 0;
#endif
-/* Structure to manage complaints about symbol file contents. */
-
-struct complaint complaint_root[1] = {
- {(char *) 0, 0, complaint_root},
-};
-
-/* Some actual complaints. */
-
-struct complaint oldsyms_complaint = {
- "Replacing old symbols for `%s'", 0, 0 };
-
-struct complaint empty_symtab_complaint = {
- "Empty symbol table found for `%s'", 0, 0 };
-
/* In the following sort, we always make sure that
register debug symbol declarations always come before regular
@@ -949,95 +944,7 @@ the_big_top:
if (reread_one)
breakpoint_re_set ();
}
-
-/* Functions to handle complaints during symbol reading. */
-
-/* How many complaints about a particular thing should be printed before
- we stop whining about it? Default is no whining at all, since so many
- systems have ill-constructed symbol files. */
-
-static unsigned stop_whining = 0;
-
-/* Should each complaint be self explanatory, or should we assume that
- a series of complaints is being produced?
- case 0: self explanatory message.
- case 1: First message of a series that must start off with explanation.
- case 2: Subsequent message, when user already knows we are reading
- symbols and we can just state our piece. */
-
-static int complaint_series = 0;
-
-/* Print a complaint about the input symbols, and link the complaint block
- into a chain for later handling. */
-void
-complain (complaint, val)
- struct complaint *complaint;
- char *val;
-{
- complaint->counter++;
- if (complaint->next == 0) {
- complaint->next = complaint_root->next;
- complaint_root->next = complaint;
- }
- if (complaint->counter > stop_whining)
- return;
- wrap_here ("");
-
- switch (complaint_series + (info_verbose << 1)) {
-
- /* Isolated messages, must be self-explanatory. */
- case 0:
- puts_filtered ("During symbol reading, ");
- wrap_here("");
- printf_filtered (complaint->message, val);
- puts_filtered (".\n");
- break;
-
- /* First of a series, without `set verbose'. */
- case 1:
- puts_filtered ("During symbol reading...");
- printf_filtered (complaint->message, val);
- puts_filtered ("...");
- wrap_here("");
- complaint_series++;
- break;
-
- /* Subsequent messages of a series, or messages under `set verbose'.
- (We'll already have produced a "Reading in symbols for XXX..." message
- and will clean up at the end with a newline.) */
- default:
- printf_filtered (complaint->message, val);
- puts_filtered ("...");
- wrap_here("");
- }
-}
-
-/* Clear out all complaint counters that have ever been incremented.
- If sym_reading is 1, be less verbose about successive complaints,
- since the messages are appearing all together during a command that
- reads symbols (rather than scattered around as psymtabs get fleshed
- out into symtabs at random times). If noisy is 1, we are in a
- noisy symbol reading command, and our caller will print enough
- context for the user to figure it out. */
-
-void
-clear_complaints (sym_reading, noisy)
- int sym_reading;
- int noisy;
-{
- struct complaint *p;
-
- for (p = complaint_root->next; p != complaint_root; p = p->next)
- p->counter = 0;
-
- if (!sym_reading && !noisy && complaint_series > 1) {
- /* Terminate previous series, since caller won't. */
- puts_filtered ("\n");
- }
-
- complaint_series = sym_reading? 1 + noisy: 0;
-}
enum language
deduce_language_from_filename (filename)
@@ -1052,8 +959,10 @@ deduce_language_from_filename (filename)
return language_c;
else if(!strcmp(c,".cc") || !strcmp(c,".C"))
return language_cplus;
+ /* start-sanitize-chill */
else if(!strcmp(c,".chill") || !strcmp(c,".c186") || !strcmp(c,".c286"))
return language_chill;
+ /* end-sanitize-chill */
return language_unknown; /* default */
}
@@ -1419,13 +1328,6 @@ The second argument provides the starting address of the file's text.");
for access from GDB.");
add_show_from_set
- (add_set_cmd ("complaints", class_support, var_zinteger,
- (char *)&stop_whining,
- "Set max number of complaints about incorrect symbols.",
- &setlist),
- &showlist);
-
- add_show_from_set
(add_set_cmd ("symbol-reloading", class_support, var_boolean,
(char *)&symbol_reloading,
"Set dynamic symbol table reloading multiple times in one run.",
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 1d9b7dd..3f232ec 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -60,20 +60,31 @@ struct sym_fns {
/* sym_read (objfile, addr, mainline)
Reads a symbol file into a psymtab (or possibly a symtab).
- OBJFILE is the objfile struct for the file we are reading. ADDR
- is the offset between the file's specified start address and
- its true address in memory. MAINLINE is 1 if this is the
+ OBJFILE is the objfile struct for the file we are reading.
+ SECTION_OFFSETS
+ are the offset between the file's specified section addresses and
+ their true addresses in memory.
+ MAINLINE is 1 if this is the
main symbol table being read, and 0 if a secondary
symbol file (e.g. shared library or dynamically loaded file)
is being read. */
- void (*sym_read) PARAMS ((struct objfile *, CORE_ADDR, int));
+ void (*sym_read) PARAMS ((struct objfile *, struct section_offsets *, int));
/* Called when we are finished with an objfile. Should do all cleanup
that is specific to the object file format for the particular objfile. */
void (*sym_finish) PARAMS ((struct objfile *));
+ /* This function produces a file-dependent section_offsets structure,
+ allocated in the objfile's storage, and based on the parameter.
+ The parameter is currently a CORE_ADDR (FIXME!) for backward compatibility
+ with the higher levels of GDB. It should probably be changed to
+ a string, where NULL means the default, and others are parsed in a file
+ dependent way. The result of this function is handed in to sym_read. */
+
+ struct section_offsets *(*sym_offsets) PARAMS ((struct objfile *, CORE_ADDR));
+
/* Finds the next struct sym_fns. They are allocated and initialized
in whatever module implements the functions pointed to; an
initializer calls add_symtab_fns to add them to the global chain. */
@@ -82,124 +93,6 @@ struct sym_fns {
};
-/* Master structure for keeping track of each input file from which
- gdb reads symbols. One of these is allocated for each such file we
- access, e.g. the exec_file, symbol_file, and any shared library object
- files. */
-
-struct objfile
-{
-
- /* All struct objfile's are chained together by their next pointers.
- The global variable "object_files" points to the first link in this
- chain. */
-
- struct objfile *next;
-
- /* The object file's name. Malloc'd; free it if you free this struct. */
-
- char *name;
-
- /* Some flag bits for this objfile. */
-
- unsigned short flags;
-
- /* Each objfile points to a linked list of symtabs derived from this file,
- one symtab structure for each compilation unit (source file). Each link
- in the symtab list contains a backpointer to this objfile. */
-
- struct symtab *symtabs;
-
- /* Each objfile points to a linked list of partial symtabs derived from
- this file, one partial symtab structure for each compilation unit
- (source file). */
-
- struct partial_symtab *psymtabs;
-
- /* List of freed partial symtabs, available for re-use */
-
- struct partial_symtab *free_psymtabs;
-
- /* The object file's BFD. Can be null, in which case bfd_open (name) and
- put the result here. */
-
- bfd *obfd;
-
- /* The modification timestamp of the object file, as of the last time
- we read its symbols. */
-
- long mtime;
-
- /* Obstacks to hold objects that should be freed when we load a new symbol
- table from this object file. */
-
- struct obstack psymbol_obstack; /* Partial symbols */
- struct obstack symbol_obstack; /* Full symbols */
- struct obstack type_obstack; /* Types */
-
- /* Vectors of all partial symbols read in from file. The actual data
- is stored in the psymbol_obstack. */
-
- struct psymbol_allocation_list global_psymbols;
- struct psymbol_allocation_list static_psymbols;
-
- /* Each file contains a pointer to an array of minimal symbols for all
- global symbols that are defined within the file. The array is terminated
- by a "null symbol", one that has a NULL pointer for the name and a zero
- value for the address. This makes it easy to walk through the array
- when passed a pointer to somewhere in the middle of it. There is also
- a count of the number of symbols, which does include the terminating
- null symbol. The array itself, as well as all the data that it points
- to, should be allocated on the symbol_obstack for this file. */
-
- struct minimal_symbol *msymbols;
- int minimal_symbol_count;
-
- /* For object file formats which don't specify fundamental types, gdb
- can create such types. For now, it maintains a vector of pointers
- to these internally created fundamental types on a per objfile basis,
- however it really should ultimately keep them on a per-compilation-unit
- basis, to account for linkage-units that consist of a number of
- compilation units that may have different fundamental types, such as
- linking C modules with ADA modules, or linking C modules that are
- compiled with 32-bit ints with C modules that are compiled with 64-bit
- ints (not inherently evil with a smarter linker). */
-
- struct type **fundamental_types;
-
- /* The mmalloc() malloc-descriptor for this objfile if we are using
- the memory mapped malloc() package to manage storage for this objfile's
- data. NULL if we are not. */
-
- PTR md;
-
- /* Structure which keeps track of functions that manipulate objfile's
- of the same type as this objfile. I.E. the function to read partial
- symbols for example. Note that this structure is in statically
- allocated memory, and is shared by all objfiles that use the
- object module reader of this type. */
-
- struct sym_fns *sf;
-
- /* Hook for information which is shared by sym_init and sym_read for
- this objfile. It is typically a pointer to malloc'd memory. */
-
- PTR sym_private;
-
-};
-
-/* Defines for the objfile flag word. */
-
-/* Gdb can arrange to allocate storage for all objects related to a
- particular objfile in a designated section of it's address space,
- managed at a low level by mmap() and using a special version of
- malloc that handles malloc/free/realloc on top of the mmap() interface.
- This allows the "internal gdb state" for a particular objfile to be
- dumped to a gdb state file and subsequently reloaded at a later time. */
-
-#define OBJF_MAPPED (1 << 0) /* Objfile data is mmap'd */
-
-
extern void
extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
struct objfile *));
@@ -254,15 +147,6 @@ sort_pst_symbols PARAMS ((struct partial_symtab *));
extern struct symtab *
allocate_symtab PARAMS ((char *, struct objfile *));
-extern struct objfile *
-allocate_objfile PARAMS ((bfd *, int));
-
-extern void
-free_objfile PARAMS ((struct objfile *));
-
-extern void
-free_all_objfiles PARAMS ((void));
-
extern int
free_named_symtabs PARAMS ((char *));
@@ -273,10 +157,17 @@ extern void
add_symtab_fns PARAMS ((struct sym_fns *));
extern void
+init_entry_point_info PARAMS ((struct objfile *));
+
+extern void
syms_from_objfile PARAMS ((struct objfile *, CORE_ADDR, int, int));
+extern void
+new_symfile_objfile PARAMS ((struct objfile *, int, int));
+
extern struct partial_symtab *
-start_psymtab_common PARAMS ((struct objfile *, CORE_ADDR, char *, CORE_ADDR,
+start_psymtab_common PARAMS ((struct objfile *, struct section_offsets *,
+ char *, CORE_ADDR,
struct partial_symbol *,
struct partial_symbol *));
@@ -307,90 +198,29 @@ obconcat PARAMS ((struct obstack *obstackp, const char *, const char *,
/* Variables */
-/* The object file that the main symbol table was loaded from (e.g. the
- argument to the "symbol-file" or "file" command). */
-
-extern struct objfile *symfile_objfile;
-
-/* Where execution starts in symfile */
-
-extern CORE_ADDR entry_point;
-
-/* Root of object file struct chain. */
-
-extern struct objfile *object_files;
-
-/* Traverse all object files. ALL_OBJFILES_SAFE works even if you delete
- the objfile during the traversal. */
-
-#define ALL_OBJFILES(obj) \
- for (obj = object_files; 0 != obj; obj = obj->next)
-
-#define ALL_OBJFILES_SAFE(obj,nxt) \
- for (obj = object_files; obj? (nxt=obj->next, 1): 0; obj = nxt)
-
-/* Support for complaining about things in the symbol file that aren't
- catastrophic.
-
- Each such thing gets a counter. The first time we have the problem,
- during a symbol read, we report it. At the end of symbol reading,
- if verbose, we report how many of each problem we had. */
-
-struct complaint {
- char *message;
- unsigned counter;
- struct complaint *next;
-};
-
-/* Root of the chain of complaints that have at some point been issued.
- This is used to reset the counters, and/or report the total counts. */
-
-extern struct complaint complaint_root[1];
-
-/* Functions that handle complaints. (in symfile.c) */
-
-extern void
-complain PARAMS ((struct complaint *, char *));
-
-extern void
-clear_complaints PARAMS ((int sym_reading, int noisy));
-
/* From symfile.c */
extern struct partial_symtab *
allocate_psymtab PARAMS ((char *, struct objfile *));
-/* From minsyms.c */
-
-extern PTR
-iterate_over_msymbols PARAMS ((PTR (*func) (struct objfile *,
- struct minimal_symbol *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
-
-/* From objfiles.c */
+/* From dwarfread.c */
-extern PTR
-iterate_over_objfiles PARAMS ((PTR (*func) (struct objfile *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
+extern void
+dwarf_build_psymtabs PARAMS ((struct objfile *, struct section_offsets *, int,
+ file_ptr, unsigned int, file_ptr, unsigned int));
-extern PTR
-iterate_over_symtabs PARAMS ((PTR (*func) (struct objfile *, struct symtab *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
+/* From dbxread.c */
-extern PTR
-iterate_over_psymtabs PARAMS ((PTR (*func) (struct objfile *,
- struct partial_symtab *,
- PTR arg1, PTR arg2, PTR arg3),
- PTR arg1, PTR arg2, PTR arg3));
+extern void
+elfstab_build_psymtabs PARAMS ((struct objfile *objfile,
+ struct section_offsets *section_offsets,
+ int mainline,
+ file_ptr staboff, unsigned int stabsize,
+ file_ptr stabstroffset, unsigned int stabstrsize));
-/* From dwarfread.c */
+/* From demangle.c */
extern void
-dwarf_build_psymtabs PARAMS ((int, char *, CORE_ADDR, int, unsigned int,
- unsigned int, unsigned int, unsigned int,
- struct objfile *));
+set_demangling_style PARAMS ((char *));
#endif /* !defined(SYMFILE_H) */
diff --git a/gdb/utils.c b/gdb/utils.c
index 6ad2664..b087b52 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -808,11 +808,13 @@ parse_escape (string_ptr)
}
}
-/* Print the character C on STREAM as part of the contents
- of a literal string whose delimiter is QUOTER. */
+/* Print the character C on STREAM as part of the contents of a literal
+ string whose delimiter is QUOTER. Note that this routine should only
+ be call for printing things which are independent of the language
+ of the program being debugged. */
void
-printchar (c, stream, quoter)
+gdb_printchar (c, stream, quoter)
register int c;
FILE *stream;
int quoter;
@@ -980,6 +982,20 @@ wrap_here(indent)
}
}
+/* Ensure that whatever gets printed next, using the filtered output
+ commands, starts at the beginning of the line. I.E. if there is
+ any pending output for the current line, flush it and start a new
+ line. Otherwise do nothing. */
+
+void
+begin_line ()
+{
+ if (chars_printed > 0)
+ {
+ puts_filtered ("\n");
+ }
+}
+
/* Like fputs but pause after every screenful, and can wrap at points
other than the final character of a line.
Unlike fputs, fputs_filtered does not return a value.
@@ -1211,6 +1227,14 @@ vfprintf_filtered (stream, format, args)
fputs_filtered (linebuffer, stream);
}
+void
+vprintf_filtered (format, args)
+ char *format;
+ va_list args;
+{
+ vfprintf_filtered (stdout, format, args);
+}
+
/* VARARGS */
void
fprintf_filtered (va_alist)
@@ -1290,7 +1314,10 @@ printfi_filtered (va_alist)
va_end (args);
}
-/* Easy */
+/* Easy -- but watch out!
+
+ This routine is *not* a replacement for puts()! puts() appends a newline.
+ This one doesn't, and had better not! */
void
puts_filtered (string)
@@ -1378,7 +1405,7 @@ fprint_symbol (stream, name)
when searching for matching C++ function names (such as if the
user types 'break FOO', where FOO is a mangled C++ function). */
-static int
+int
strcmp_iw (string1, string2)
const char *string1;
const char *string2;