aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/a68v-xdep.c1
-rw-r--r--gdb/altos-xdep.c1
-rw-r--r--gdb/am29k-pinsn.c2
-rw-r--r--gdb/am29k-tdep.c1
-rw-r--r--gdb/arm-pinsn.c3
-rw-r--r--gdb/arm-xdep.c1
-rw-r--r--gdb/buildsym.c1
-rw-r--r--gdb/command.c1
-rw-r--r--gdb/convex-pinsn.c2
-rw-r--r--gdb/convex-tdep.c1
-rw-r--r--gdb/convex-xdep.c1
-rw-r--r--gdb/core.c3
-rw-r--r--gdb/coredep.c3
-rw-r--r--gdb/cplus-dem.c5
-rw-r--r--gdb/defs.h435
-rw-r--r--gdb/dwarfread.c3
-rwxr-xr-xgdb/ecoff.c1
-rw-r--r--gdb/elfread.c2
-rw-r--r--gdb/gdbtypes.c1
-rw-r--r--gdb/gould-pinsn.c1
-rw-r--r--gdb/gould-xdep.c1
-rw-r--r--gdb/h8300-tdep.c1
-rw-r--r--gdb/hp300ux-xdep.c1
-rw-r--r--gdb/i386-pinsn.c4
-rw-r--r--gdb/i386-tdep.c199
-rw-r--r--gdb/i386-xdep.c1
-rw-r--r--gdb/i387-tdep.c1
-rw-r--r--gdb/i860-pinsn.c2
-rw-r--r--gdb/i860-tdep.c3
-rw-r--r--gdb/i960-pinsn.c1
-rw-r--r--gdb/i960-tdep.c3
-rw-r--r--gdb/ieee-float.c2
-rw-r--r--gdb/infrun.c260
-rw-r--r--gdb/infrun.hacked.c3
-rw-r--r--gdb/language.c3
-rw-r--r--gdb/m68k-pinsn.c2
-rw-r--r--gdb/m88k-pinsn.c3
-rw-r--r--gdb/m88k-tdep.c1
-rw-r--r--gdb/m88k-xdep.c1
-rw-r--r--gdb/mach386-xdep.c1
-rw-r--r--gdb/minsyms.c1
-rw-r--r--gdb/mips-pinsn.c2
-rw-r--r--gdb/mips-tdep.c50
-rw-r--r--gdb/mips-xdep.c3
-rw-r--r--gdb/mipsread.c367
-rwxr-xr-xgdb/mmap-alloc.c1
-rwxr-xr-xgdb/mmap-sbrk.c1
-rw-r--r--gdb/nindy-tdep.c1
-rw-r--r--gdb/ns32k-pinsn.c2
-rw-r--r--gdb/objfiles.c1
-rw-r--r--gdb/os68k-xdep.c1
-rw-r--r--gdb/parse.c1
-rw-r--r--gdb/procfs.c3
-rw-r--r--gdb/pyr-pinsn.c2
-rw-r--r--gdb/pyr-xdep.c1
-rw-r--r--gdb/remote-adapt.c3
-rw-r--r--gdb/remote-eb.c4
-rw-r--r--gdb/remote-hms.c1
-rw-r--r--gdb/remote-mm.c1
-rw-r--r--gdb/remote-nindy.c3
-rw-r--r--gdb/remote-sa.sparc.c3
-rw-r--r--gdb/remote-vx.68.c1
-rw-r--r--gdb/remote-vx.c1
-rw-r--r--gdb/remote.c5
-rw-r--r--gdb/rs6000-pinsn.c1
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/rs6000-xdep.c1
-rwxr-xr-xgdb/signame.c3
-rw-r--r--gdb/sparc-pinsn.c2
-rw-r--r--gdb/sparc-xdep.c2
-rw-r--r--gdb/state.c1
-rw-r--r--gdb/sun3-xdep.c1
-rw-r--r--gdb/sun386-xdep.c1
-rw-r--r--gdb/symm-tdep.c1
-rw-r--r--gdb/symm-xdep.c1
-rw-r--r--gdb/tahoe-pinsn.c1
-rw-r--r--gdb/ultra3-xdep.c1
-rw-r--r--gdb/umax-xdep.c1
-rw-r--r--gdb/utils.c11
-rw-r--r--gdb/values.c3
-rw-r--r--gdb/vax-pinsn.c2
-rw-r--r--gdb/xcoffexec.c4
-rw-r--r--gdb/xcoffread.c1
84 files changed, 990 insertions, 476 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f4802ff..050dbeb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+Tue Mar 3 15:11:52 1992 Michael Tiemann (tiemann@cygnus.com)
+
+ * All GDB files that #include defs.h: Removed stdio.h.
+ (defs.h): #include stdio.h.
+
Mon Mar 2 23:00:12 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* gdbtypes.c (lookup_pointer_type): initialize the TYPE_LENGTH of
diff --git a/gdb/a68v-xdep.c b/gdb/a68v-xdep.c
index e9cf597..036ef7b 100644
--- a/gdb/a68v-xdep.c
+++ b/gdb/a68v-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index fafcb18..243f35e 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/am29k-pinsn.c b/gdb/am29k-pinsn.c
index d0e18fc..c226a3a 100644
--- a/gdb/am29k-pinsn.c
+++ b/gdb/am29k-pinsn.c
@@ -18,8 +18,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "target.h"
#include "am29k-opcode.h"
diff --git a/gdb/am29k-tdep.c b/gdb/am29k-tdep.c
index 5c08a9b..1600bb4 100644
--- a/gdb/am29k-tdep.c
+++ b/gdb/am29k-tdep.c
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "gdbcore.h"
-#include <stdio.h>
#include "frame.h"
#include "value.h"
#include "symtab.h"
diff --git a/gdb/arm-pinsn.c b/gdb/arm-pinsn.c
index 53a3019..240f7cb 100644
--- a/gdb/arm-pinsn.c
+++ b/gdb/arm-pinsn.c
@@ -17,11 +17,10 @@ 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 <stdio.h>
+#include "defs.h"
#include <ctype.h>
#include <assert.h>
-#include "defs.h"
#include "symtab.h"
#include "opcode/arm.h"
diff --git a/gdb/arm-xdep.c b/gdb/arm-xdep.c
index 4c477fb..149b30fd 100644
--- a/gdb/arm-xdep.c
+++ b/gdb/arm-xdep.c
@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "inferior.h"
#include "arm-opcode.h"
-#include <stdio.h>
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 3a33a43..d5deff1 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -24,7 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
They originated in dbxread.c of gdb-4.2, and were split out to
make xcoffread.c more maintainable by sharing code. */
-#include <stdio.h>
#include "defs.h"
#include "obstack.h"
#include "symtab.h"
diff --git a/gdb/command.c b/gdb/command.c
index 696547f..4eed2a0 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -15,7 +15,6 @@ 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 <stdio.h>
#include "defs.h"
#include "gdbcmd.h"
#include "symtab.h"
diff --git a/gdb/convex-pinsn.c b/gdb/convex-pinsn.c
index 9a792ac..0c95e36 100644
--- a/gdb/convex-pinsn.c
+++ b/gdb/convex-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c
index 8c86ae8..774bbcb 100644
--- a/gdb/convex-tdep.c
+++ b/gdb/convex-tdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "command.h"
#include "symtab.h"
diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c
index 60b090c..c078d9e 100644
--- a/gdb/convex-xdep.c
+++ b/gdb/convex-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "command.h"
#include "symtab.h"
diff --git a/gdb/core.c b/gdb/core.c
index deeb523..72fb5fe 100644
--- a/gdb/core.c
+++ b/gdb/core.c
@@ -17,11 +17,10 @@ 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 <stdio.h>
+#include "defs.h"
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
-#include "defs.h"
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/coredep.c b/gdb/coredep.c
index 62644c6..52b4f77 100644
--- a/gdb/coredep.c
+++ b/gdb/coredep.c
@@ -20,10 +20,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* core.c is supposed to be the more machine-independent aspects of this;
this file is more machine-specific. */
-#include <stdio.h>
+#include "defs.h"
#include <sys/types.h>
#include <sys/param.h>
-#include "defs.h"
#include "gdbcore.h"
/* These are needed on various systems to expand REGISTER_U_ADDR. */
diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c
index 1bc5a35..ed40e37 100644
--- a/gdb/cplus-dem.c
+++ b/gdb/cplus-dem.c
@@ -49,12 +49,11 @@
/* define this if names don't start with _ */
/* #define nounderscore 1 */
-#include <stdio.h>
-#include <ctype.h>
-
/* GDB-specific, FIXME. */
#include "defs.h"
+#include <ctype.h>
+
#ifdef USG
#include <memory.h>
#include <string.h>
diff --git a/gdb/defs.h b/gdb/defs.h
index 45e0816..f96258b 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -18,7 +18,25 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (DEFS_H)
-#define DEFS_H
+#define DEFS_H 1
+
+#include <stdio.h>
+
+/* First include ansidecl.h so we can use the various macro definitions
+ in all subsequent file inclusions. FIXME: This inclusion can now
+ be removed from all files that include defs.h */
+
+#include "ansidecl.h"
+
+/* We could use the EXFUN macro in ansidecl.h to handle prototypes, but
+ the name is misleading the the result is ugly. So just define a simple
+ macro to handle the parameter lists. */
+
+#ifdef __STDC__
+#define PARAMS(paramlist) paramlist
+#else
+#define PARAMS(paramlist) ()
+#endif
/* An address in the program being debugged. Host byte order. */
typedef unsigned int CORE_ADDR;
@@ -34,7 +52,9 @@ extern int errno; /* System call error return status */
extern int quit_flag;
extern int immediate_quit;
-extern void quit ();
+
+extern void
+quit PARAMS ((void));
#define QUIT { if (quit_flag) quit (); }
@@ -64,51 +84,215 @@ enum command_class
struct cleanup
{
struct cleanup *next;
- void (*function) ();
- int arg;
+ void (*function) PARAMS ((PTR));
+ PTR arg;
};
-/* From utils.c. */
-extern void do_cleanups ();
-extern void discard_cleanups ();
-extern struct cleanup *make_cleanup ();
-extern struct cleanup *save_cleanups ();
-extern void restore_cleanups ();
-extern void free_current_contents ();
-extern int myread ();
-extern int query ();
-extern void wrap_here (
-#ifdef __STDC__
- char *
-#endif
- );
-extern void reinitialize_more_filter ();
-extern void fputs_filtered ();
-extern void puts_filtered ();
-extern void fprintf_filtered ();
-extern void printf_filtered ();
-extern void print_spaces ();
-extern void print_spaces_filtered ();
-extern char *n_spaces ();
-extern void printchar ();
-extern void fprint_symbol ();
-extern void fputs_demangled ();
-extern void perror_with_name ();
-extern void print_sys_errmsg ();
+/* From blockframe.c */
+
+extern int
+inside_entry_scope PARAMS ((CORE_ADDR));
+
+extern int
+outside_startup_file PARAMS ((CORE_ADDR addr));
+
+extern int
+inside_main_scope PARAMS ((CORE_ADDR pc));
+
+/* From cplus-dem.c */
+
+extern char *
+cplus_demangle PARAMS ((const char *, int));
+
+extern char *
+cplus_mangle_opname PARAMS ((char *, int));
+
+/* From mmap-*.c */
+
+extern PTR
+mmap_malloc PARAMS ((long));
+
+extern PTR
+mmap_realloc PARAMS ((PTR, long));
+
+extern PTR
+mmap_xmalloc PARAMS ((long));
+
+extern PTR
+mmap_xrealloc PARAMS ((PTR, long));
+
+extern void
+mmap_free PARAMS ((PTR));
+
+extern PTR
+mmap_sbrk PARAMS ((int));
+
+extern PTR
+mmap_base PARAMS ((void));
+
+extern PTR
+mmap_page_align PARAMS ((PTR));
+
+extern PTR
+mmap_remap PARAMS ((PTR, long, int, long));
+
+/* From utils.c */
+
+extern void
+init_malloc PARAMS ((void));
+
+extern void
+request_quit PARAMS ((int));
+
+extern void
+do_cleanups PARAMS ((struct cleanup *));
+
+extern void
+discard_cleanups PARAMS ((struct cleanup *));
+
+/* The bare make_cleanup function is one of those rare beasts that
+ takes almost any type of function as the first arg and anything that
+ will fit in a "void *" as the second arg.
+
+ Should be, once all calls and called-functions are cleaned up:
+extern struct cleanup *
+make_cleanup PARAMS ((void (*function) (PTR), PTR));
+
+ Until then, lint and/or various type-checking compiler options will
+ complain about make_cleanup calls. It'd be wrong to just cast things,
+ since the type actually passed when the function is called would be
+ wrong. */
+
+extern struct cleanup *
+make_cleanup ();
+
+extern struct cleanup *
+save_cleanups PARAMS ((void));
+
+extern void
+restore_cleanups PARAMS ((struct cleanup *));
+
+extern void
+free_current_contents PARAMS ((char **));
+
+extern void
+null_cleanup PARAMS ((char **));
+
+extern int
+myread PARAMS ((int, char *, int));
+
+extern int
+query ();
+
+extern void
+wrap_here PARAMS ((char *));
+
+extern void
+reinitialize_more_filter PARAMS ((void));
+
+extern int
+print_insn PARAMS ((CORE_ADDR, FILE *));
+
+extern void
+fputs_filtered PARAMS ((const char *, FILE *));
+
+extern void
+puts_filtered PARAMS ((char *));
+
+extern void
+fprintf_filtered ();
+
+extern void
+printf_filtered ();
+
+extern void
+print_spaces PARAMS ((int, FILE *));
+
+extern void
+print_spaces_filtered PARAMS ((int, FILE *));
+
+extern char *
+n_spaces PARAMS ((int));
+
+extern void
+printchar PARAMS ((int, FILE *, int));
+
+extern void
+fprint_symbol PARAMS ((FILE *, char *));
+
+extern void
+fputs_demangled PARAMS ((char *, FILE *, int));
+
+extern void
+perror_with_name PARAMS ((char *));
+
+extern void
+print_sys_errmsg PARAMS ((char *, int));
+
+/* From regex.c */
+
+extern char *
+re_comp PARAMS ((char *));
+
+/* From symfile.c */
+
+extern void
+symbol_file_command PARAMS ((char *, int));
+
+/* From main.c */
+
+extern char *
+gdb_readline PARAMS ((char *));
+
+extern char *
+command_line_input PARAMS ((char *, int));
+
+extern void
+print_prompt PARAMS ((void));
+
+extern int
+batch_mode PARAMS ((void));
+
+extern int
+input_from_terminal_p PARAMS ((void));
+
+extern int
+catch_errors PARAMS ((int (*) (char *), char *, char *));
/* From printcmd.c */
-extern void print_address_symbolic ();
-extern void print_address ();
+
+extern void
+set_next_address PARAMS ((CORE_ADDR));
+
+extern void
+print_address_symbolic PARAMS ((CORE_ADDR, FILE *, int, char *));
+
+extern void
+print_address PARAMS ((CORE_ADDR, FILE *));
/* From source.c */
-void mod_path (
-#ifdef __STDC__
- char *, char **
-#endif
- );
+
+extern int
+openp PARAMS ((char *, int, char *, int, int, char **));
+
+extern void
+mod_path PARAMS ((char *, char **));
+
+extern void
+directory_command PARAMS ((char *, int));
+
+extern void
+init_source_path PARAMS ((void));
+
+/* From findvar.c */
+
+extern int
+read_relative_register_raw_bytes PARAMS ((int, char *));
/* From readline (but not in any readline .h files). */
-extern char *tilde_expand ();
+
+extern char *
+tilde_expand PARAMS ((char *));
/* Structure for saved commands lines
(for breakpoints, defined commands, etc). */
@@ -119,19 +303,22 @@ struct command_line
char *line;
};
-extern struct command_line *read_command_lines ();
-extern void free_command_lines ();
+extern struct command_line *
+read_command_lines PARAMS ((void));
+
+extern void
+free_command_lines PARAMS ((struct command_line **));
/* String containing the current directory (what getwd would return). */
-char *current_directory;
+extern char *current_directory;
/* Default radixes for input and output. Only some values supported. */
extern unsigned input_radix;
extern unsigned output_radix;
/* Baud rate specified for communication with serial target systems. */
-char *baud_rate;
+extern char *baud_rate;
/* Languages represented in the symbol table and elsewhere. */
@@ -150,15 +337,21 @@ enum language
options like "08" or "l" (to produce e.g. %08x or %lx). */
#define local_hex_format() (current_language->la_hex_format)
-char *local_hex_format_custom(); /* language.c */
+
+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". */
-char *local_hex_string (); /* language.c */
-char *local_hex_string_custom (); /* language.c */
+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. */
@@ -192,6 +385,15 @@ char *local_hex_string_custom (); /* language.c */
#endif /* STDC */
#endif /* volatile */
+/* Some compilers (many AT&T SVR4 compilers for instance), do not accept
+ declarations of functions that never return (exit for instance) as
+ "volatile void". For such compilers "NORETURN" can be defined away
+ to keep them happy */
+
+#ifndef NORETURN
+# define NORETURN volatile
+#endif
+
/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
#if !defined (UINT_MAX)
@@ -262,6 +464,11 @@ char *local_hex_string_custom (); /* language.c */
#define TARGET_DOUBLE_COMPLEX_BIT (2 * TARGET_DOUBLE_BIT)
#endif
+/* Number of bits in a pointer for the target machine */
+#if !defined (TARGET_PTR_BIT)
+#define TARGET_PTR_BIT TARGET_INT_BIT
+#endif
+
/* Convert a LONGEST to an int. This is used in contexts (e.g. number
of arguments to a function, number in a value history, register
number, etc.) where the value must not be larger than can fit
@@ -276,22 +483,119 @@ char *local_hex_string_custom (); /* language.c */
#endif /* No LONG_LONG. */
#endif /* No longest_to_int. */
+/* This should not be a typedef, because "unsigned LONGEST" needs
+ to work. LONG_LONG is defined if the host has "long long". */
+
+#ifndef LONGEST
+# ifdef LONG_LONG
+# define LONGEST long long
+# else
+# define LONGEST long
+# endif
+#endif
+
/* Assorted functions we can declare, now that const and volatile are
defined. */
-extern char *savestring ();
-extern char *strsave ();
-extern char *concat ();
+
+extern char *
+savestring PARAMS ((const char *, int));
+
+extern char *
+strsave PARAMS ((const char *));
+
+extern char *
+concat PARAMS ((char *, ...));
+
+extern PTR
+xmalloc PARAMS ((long));
+
+extern PTR
+xrealloc PARAMS ((char *, long));
+
+extern int
+parse_escape PARAMS ((char **));
+
+extern char *reg_names[];
+
+extern NORETURN void /* Does not return to the caller. */
+error ();
+
+extern NORETURN void /* Does not return to the caller. */
+fatal ();
+
+extern NORETURN void /* Not specified as volatile in ... */
+exit PARAMS ((int)); /* 4.10.4.3 */
+
+extern NORETURN void /* Does not return to the caller. */
+return_to_top_level PARAMS ((void));
+
+extern void
+warning_setup PARAMS ((void));
+
+extern void
+warning ();
+
+/* Global functions from other, non-gdb GNU thingies (libiberty for
+ instance) */
+
+extern char *
+basename PARAMS ((char *));
+
+extern char *
+getenv PARAMS ((CONST char *));
+
+extern char **
+buildargv PARAMS ((char *));
+
+extern void
+freeargv PARAMS ((char **));
+
+/* For now, we can't include <stdlib.h> because it conflicts with
+ "../include/getopt.h". (FIXME)
+
+ However, since any prototypes for any functions defined in the ANSI
+ specific, defined in any header files in an ANSI conforming environment,
+ must match those in the ANSI standard, we can just duplicate them here
+ since they must be the same in all conforming ANSI environments. If
+ these cause problems, then the environment is not ANSI conformant. */
+
#ifdef __STDC__
-extern void *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
+#include <stddef.h>
#endif
-extern void free ();
-extern int parse_escape ();
-extern char *reg_names[];
-/* Indicate that these routines do not return to the caller. */
-extern volatile void error(), fatal();
-extern void warning_setup(), warning();
+
+extern int
+fclose PARAMS ((FILE *stream)); /* 4.9.5.1 */
+
+extern double
+atof PARAMS ((const char *nptr)); /* 4.10.1.1 */
+
+#ifndef MALLOC_INCOMPATIBLE
+extern PTR
+malloc PARAMS ((size_t size)); /* 4.10.3.3 */
+
+extern PTR
+realloc PARAMS ((void *ptr, size_t size)); /* 4.10.3.4 */
+
+extern void
+free PARAMS ((void *)); /* 4.10.3.2 */
+#endif
+
+extern void
+qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */
+ size_t size,
+ int (*comp)(const void *, const void *)));
+
+extern char *
+strchr PARAMS ((const char *, int)); /* 4.11.5.2 */
+
+extern char *
+strrchr PARAMS ((const char *, int)); /* 4.11.5.5 */
+
+extern char *
+strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */
+
+extern char *
+strerror PARAMS ((int)); /* 4.11.6.2 */
/* Various possibilities for alloca. */
#ifndef alloca
@@ -375,4 +679,17 @@ extern void warning_setup(), warning();
#define SYS_SIGLIST_MISSING defined (USG)
#endif /* No SYS_SIGLIST_MISSING */
-#endif /* no DEFS_H */
+/* From valops.c */
+
+extern CORE_ADDR
+push_bytes PARAMS ((CORE_ADDR, char *, int));
+
+/* In some modules, we don't have a definition of REGISTER_TYPE yet, so we
+ must avoid prototyping this function for now. FIXME. Should be:
+extern CORE_ADDR
+push_word PARAMS ((CORE_ADDR, REGISTER_TYPE));
+ */
+extern CORE_ADDR
+push_word ();
+
+#endif /* !defined (DEFS_H) */
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 0f0a8bd..20c9dab 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -54,11 +54,10 @@ other things to work on, if you get bored. :-)
*/
-#include <stdio.h>
+#include "defs.h"
#include <varargs.h>
#include <fcntl.h>
-#include "defs.h"
#include "bfd.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/ecoff.c b/gdb/ecoff.c
index 4397c9c..519763d 100755
--- a/gdb/ecoff.c
+++ b/gdb/ecoff.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "bfd.h"
#define LANGUAGE_C /* Wierd MIPS crap */
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 8b72f80..6a89778 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -32,8 +32,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
* *
************************************************************************/
-#include <stdio.h>
-
#include "defs.h"
#include "elf/common.h"
#include "elf/external.h"
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index a2bf943..aaf7d27 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#include <string.h>
#include "bfd.h"
diff --git a/gdb/gould-pinsn.c b/gdb/gould-pinsn.c
index f206a1e..876b875 100644
--- a/gdb/gould-pinsn.c
+++ b/gdb/gould-pinsn.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "frame.h"
diff --git a/gdb/gould-xdep.c b/gdb/gould-xdep.c
index fe69c79..5a320ba 100644
--- a/gdb/gould-xdep.c
+++ b/gdb/gould-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 0ef703d..eb2f03f 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
sac@cygnus.com
*/
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "obstack.h"
diff --git a/gdb/hp300ux-xdep.c b/gdb/hp300ux-xdep.c
index a7f8f72..6c30766 100644
--- a/gdb/hp300ux-xdep.c
+++ b/gdb/hp300ux-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/i386-pinsn.c b/gdb/i386-pinsn.c
index eb0e174..89261aa 100644
--- a/gdb/i386-pinsn.c
+++ b/gdb/i386-pinsn.c
@@ -31,11 +31,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
* the Intel manual for details.
*/
-#include <stdio.h>
+#include "defs.h"
+
#include <ctype.h>
/* For the GDB interface at the bottom of the file... */
-#include "defs.h"
#include "gdbcore.h"
#define Eb OP_E, b_mode
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 8b8fb84..ab56e62 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -17,18 +17,53 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "gdbcore.h"
+#ifdef USE_PROC_FS /* Target dependent support for /proc */
+#include <sys/procfs.h>
+#endif
+
+static long
+i386_get_frame_setup PARAMS ((int));
+
+static void
+i386_follow_jump PARAMS ((void));
+
+static void
+codestream_read PARAMS ((unsigned char *, int));
+
+static void
+codestream_seek PARAMS ((int));
+
+static unsigned char
+codestream_fill PARAMS ((int));
+
/* helper functions for tm-i386.h */
-/* stdio style buffering to minimize calls to ptrace */
+/* Stdio style buffering was used to minimize calls to ptrace, but this
+ buffering did not take into account that the code section being accessed
+ may not be an even number of buffers long (even if the buffer is only
+ sizeof(int) long). In cases where the code section size happened to
+ be a non-integral number of buffers long, attempting to read the last
+ buffer would fail. Simply using target_read_memory and ignoring errors,
+ rather than read_memory, is not the correct solution, since legitimate
+ access errors would then be totally ignored. To properly handle this
+ situation and continue to use buffering would require that this code
+ be able to determine the minimum code section size granularity (not the
+ alignment of the section itself, since the actual failing case that
+ pointed out this problem had a section alignment of 4 but was not a
+ multiple of 4 bytes long), on a target by target basis, and then
+ adjust it's buffer size accordingly. This is messy, but potentially
+ feasible. It probably needs the bfd library's help and support. For
+ now, the buffer size is set to 1. (FIXME -fnf) */
+
+#define CODESTREAM_BUFSIZ 1 /* Was sizeof(int), see note above. */
static CORE_ADDR codestream_next_addr;
static CORE_ADDR codestream_addr;
-static unsigned char codestream_buf[sizeof (int)];
+static unsigned char codestream_buf[CODESTREAM_BUFSIZ];
static int codestream_off;
static int codestream_cnt;
@@ -40,14 +75,15 @@ static int codestream_cnt;
static unsigned char
codestream_fill (peek_flag)
+ int peek_flag;
{
codestream_addr = codestream_next_addr;
- codestream_next_addr += sizeof (int);
+ codestream_next_addr += CODESTREAM_BUFSIZ;
codestream_off = 0;
- codestream_cnt = sizeof (int);
+ codestream_cnt = CODESTREAM_BUFSIZ;
read_memory (codestream_addr,
(unsigned char *)codestream_buf,
- sizeof (int));
+ CODESTREAM_BUFSIZ);
if (peek_flag)
return (codestream_peek());
@@ -57,8 +93,10 @@ codestream_fill (peek_flag)
static void
codestream_seek (place)
+ int place;
{
- codestream_next_addr = place & -sizeof (int);
+ codestream_next_addr = place / CODESTREAM_BUFSIZ;
+ codestream_next_addr *= CODESTREAM_BUFSIZ;
codestream_cnt = 0;
codestream_fill (1);
while (codestream_tell() != place)
@@ -68,6 +106,7 @@ codestream_seek (place)
static void
codestream_read (buf, count)
unsigned char *buf;
+ int count;
{
unsigned char *p;
int i;
@@ -77,7 +116,8 @@ codestream_read (buf, count)
}
/* next instruction is a jump, move to target */
-static
+
+static void
i386_follow_jump ()
{
int long_delta;
@@ -128,8 +168,10 @@ i386_follow_jump ()
* if entry sequence doesn't make sense, return -1, and leave
* codestream pointer random
*/
+
static long
i386_get_frame_setup (pc)
+ int pc;
{
unsigned char op;
@@ -254,7 +296,7 @@ i386_get_frame_setup (pc)
int
i386_frame_num_args (fi)
- struct frame_info fi;
+ struct frame_info *fi;
{
int retpc;
unsigned char op;
@@ -269,7 +311,7 @@ i386_frame_num_args (fi)
nameless arguments. */
return -1;
- pfi = get_prev_frame_info ((fi));
+ pfi = get_prev_frame_info (fi);
if (pfi == 0)
{
/* Note: this can happen if we are looking at the frame for
@@ -340,6 +382,7 @@ i386_frame_num_args (fi)
* next instruction will be a branch back to the start.
*/
+void
i386_frame_find_saved_regs (fip, fsrp)
struct frame_info *fip;
struct frame_saved_regs *fsrp;
@@ -391,7 +434,10 @@ i386_frame_find_saved_regs (fip, fsrp)
}
/* return pc of first real instruction */
+
+int
i386_skip_prologue (pc)
+ int pc;
{
unsigned char op;
int i;
@@ -418,6 +464,7 @@ i386_skip_prologue (pc)
return (codestream_tell ());
}
+void
i386_push_dummy_frame ()
{
CORE_ADDR sp = read_register (SP_REGNUM);
@@ -435,6 +482,7 @@ i386_push_dummy_frame ()
write_register (SP_REGNUM, sp);
}
+void
i386_pop_frame ()
{
FRAME frame = get_current_frame ();
@@ -465,3 +513,134 @@ i386_pop_frame ()
set_current_frame ( create_new_frame (read_register (FP_REGNUM),
read_pc ()));
}
+
+#ifdef USE_PROC_FS /* Target dependent support for /proc */
+
+/* The /proc interface divides the target machine's register set up into
+ two different sets, the general register set (gregset) and the floating
+ point register set (fpregset). For each set, there is an ioctl to get
+ the current register set and another ioctl to set the current values.
+
+ The actual structure passed through the ioctl interface is, of course,
+ naturally machine dependent, and is different for each set of registers.
+ For the i386 for example, the general register set is typically defined
+ by:
+
+ typedef int gregset_t[19]; (in <sys/regset.h>)
+
+ #define GS 0 (in <sys/reg.h>)
+ #define FS 1
+ ...
+ #define UESP 17
+ #define SS 18
+
+ and the floating point set by:
+
+ typedef struct fpregset
+ {
+ union
+ {
+ struct fpchip_state // fp extension state //
+ {
+ int state[27]; // 287/387 saved state //
+ int status; // status word saved at exception //
+ } fpchip_state;
+ struct fp_emul_space // for emulators //
+ {
+ char fp_emul[246];
+ char fp_epad[2];
+ } fp_emul_space;
+ int f_fpregs[62]; // union of the above //
+ } fp_reg_set;
+ long f_wregs[33]; // saved weitek state //
+ } fpregset_t;
+
+ These routines provide the packing and unpacking of gregset_t and
+ fpregset_t formatted data.
+
+ */
+
+/* This is a duplicate of the table in i386-xdep.c. */
+
+static int regmap[] =
+{
+ EAX, ECX, EDX, EBX,
+ UESP, EBP, ESI, EDI,
+ EIP, EFL, CS, SS,
+ DS, ES, FS, GS,
+};
+
+
+/* Given a pointer to a general register set in /proc format (gregset_t *),
+ unpack the register contents and supply them as gdb's idea of the current
+ register values. */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ register int regno;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern int regmap[];
+
+ for (regno = 0 ; regno < NUM_REGS ; regno++)
+ {
+ supply_register (regno, (char *) (regp + regmap[regno]));
+ }
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ register greg_t *regp = (greg_t *) gregsetp;
+ extern char registers[];
+ extern int regmap[];
+
+ for (regi = 0 ; regi < NUM_REGS ; regi++)
+ {
+ if ((regno == -1) || (regno == regi))
+ {
+ *(regp + regmap[regno]) = *(int *) &registers[REGISTER_BYTE (regi)];
+ }
+ }
+}
+
+#if defined (FP0_REGNUM)
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), unpack the register contents and supply them as gdb's
+ idea of the current floating point register values. */
+
+void
+supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+{
+ register int regno;
+
+ /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+}
+
+/* Given a pointer to a floating point register set in /proc format
+ (fpregset_t *), update the register specified by REGNO from gdb's idea
+ of the current floating point register set. If REGNO is -1, update
+ them all. */
+
+void
+fill_fpregset (fpregsetp, regno)
+ fpregset_t *fpregsetp;
+ int regno;
+{
+ int regi;
+ char *to;
+ char *from;
+ extern char registers[];
+
+ /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+}
+
+#endif /* defined (FP0_REGNUM) */
+
+#endif /* USE_PROC_FS */
diff --git a/gdb/i386-xdep.c b/gdb/i386-xdep.c
index 44e9c8a..f0a412a 100644
--- a/gdb/i386-xdep.c
+++ b/gdb/i386-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index c968ade..b930aaa 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/i860-pinsn.c b/gdb/i860-pinsn.c
index aa3b9f8..fd03c56 100644
--- a/gdb/i860-pinsn.c
+++ b/gdb/i860-pinsn.c
@@ -20,8 +20,6 @@ In other words, go ahead and share GDB, but don't try to stop
anyone else from sharing it farther. Help stamp out software hoarding!
*/
-#include <stdio.h>
-
#include "defs.h"
#include "tm-i860.h"
#include "i860-opcode.h"
diff --git a/gdb/i860-tdep.c b/gdb/i860-tdep.c
index 759f871..4d631db 100644
--- a/gdb/i860-tdep.c
+++ b/gdb/i860-tdep.c
@@ -19,12 +19,11 @@
In other words, go ahead and share GDB, but don't try to stop
anyone else from sharing it farther. Help stamp out software hoarding!
*/
-#include <stdio.h>
+#include "defs.h"
#include <stdlib.h>
#include <stdarg.h>
-#include "defs.h"
#include "tm-i860.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/i960-pinsn.c b/gdb/i960-pinsn.c
index f13b201..dcf8e22 100644
--- a/gdb/i960-pinsn.c
+++ b/gdb/i960-pinsn.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index eda9d60..35c145d 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -22,9 +22,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Miscellaneous i80960-dependent routines.
Most are called from macros defined in "tm-i960.h". */
-#include <stdio.h>
-#include <signal.h>
#include "defs.h"
+#include <signal.h>
#include "symtab.h"
#include "value.h"
#include "frame.h"
diff --git a/gdb/ieee-float.c b/gdb/ieee-float.c
index 417186b..f170bd5 100644
--- a/gdb/ieee-float.c
+++ b/gdb/ieee-float.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "ieee-float.h"
#include <math.h> /* ldexp */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f8bc976..07083f0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -99,26 +99,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
don't worry about this; it will make calls look like simple
jumps (and the stack frames will be printed when the frame
pointer moves), which is a reasonably non-violent response.
-
-#if 0
- We skip this; it causes more problems than it's worth.
-#ifdef SUN4_COMPILER_FEATURE
- We do a special ifdef for the sun 4, forcing it to single step
- into calls which don't have prologues. This means that we can't
- nexti over leaf nodes, we can probably next over them (since they
- won't have debugging symbols, usually), and we can next out of
- functions returning structures (with a "call .stret4" at the end).
-#endif
-#endif
*/
-
-
-
-
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
@@ -199,6 +183,21 @@ extern struct target_ops child_ops; /* In inftarg.c */
#define GET_LONGJMP_TARGET(PC_ADDR) 0
#endif
+
+/* Some machines have trampoline code that sits between function callers
+ and the actual functions themselves. If this machine doesn't have
+ such things, disable their processing. */
+#ifndef SKIP_TRAMPOLINE_CODE
+#define SKIP_TRAMPOLINE_CODE(pc) 0
+#endif
+
+
+#ifdef TDESC
+#include "tdesc.h"
+int safe_to_init_tdesc_context = 0;
+extern dc_dcontext_t current_context;
+#endif
+
/* Tables of how to react to signals; the user sets them. */
static char signal_stop[NSIG];
@@ -434,21 +433,6 @@ The same program may be running in another process.");
normal_stop ();
}
-#if 0
-/* This might be useful (not sure), but isn't currently used. See also
- write_pc(). */
-/* Writing the inferior pc as a register calls this function
- to inform infrun that the pc has been set in the debugger. */
-
-void
-writing_pc (val)
- CORE_ADDR val;
-{
- stop_pc = val;
- pc_changed = 1;
-}
-#endif
-
/* Record the pc and sp of the program the last time it stopped.
These are just used internally by wait_for_inferior, but need
to be preserved over calls to it and cleared when the inferior
@@ -788,7 +772,7 @@ wait_for_inferior ()
CORE_ADDR stop_sp;
CORE_ADDR stop_func_start;
char *stop_func_name;
- CORE_ADDR prologue_pc;
+ CORE_ADDR prologue_pc, tmp;
int stop_step_resume_break;
struct symtab_and_line sal;
int remove_breakpoints_on_following_step = 0;
@@ -975,8 +959,7 @@ wait_for_inferior ()
/* End of a stack dummy. Some systems (e.g. Sony
news) give another signal besides SIGTRAP,
so check here as well as above. */
- || (stop_sp INNER_THAN stop_pc
- && stop_pc INNER_THAN stop_frame_address)
+ || PC_IN_CALL_DUMMY (stop_pc, stop_sp, stop_frame_address)
);
if (!random_signal)
stop_signal = SIGTRAP;
@@ -1181,19 +1164,7 @@ wait_for_inferior ()
&& (stop_sp INNER_THAN prev_sp
|| stop_frame_address != step_frame_address)))
{
-#if 0
- /* When "next"ing through a function,
- This causes an extra stop at the end.
- Is there any reason for this?
- It's confusing to the user. */
- /* Don't step through the return from a function
- unless that is the first instruction stepped through. */
- if (ABOUT_TO_RETURN (stop_pc))
- {
- stop_step = 1;
- break;
- }
-#endif
+ ;
}
/* We stepped out of the stepping range. See if that was due
@@ -1225,118 +1196,132 @@ wait_for_inferior ()
if (step_range_end == 1)
step_range_end = (step_range_start = prev_pc) + 1;
remove_breakpoints_on_following_step = 1;
+ goto save_pc;
}
/* ==> See comments at top of file on this algorithm. <==*/
- else if (stop_pc == stop_func_start
+ if (stop_pc == stop_func_start
&& (stop_func_start != prev_func_start
|| prologue_pc != stop_func_start
|| stop_sp != prev_sp))
{
- /* It's a subroutine call */
- if (step_over_calls > 0
- || (step_over_calls && find_pc_function (stop_pc) == 0))
+ /* It's a subroutine call.
+ (0) If we are not stepping over any calls ("stepi"), we
+ just stop.
+ (1) If we're doing a "next", we want to continue through
+ the call ("step over the call").
+ (2) If we are in a function-call trampoline (a stub between
+ the calling routine and the real function), locate
+ the real function and change stop_func_start.
+ (3) If we're doing a "step", and there are no debug symbols
+ at the target of the call, we want to continue through
+ it ("step over the call").
+ (4) Otherwise, we want to stop soon, after the function
+ prologue ("step into the call"). */
+
+ if (step_over_calls == 0)
{
- /* A subroutine call has happened. */
- /* Set a special breakpoint after the return */
+ /* I presume that step_over_calls is only 0 when we're
+ supposed to be stepping at the assembly language level. */
+ stop_step = 1;
+ break;
+ }
- step_resume_break_address =
- ADDR_BITS_REMOVE (
- SAVED_PC_AFTER_CALL (
- get_current_frame ()));
+ if (step_over_calls > 0)
+ goto step_over_function;
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- }
+ tmp = SKIP_TRAMPOLINE_CODE (stop_pc);
+ if (tmp != NULL)
+ stop_func_start = tmp;
+
+ if (find_pc_function (stop_func_start) != 0)
+ goto step_into_function;
+
+step_over_function:
+ /* A subroutine call has happened. */
+ /* Set a special breakpoint after the return */
+ step_resume_break_address =
+ ADDR_BITS_REMOVE
+ (SAVED_PC_AFTER_CALL (get_current_frame ()));
+ step_resume_break_duplicate
+ = breakpoint_here_p (step_resume_break_address);
+ if (breakpoints_inserted)
+ insert_step_breakpoint ();
+ goto save_pc;
+
+step_into_function:
/* Subroutine call with source code we should not step over.
Do step to the first line of code in it. */
- else if (step_over_calls)
- {
- SKIP_PROLOGUE (stop_func_start);
- sal = find_pc_line (stop_func_start, 0);
- /* Use the step_resume_break to step until
- the end of the prologue, even if that involves jumps
- (as it seems to on the vax under 4.2). */
- /* If the prologue ends in the middle of a source line,
- continue to the end of that source line.
- Otherwise, just go to end of prologue. */
+ SKIP_PROLOGUE (stop_func_start);
+ sal = find_pc_line (stop_func_start, 0);
+ /* Use the step_resume_break to step until
+ the end of the prologue, even if that involves jumps
+ (as it seems to on the vax under 4.2). */
+ /* If the prologue ends in the middle of a source line,
+ continue to the end of that source line.
+ Otherwise, just go to end of prologue. */
#ifdef PROLOGUE_FIRSTLINE_OVERLAP
- /* no, don't either. It skips any code that's
- legitimately on the first line. */
+ /* no, don't either. It skips any code that's
+ legitimately on the first line. */
#else
- if (sal.end && sal.pc != stop_func_start)
- stop_func_start = sal.end;
+ if (sal.end && sal.pc != stop_func_start)
+ stop_func_start = sal.end;
#endif
-
- if (stop_func_start == stop_pc)
- {
- /* We are already there: stop now. */
- stop_step = 1;
- break;
- }
- else
- /* Put the step-breakpoint there and go until there. */
- {
- step_resume_break_address = stop_func_start;
-
- step_resume_break_duplicate
- = breakpoint_here_p (step_resume_break_address);
- if (breakpoints_inserted)
- insert_step_breakpoint ();
- /* Do not specify what the fp should be when we stop
- since on some machines the prologue
- is where the new fp value is established. */
- step_frame_address = 0;
- /* And make sure stepping stops right away then. */
- step_range_end = step_range_start;
- }
- }
- else
- {
- /* We get here only if step_over_calls is 0 and we
- just stepped into a subroutine. I presume
- that step_over_calls is only 0 when we're
- supposed to be stepping at the assembly
- language level.*/
- stop_step = 1;
- break;
- }
- }
- /* No subroutine call; stop now. */
- else
- {
- /* We've wandered out of the step range (but we haven't done a
- subroutine call or return (that's handled elsewhere)). We
- don't really want to stop until we encounter the start of a
- new statement. If so, we stop. Otherwise, we reset
- step_range_start and step_range_end, and just continue. */
- sal = find_pc_line(stop_pc, 0);
-
- if (step_range_end == 1 /* Don't do this for stepi/nexti */
- || sal.line == 0 /* Stop now if no line # info */
- || (current_line != sal.line
- && stop_pc == sal.pc))
+
+ if (stop_func_start == stop_pc)
{
+ /* We are already there: stop now. */
stop_step = 1;
break;
- }
- else if (sal.line != 0)
+ }
+ else
+ /* Put the step-breakpoint there and go until there. */
{
- /* This is probably not necessary, but it probably makes
- stepping more efficient, as we avoid calling
- find_pc_line() for each instruction we step over. */
- step_range_start = sal.pc;
- step_range_end = sal.end;
+ step_resume_break_address = stop_func_start;
+
+ step_resume_break_duplicate
+ = breakpoint_here_p (step_resume_break_address);
+ if (breakpoints_inserted)
+ insert_step_breakpoint ();
+ /* Do not specify what the fp should be when we stop
+ since on some machines the prologue
+ is where the new fp value is established. */
+ step_frame_address = 0;
+ /* And make sure stepping stops right away then. */
+ step_range_end = step_range_start;
}
+ goto save_pc;
}
+
+ /* We've wandered out of the step range (but haven't done a
+ subroutine call or return). */
+
+ sal = find_pc_line(stop_pc, 0);
+
+ if (step_range_end == 1 || /* stepi or nexti */
+ sal.line == 0 || /* ...or no line # info */
+ (stop_pc == sal.pc /* ...or we're at the start */
+ && current_line != sal.line)) { /* of a different line */
+ /* Stop because we're done stepping. */
+ stop_step = 1;
+ break;
+ } else {
+ /* We aren't done stepping, and we have line number info for $pc.
+ Optimize by setting the step_range for the line.
+ (We might not be in the original line, but if we entered a
+ new line in mid-statement, we continue stepping. This makes
+ things like for(;;) statements work better.) */
+ step_range_start = sal.pc;
+ step_range_end = sal.end;
+ goto save_pc;
+ }
+ abort(); /* We never fall through here */
}
- else if (trap_expected
- && IN_SIGTRAMP (stop_pc, stop_func_name)
- && !IN_SIGTRAMP (prev_pc, prev_func_name))
+ if (trap_expected
+ && IN_SIGTRAMP (stop_pc, stop_func_name)
+ && !IN_SIGTRAMP (prev_pc, prev_func_name))
{
/* What has happened here is that we have just stepped the inferior
with a signal (because it is a signal which shouldn't make
@@ -1363,6 +1348,7 @@ wait_for_inferior ()
keep_going:
+save_pc:
/* Save the pc before execution, to compare with pc after stop. */
prev_pc = read_pc (); /* Might have been DECR_AFTER_BREAK */
prev_func_start = stop_func_start; /* Ok, since if DECR_PC_AFTER
@@ -1821,7 +1807,7 @@ restore_inferior_status (inf_status)
FRAME_FP (fid) != inf_status->selected_frame_address ||
level != 0)
{
-#if 0
+#if 1
/* I'm not sure this error message is a good idea. I have
only seen it occur after "Can't continue previously
requested operation" (we get called from do_cleanups), in
diff --git a/gdb/infrun.hacked.c b/gdb/infrun.hacked.c
index ae633e2..4fbb14d 100644
--- a/gdb/infrun.hacked.c
+++ b/gdb/infrun.hacked.c
@@ -116,9 +116,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/language.c b/gdb/language.c
index 64da374..d96b3b5 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -27,11 +27,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
return data out of a "language-specific" struct pointer that is set
whenever the working language changes. That would be a lot faster. */
-#include <stdio.h>
+#include "defs.h"
#include <string.h>
#include <varargs.h>
-#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
diff --git a/gdb/m68k-pinsn.c b/gdb/m68k-pinsn.c
index 4a19289..26edeea 100644
--- a/gdb/m68k-pinsn.c
+++ b/gdb/m68k-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/m68k.h"
diff --git a/gdb/m88k-pinsn.c b/gdb/m88k-pinsn.c
index e6bb9d1..7113232 100644
--- a/gdb/m88k-pinsn.c
+++ b/gdb/m88k-pinsn.c
@@ -19,9 +19,8 @@ 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 <stdio.h>
-#include "opcode/m88k.h"
#include "defs.h"
+#include "opcode/m88k.h"
#include "symtab.h"
void sprint_address ();
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 27d4bea..d9a55c0 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/m88k-xdep.c b/gdb/m88k-xdep.c
index 2c14ed4..d2d338d 100644
--- a/gdb/m88k-xdep.c
+++ b/gdb/m88k-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/mach386-xdep.c b/gdb/mach386-xdep.c
index 5152179..b12cf5a 100644
--- a/gdb/mach386-xdep.c
+++ b/gdb/mach386-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 865b5a6..a1df5b6 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -37,7 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
to figure out what full symbol table entries need to be read in. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c
index 0b3391e..39c82ff 100644
--- a/gdb/mips-pinsn.c
+++ b/gdb/mips-pinsn.c
@@ -18,8 +18,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/mips.h"
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4dd70e6..8a9d93c 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -1,5 +1,5 @@
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
- Copyright 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@@ -19,7 +19,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
@@ -351,7 +350,7 @@ init_extra_frame_info(fci)
for (ireg = 31; mask; --ireg, mask <<= 1)
if (mask & 0x80000000)
{
- fci->saved_regs->regs[32+ireg] = reg_position;
+ fci->saved_regs->regs[FP0_REGNUM+ireg] = reg_position;
reg_position -= 4;
}
}
@@ -539,12 +538,14 @@ mips_print_register(regnum, all)
read_relative_register_raw_bytes (regnum, raw_buffer);
- if (!(regnum & 1) && regnum >= FP0_REGNUM && regnum < FP0_REGNUM+32) {
+ /* If an even floating pointer register, also print as double. */
+ if (regnum >= FP0_REGNUM && regnum < FP0_REGNUM+32
+ && !((regnum-FP0_REGNUM) & 1)) {
read_relative_register_raw_bytes (regnum+1, raw_buffer+4);
- printf_filtered ("(d%d: ", regnum&31);
+ printf_filtered ("(d%d: ", regnum-FP0_REGNUM);
val_print (builtin_type_double, raw_buffer, 0,
stdout, 0, 1, 0, Val_pretty_default);
- printf_filtered ("); ", regnum&31);
+ printf_filtered ("); ");
}
fputs_filtered (reg_names[regnum], stdout);
#ifndef NUMERIC_REG_NAMES
@@ -651,12 +652,19 @@ CORE_ADDR mips_skip_prologue(pc)
struct symbol *f;
struct block *b;
unsigned long inst;
+ int offset;
/* For -g modules and most functions anyways the
- first instruction adjusts the stack. */
- inst = read_memory_integer(pc, 4);
- if ((inst & 0xffff0000) == 0x27bd0000)
- return pc + 4;
+ first instruction adjusts the stack.
+ But we allow some number of stores before the stack adjustment.
+ (These are emitted by varags functions compiled by gcc-2.0. */
+ for (offset = 0; offset < 100; offset += 4) {
+ inst = read_memory_integer(pc + offset, 4);
+ if ((inst & 0xffff0000) == 0x27bd0000) /* addiu $sp,$sp,offset */
+ return pc + offset + 4;
+ if ((inst & 0xFFE00000) != 0xAFA00000) /* sw reg,n($sp) */
+ break;
+ }
/* Well, it looks like a frameless. Let's make sure.
Note that we are not called on the current PC,
@@ -679,3 +687,25 @@ CORE_ADDR mips_skip_prologue(pc)
return pc;
}
+
+/* Figure out where the longjmp will land.
+ We expect the first arg to be a pointer to the jmp_buf structure from which
+ we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
+ This routine returns true on success. */
+
+int
+get_longjmp_target(pc)
+ CORE_ADDR *pc;
+{
+ CORE_ADDR jb_addr;
+
+ jb_addr = read_register(A0_REGNUM);
+
+ if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, pc,
+ sizeof(CORE_ADDR)))
+ return 0;
+
+ SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR));
+
+ return 1;
+}
diff --git a/gdb/mips-xdep.c b/gdb/mips-xdep.c
index d1f6319..e08ee6f 100644
--- a/gdb/mips-xdep.c
+++ b/gdb/mips-xdep.c
@@ -19,13 +19,12 @@ 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 <stdio.h>
+#include "defs.h"
#ifdef sgi
#include <sys/inst.h>
#else
#include <mips/inst.h>
#endif
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "symtab.h"
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 611d6f5..3f2fcd0 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -1,6 +1,7 @@
/* Read a symbol table in MIPS' format (Third-Eye).
- Copyright 1986, 1987, 1989, 1990, 1991 Free Software Foundation, Inc.
- Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU.
+ Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major
+ work by Per Bothner and John Gilmore at Cygnus Support.
This file is part of GDB.
@@ -31,11 +32,26 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
file, the corresponding partial symbol table is mutated into a full
fledged symbol table by going back and reading the symbols
for real. mipscoff_psymtab_to_symtab() is called indirectly through
- a pointer in the psymtab to do this. */
-
-#include <stdio.h>
+ a pointer in the psymtab to do this.
+
+ ECOFF symbol tables are mostly written in the byte order of the
+ target machine. However, one section of the table (the auxiliary
+ symbol information) is written in the host byte order. There is a
+ bit in the other symbol info which describes which host byte order
+ was used. ECOFF thereby takes the trophy from Intel `b.out' for
+ the most brain-dead adaptation of a file format to byte order.
+
+ This module can read all four of the known byte-order combinations,
+ on any type of host. However, it does make (and check) the assumption
+ that the external form of a symbol table structure (on disk)
+ occupies the same number of bytes as the internal form (in a struct).
+ Fixing this is possible but requires larger structural changes. */
+
+#define TM_FILE_OVERRIDE
#include "defs.h"
+#include "tm-mips.h"
#include "symtab.h"
+#include "gdbtypes.h"
#include "gdbcore.h"
#include "symfile.h"
#include "obstack.h"
@@ -46,14 +62,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef CMUCS
#include <mips/syms.h>
#else /* not CMUCS */
-#include <symconst.h>
-#include <sym.h>
+#ifndef LANGUAGE_C
+#define LANGUAGE_C
+#endif
+#include "symconst.h"
+#include "sym.h"
#endif /* not CMUCS */
#include "coff/mips.h"
#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
#include "aout/aout64.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */
+#include "coff/ecoff-ext.h"
struct coff_exec {
struct external_filehdr f;
@@ -121,9 +141,6 @@ struct complaint unknown_type_qual_complaint =
struct complaint array_bitsize_complaint =
{"size of array target type not known, assuming %d bits", 0, 0};
-struct complaint array_parse_complaint =
- {"array type with strange relative symbol", 0, 0};
-
struct complaint bad_tag_guess_complaint =
{"guessed tag type incorrectly", 0, 0};
@@ -190,6 +207,24 @@ struct type *builtin_type_string;
/* Forward declarations */
+static void
+fixup_symtab ();
+
+static void
+read_mips_symtab ();
+
+static int
+upgrade_type ();
+
+static void
+parse_partial_symbols();
+
+static int
+cross_ref();
+
+static void
+fixup_sigtramp();
+
static struct symbol *new_symbol();
static struct type *new_type();
static struct block *new_block();
@@ -283,9 +318,9 @@ mipscoff_symfile_read(sf, addr, mainline)
install_minimal_symbols (sf -> objfile);
}
-/* Exported procedure: Allocate zeroed memory */
+/* Allocate zeroed memory */
-char *
+static char *
xzalloc(size)
{
char *p = xmalloc(size);
@@ -353,6 +388,7 @@ read_the_mips_symtab(abfd, fsym, end_of_text_segp)
{
int stsize, st_hdrsize;
unsigned st_filptr;
+ struct hdr_ext hdr_ext;
HDRR st_hdr;
/* Header for executable/object file we read symbols from */
struct coff_exec filhdr;
@@ -360,7 +396,7 @@ read_the_mips_symtab(abfd, fsym, end_of_text_segp)
/* We get here with DESC pointing to the symtab header. But we need
* other info from the initial headers */
lseek(fsym, 0L, 0);
- myread(fsym, &filhdr, sizeof filhdr);
+ myread(fsym, (char *)&filhdr, sizeof filhdr);
if (end_of_text_segp)
*end_of_text_segp =
@@ -374,10 +410,13 @@ read_the_mips_symtab(abfd, fsym, end_of_text_segp)
return 0;
lseek(fsym, st_filptr, L_SET);
- if (st_hdrsize > sizeof (st_hdr)) /* Profanity check */
- abort();
- if (read(fsym, &st_hdr, st_hdrsize) != st_hdrsize)
+ if (st_hdrsize != sizeof (hdr_ext)) { /* Profanity check */
+ error ("Wrong header size: %d, not %d", st_hdrsize,
+ sizeof (hdr_ext));
+ }
+ if (read(fsym, &hdr_ext, st_hdrsize) != st_hdrsize)
goto readerr;
+ ecoff_swap_hdr_in (abfd, &hdr_ext, &st_hdr);
/* Find out how large the symbol table is */
stsize = (st_hdr.cbExtOffset - (st_filptr + st_hdrsize))
@@ -386,13 +425,13 @@ read_the_mips_symtab(abfd, fsym, end_of_text_segp)
/* Allocate space for the symbol table. Read it in. */
cur_hdr = (HDRR *) xmalloc(stsize + st_hdrsize);
- memcpy(cur_hdr, &st_hdr, st_hdrsize);
+ memcpy(cur_hdr, &hdr_ext, st_hdrsize);
if (read(fsym, (char *) cur_hdr + st_hdrsize, stsize) != stsize)
goto readerr;
/* Fixup file_pointers in it */
fixup_symtab(cur_hdr, (char *) cur_hdr + st_hdrsize,
- st_filptr + st_hdrsize);
+ st_filptr + st_hdrsize, abfd);
return;
readerr:
@@ -402,20 +441,43 @@ readerr:
/* Turn all file-relative pointers in the symtab described by HDR
into memory pointers, given that the symtab itself is located
- at DATA in memory and F_PTR in the file. */
+ at DATA in memory and F_PTR in the file.
-static
-fixup_symtab( hdr, data, f_ptr)
+ Byte-swap all the data structures, in place, while we are at it --
+ except AUX entries, which we leave in their original byte order.
+ They will be swapped as they are used instead. (FIXME: we ought to
+ do all the data structures that way.) */
+
+static void
+fixup_symtab (hdr, data, f_ptr, abfd)
HDRR *hdr;
char *data;
+ int f_ptr;
+ bfd *abfd;
{
int f_idx, s_idx;
FDR *fh;
SYMR *sh;
- OPTR *op;
PDR *pr;
EXTR *esh;
+ /* This function depends on the external and internal forms
+ of the MIPS symbol table taking identical space. Check this
+ assumption at compile-time. */
+ static check_hdr1[1 + sizeof (struct hdr_ext) - sizeof (HDRR)] = {0};
+ static check_hdr2[1 + sizeof (HDRR) - sizeof (struct hdr_ext)] = {0};
+ static check_fdr1[1 + sizeof (struct fdr_ext) - sizeof (FDR)] = {0};
+ static check_fdr2[1 + sizeof (FDR) - sizeof (struct fdr_ext)] = {0};
+ static check_pdr1[1 + sizeof (struct pdr_ext) - sizeof (PDR)] = {0};
+ static check_pdr2[1 + sizeof (PDR) - sizeof (struct pdr_ext)] = {0};
+ static check_sym1[1 + sizeof (struct sym_ext) - sizeof (SYMR)] = {0};
+ static check_sym2[1 + sizeof (SYMR) - sizeof (struct sym_ext)] = {0};
+ static check_ext1[1 + sizeof (struct ext_ext) - sizeof (EXTR)] = {0};
+ static check_ext2[1 + sizeof (EXTR) - sizeof (struct ext_ext)] = {0};
+
+ /* Swap in the header record. */
+ ecoff_swap_hdr_in (abfd, hdr, hdr);
+
/*
* These fields are useless (and empty) by now:
* hdr->cbDnOffset, hdr->cbOptOffset
@@ -440,15 +502,18 @@ fixup_symtab( hdr, data, f_ptr)
#undef FIX
- /*
- * Fix all string pointers inside the symtab, and
- * the FDR records. Also fix other miscellany.
- */
+ /* Fix all string pointers inside the symtab, and
+ the FDR records. Also fix other miscellany. */
+
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) {
register unsigned code_offset;
/* Header itself, and strings */
fh = (FDR *) (hdr->cbFdOffset) + f_idx;
+
+ /* Swap in the FDR */
+ ecoff_swap_fdr_in (abfd, fh, fh);
+
fh->issBase += hdr->cbSsOffset;
if (fh->rss != -1)
fh->rss = (long)fh->rss + fh->issBase;
@@ -459,6 +524,8 @@ fixup_symtab( hdr, data, f_ptr)
/* FIXME! Probably don't want to do this here! */
for (s_idx = 0; s_idx < fh->csym; s_idx++) {
sh = (SYMR*)fh->isymBase + s_idx;
+ ecoff_swap_sym_in (abfd, sh, sh);
+
sh->iss = (long) sh->iss + fh->issBase;
sh->reserved = 0;
}
@@ -475,7 +542,7 @@ fixup_symtab( hdr, data, f_ptr)
/* Aux symbols */
if (fh->caux)
- fh->iauxBase = hdr->cbAuxOffset + fh->iauxBase * sizeof(AUXU);
+ fh->iauxBase = hdr->cbAuxOffset + fh->iauxBase * sizeof(union aux_ext);
/* Relative file descriptor table */
fh->rfdBase = hdr->cbRfdOffset + fh->rfdBase * sizeof(RFDT);
@@ -489,6 +556,7 @@ fixup_symtab( hdr, data, f_ptr)
unsigned name, only_ext;
pr = (PDR*)(IPDFIRST(hdr,fh)) + s_idx;
+ ecoff_swap_pdr_in (abfd, pr, pr);
/* Simple rule to find files linked "-x" */
only_ext = fh->rss == -1;
@@ -521,9 +589,10 @@ fixup_symtab( hdr, data, f_ptr)
}
}
- /* External symbols: fix string */
+ /* External symbols: swap in, and fix string */
for (s_idx = 0; s_idx < hdr->iextMax; s_idx++) {
esh = (EXTR*)(hdr->cbExtOffset) + s_idx;
+ ecoff_swap_ext_in (abfd, esh, esh);
esh->asym.iss = esh->asym.iss + hdr->cbSsExtOffset;
}
}
@@ -563,7 +632,7 @@ fdr_name(name)
whether we are adding to the general symtab or not.
FIXME: INCREMENTAL is currently always zero, though it should not be. */
-static
+static void
read_mips_symtab (objfile, desc)
struct objfile *objfile;
int desc;
@@ -806,7 +875,7 @@ prepend_tag_kind(tag_name, type_code)
prefix = "";
}
- result = (char*)obstack_alloc (symbol_obstack,
+ result = (char*)obstack_alloc (&current_objfile->symbol_obstack,
strlen(prefix) + strlen(tag_name) + 1);
sprintf(result, "%s%s", prefix, tag_name);
return result;
@@ -818,12 +887,15 @@ prepend_tag_kind(tag_name, type_code)
/* Parse a single symbol. Mostly just make up a GDB symbol for it.
For blocks, procedures and types we open a new lexical context.
This is basically just a big switch on the symbol's type.
+ Argument AX is the base pointer of aux symbols for this file (fh->iauxBase).
+ BIGEND says whether aux symbols are big-endian or little-endian.
Return count of SYMR's handled (normally one). */
static int
-parse_symbol(sh, ax)
+parse_symbol(sh, ax, bigend)
SYMR *sh;
- AUXU *ax;
+ union aux_ext *ax;
+ int bigend;
{
char *name;
struct symbol *s;
@@ -835,6 +907,7 @@ parse_symbol(sh, ax)
we mark it explicitly */
int pend = (sh->reserved == 1);
enum address_class class;
+ TIR tir;
switch (sh->st) {
@@ -877,7 +950,7 @@ data: /* Common code for symbols describing data */
sh->index == 0xfffff)
SYMBOL_TYPE(s) = builtin_type_int; /* undefined? */
else
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
/* Value of a data symbol is its memory address */
break;
@@ -899,7 +972,7 @@ data: /* Common code for symbols describing data */
} else
SYMBOL_CLASS(s) = LOC_ARG;
SYMBOL_VALUE(s) = sh->value;
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
add_symbol(s, top_stack->cur_block);
#if 0
/* FIXME: This has not been tested. See dbxread.c */
@@ -927,7 +1000,7 @@ data: /* Common code for symbols describing data */
if (sh->sc == scUndefined || sh->sc == scNil)
t = builtin_type_int;
else
- t = parse_type(ax + sh->index, sh, 0);
+ t = parse_type(ax + sh->index + 1, 0, bigend);
b = top_stack->cur_block;
if (sh->st == stProc) {
struct blockvector *bv = BLOCKVECTOR(top_stack->cur_st);
@@ -1017,10 +1090,15 @@ data: /* Common code for symbols describing data */
if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
/* If the type of the member is Nil (or Void)
assume the tag is an enumeration. */
- if (tsym->index == indexNil
- || ax[tsym->index].ti.bt == btNil
- || ax[tsym->index].ti.bt == btVoid)
+ if (tsym->index == indexNil)
type_code = TYPE_CODE_ENUM;
+ else {
+ ecoff_swap_tir_in (bigend,
+ &ax[tsym->index].a_ti,
+ &tir);
+ if (tir.bt == btNil || tir.bt == btVoid)
+ type_code = TYPE_CODE_ENUM;
+ }
nfields++;
if (tsym->value > max_value)
max_value = tsym->value;
@@ -1033,7 +1111,6 @@ data: /* Common code for symbols describing data */
+ tsym->index-1;
}
-
/* There is no guaranteed way to distinguish struct,
unions, and enums at this point. This is a bug in the
original design (that has been fixed with the
@@ -1097,7 +1174,7 @@ data: /* Common code for symbols describing data */
f->bitsize = 0;
enum_sym = (struct symbol *)
- obstack_alloc (&objfile->symbol_obstack,
+ obstack_alloc (&current_objfile->symbol_obstack,
sizeof (struct symbol));
memset (enum_sym, 0, sizeof (struct symbol));
SYMBOL_NAME (enum_sym) = f->name;
@@ -1172,7 +1249,7 @@ data: /* Common code for symbols describing data */
f->name = (char*)sh->iss;
f->bitpos = sh->value;
f->bitsize = 0;
- f->type = parse_type(ax + sh->index, sh, &f->bitsize);
+ f->type = parse_type(ax + sh->index, &f->bitsize, bigend);
break;
case stTypedef: /* type definition */
@@ -1181,7 +1258,7 @@ data: /* Common code for symbols describing data */
SYMBOL_CLASS(s) = LOC_TYPEDEF;
SYMBOL_BLOCK_VALUE(s) = top_stack->cur_block;
add_symbol(s, top_stack->cur_block);
- SYMBOL_TYPE(s) = parse_type(ax + sh->index, sh, 0);
+ SYMBOL_TYPE(s) = parse_type(ax + sh->index, 0, bigend);
sh->value = (long) SYMBOL_TYPE(s);
break;
@@ -1204,13 +1281,15 @@ data: /* Common code for symbols describing data */
return count;
}
-/* Parse the type information provided in the AX entries for
- the symbol SH. Return the bitfield size in BS, in case. */
+/* Parse the type information provided in the raw AX entries for
+ the symbol SH. Return the bitfield size in BS, in case.
+ We must byte-swap the AX entries before we use them; BIGEND says whether
+ they are big-endian or little-endian (from fh->fBigendian). */
-static struct type *parse_type(ax, sh, bs)
- AUXU *ax;
- SYMR *sh;
+static struct type *parse_type(ax, bs, bigend)
+ union aux_ext *ax;
int *bs;
+ int bigend;
{
/* Null entries in this map are treated specially */
static struct type **map_bt[] =
@@ -1244,23 +1323,16 @@ static struct type *parse_type(ax, sh, bs)
&builtin_type_void, /* btVoid */
};
- TIR *t;
+ TIR t[1];
struct type *tp = 0;
char *fmt;
int i;
+ union aux_ext *tax;
int type_code;
- /* Procedures start off by one */
- if (sh->st == stProc || sh->st == stStaticProc)
- ax++;
-
- /* Undefined ? Should not happen */
- if (ax->rndx.rfd == 0xfff) {
- return builtin_type_void;
- }
-
- /* Use aux as a type information record, map its basic type */
- t = &ax->ti;
+ /* Use aux as a type information record, map its basic type. */
+ tax = ax;
+ ecoff_swap_tir_in (bigend, &tax->a_ti, t);
if (t->bt > (sizeof (map_bt)/sizeof (*map_bt))) {
complain (&basic_type_complaint, t->bt);
return builtin_type_int;
@@ -1303,17 +1375,21 @@ static struct type *parse_type(ax, sh, bs)
}
}
- /* Move on to next aux */
- ax++;
+ /* Skip over any further type qualifiers (FIXME). */
if (t->continued) {
/* This is the way it would work if the compiler worked */
- register TIR *t1 = t;
- while (t1->continued)
+ TIR t1[1];
+ do {
ax++;
+ ecoff_swap_tir_in (bigend, ax, t1);
+ } while (t1->continued);
}
+ /* Move on to next aux */
+ ax++;
+
if (t->fBitfield) {
- *bs = ax->width;
+ *bs = AUX_GET_WIDTH (bigend, ax);
ax++;
}
@@ -1330,7 +1406,7 @@ static struct type *parse_type(ax, sh, bs)
char name[256], *pn;
/* Try to cross reference this type */
- ax += cross_ref(ax, &tp, type_code, &pn);
+ ax += cross_ref(ax, &tp, type_code, &pn, bigend);
/* reading .o file ? */
if (UNSAFE_DATA_ADDR(tp))
tp = init_type(type_code, 0, 0, 0, (struct objfile *) NULL);
@@ -1358,11 +1434,11 @@ static struct type *parse_type(ax, sh, bs)
2 * sizeof (struct field));
TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"),
&current_objfile -> type_obstack);
- TYPE_FIELD_BITPOS (tp, 0) = ax->dnLow;
+ TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax);
ax++;
TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"),
&current_objfile -> type_obstack);
- TYPE_FIELD_BITPOS (tp, 1) = ax->dnHigh;
+ TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax);
ax++;
}
@@ -1370,7 +1446,7 @@ static struct type *parse_type(ax, sh, bs)
than 6 the game will continue in the next aux */
#define PARSE_TQ(tq) \
- if (t->tq != tqNil) ax += upgrade_type(&tp, t->tq, ax, sh);
+ if (t->tq != tqNil) ax += upgrade_type(&tp, t->tq, ax, bigend);
again: PARSE_TQ(tq0);
PARSE_TQ(tq1);
@@ -1381,7 +1457,8 @@ again: PARSE_TQ(tq0);
#undef PARSE_TQ
if (t->continued) {
- t++;
+ tax++;
+ ecoff_swap_tir_in (bigend, &tax->a_ti, t);
goto again;
}
return tp;
@@ -1390,24 +1467,25 @@ again: PARSE_TQ(tq0);
/* Make up a complex type from a basic one. Type is passed by
reference in TPP and side-effected as necessary. The type
qualifier TQ says how to handle the aux symbols at AX for
- the symbol SX we are currently analyzing.
+ the symbol SX we are currently analyzing. BIGEND says whether
+ aux symbols are big-endian or little-endian.
Returns the number of aux symbols we parsed. */
static int
-upgrade_type(tpp, tq, ax, sh)
- struct type **tpp;
- AUXU *ax;
- SYMR *sh;
+upgrade_type(tpp, tq, ax, bigend)
+ struct type **tpp;
+ union aux_ext *ax;
+ int bigend;
{
- int off;
- struct type *t;
+ int off;
+ struct type *t;
/* Used in array processing */
int rf, id;
FDR *fh;
struct field *f;
- SYMR ss;
int lower, upper;
+ RNDXR rndx;
switch (tq) {
case tqPtr:
@@ -1426,10 +1504,12 @@ upgrade_type(tpp, tq, ax, sh)
TYPE_TARGET_TYPE(t) = *tpp;
/* Determine and record the domain type (type of index) */
- id = ax->rndx.index;
- rf = ax->rndx.rfd;
+ ecoff_swap_rndx_in (bigend, ax, &rndx);
+ id = rndx.index;
+ rf = rndx.rfd;
if (rf == 0xfff) {
- rf = (++ax)->isym;
+ ax++;
+ rf = AUX_GET_ISYM (bigend, ax);
off++;
}
fh = get_rfd(cur_fd, rf);
@@ -1438,7 +1518,7 @@ upgrade_type(tpp, tq, ax, sh)
/* FIXME - Memory leak! */
if (TYPE_NFIELDS(t))
TYPE_FIELDS(t) = (struct field*)
- xrealloc(TYPE_FIELDS(t),
+ xrealloc((char *) TYPE_FIELDS(t),
(TYPE_NFIELDS(t)+1) * sizeof(struct field));
else
TYPE_FIELDS(t) = (struct field*)
@@ -1447,28 +1527,15 @@ upgrade_type(tpp, tq, ax, sh)
TYPE_NFIELDS(t)++;
memset(f, 0, sizeof(struct field));
- memset(&ss, 0, sizeof ss);
-/* XXX */ f->type = parse_type(fh->iauxBase + id * sizeof(AUXU),
- &ss, &f->bitsize);
+/* XXX */ f->type = parse_type(fh->iauxBase + id * sizeof(union aux_ext),
+ &f->bitsize, bigend);
- if (off == 0) {
- /*
- * This seems to be a pointer to the end of the Block defining
- * the type. Why it is here is magic for me, and I have no
- * good use for it anyways.
- */
- /* This used to occur because cross_ref returned
- the wrong result (ax pointed wrong). FIXME,
- delete this code in a while. -- gnu@cygnus jul91 */
- complain (&array_parse_complaint, 0);
- off++;
- id = (++ax)->rndx.index;
- if ((rf = ax->rndx.rfd) == 0xfff)
- rf = (++ax)->isym, off++;
- }
- lower = (++ax)->dnLow;
- upper = (++ax)->dnHigh;
- rf = (++ax)->width; /* bit size of array element */
+ ax++;
+ lower = AUX_GET_DNLOW (bigend, ax);
+ ax++;
+ upper = AUX_GET_DNHIGH (bigend, ax);
+ ax++;
+ rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
/* Check whether supplied array element bit size matches
the known size of the element type. If this complaint
@@ -1568,19 +1635,22 @@ parse_procedure(pr, bound)
parsing of the PDRs has already provided all the needed
information, we only parse them if SKIP_PROCEDURES is false,
and only if this causes no symbol duplication.
+ BIGEND says whether aux entries are big-endian or little-endian.
This routine clobbers top_stack->cur_block and ->cur_st. */
static
-parse_external(es, skip_procedures)
+parse_external(es, skip_procedures, bigend)
EXTR *es;
+ int skip_procedures;
+ int bigend;
{
- AUXU *ax;
+ union aux_ext *ax;
if (es->ifd != ifdNil) {
cur_fd = es->ifd;
cur_fdr = (FDR*)(cur_hdr->cbFdOffset) + cur_fd;
- ax = (AUXU*)cur_fdr->iauxBase;
+ ax = (union aux_ext *)cur_fdr->iauxBase;
} else {
cur_fdr = (FDR*)(cur_hdr->cbFdOffset);
ax = 0;
@@ -1621,7 +1691,7 @@ parse_external(es, skip_procedures)
* Note that the case of a symbol with indexNil
* must be handled anyways by parse_symbol().
*/
- parse_symbol(&es->asym, ax);
+ parse_symbol(&es->asym, ax, bigend);
break;
default:
break;
@@ -1702,7 +1772,7 @@ parse_lines(fh, lt)
END_OF_TEXT_SEG gives the address just after the text segment for
the symtab we are reading. */
-static
+static void
parse_partial_symbols(end_of_text_seg, objfile)
int end_of_text_seg;
struct objfile *objfile;
@@ -1730,7 +1800,7 @@ parse_partial_symbols(end_of_text_seg, objfile)
int dependencies_used, dependencies_allocated;
struct cleanup *old_chain;
- extern_tab = (EXTR**)obstack_alloc (psymbol_obstack,
+ extern_tab = (EXTR**)obstack_alloc (&objfile->psymbol_obstack,
sizeof(EXTR *) * hdr->iextMax);
includes_allocated = 30;
@@ -1826,10 +1896,10 @@ parse_partial_symbols(end_of_text_seg, objfile)
}
pst = start_psymtab_common (objfile, 0, (char*)fh->rss,
fh->cpd ? fh->adr : 0,
- global_psymbols.next,
- static_psymbols.next);
+ objfile->global_psymbols.next,
+ objfile->static_psymbols.next);
pst->read_symtab_private = (char *)
- obstack_alloc (psymbol_obstack, sizeof (struct symloc));
+ obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
save_pst = pst;
/* Make everything point to everything. */
@@ -1859,7 +1929,8 @@ parse_partial_symbols(end_of_text_seg, objfile)
(It is the second symbol because the first symbol is
the stFile used to signal the start of a file). */
if (fh->csym >= 2
- && strcmp(((SYMR *)fh->isymBase)[1].iss, stabs_symbol) == 0) {
+ && strcmp((char *)(((SYMR *)fh->isymBase)[1].iss),
+ stabs_symbol) == 0) {
for (cur_sdx = 2; cur_sdx < fh->csym; cur_sdx++) {
int type_code;
char *namestring;
@@ -1868,7 +1939,8 @@ parse_partial_symbols(end_of_text_seg, objfile)
if (!MIPS_IS_STAB(sh)) {
if (sh->st == stProc || sh->st == stStaticProc) {
long procaddr = sh->value;
- sh = (sh->index + (AUXU *)fh->iauxBase)->isym
+ sh = AUX_GET_ISYM (fh->fBigendian,
+ sh->index + (union aux_ext *)(fh->iauxBase))
+ (SYMR *) fh->isymBase - 1;
if (sh->st == stEnd) {
long high = procaddr + sh->value;
@@ -1920,9 +1992,10 @@ parse_partial_symbols(end_of_text_seg, objfile)
case stStaticProc: /* Function */
ADD_PSYMBOL_TO_LIST(name, strlen(name),
VAR_NAMESPACE, LOC_BLOCK,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
/* Skip over procedure to next one. */
- cur_sdx = (sh->index + (AUXU *)fh->iauxBase)->isym;
+ cur_sdx = AUX_GET_ISYM (fh->fBigendian,
+ sh->index + (union aux_ext *)fh->iauxBase);
procaddr = sh->value;
sh = cur_sdx + (SYMR *) fh->isymBase - 1;
@@ -1945,7 +2018,7 @@ parse_partial_symbols(end_of_text_seg, objfile)
if (sh->sc == scInfo) {
ADD_PSYMBOL_TO_LIST(name, strlen(name),
STRUCT_NAMESPACE, LOC_TYPEDEF,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
}
/* Skip over the block */
cur_sdx = sh->index;
@@ -1963,7 +2036,7 @@ parse_partial_symbols(end_of_text_seg, objfile)
/* Use this gdb symbol */
ADD_PSYMBOL_TO_LIST(name, strlen(name),
VAR_NAMESPACE, class,
- static_psymbols, sh->value);
+ objfile->static_psymbols, sh->value);
skip:
cur_sdx++; /* Go to next file symbol */
}
@@ -1991,10 +2064,10 @@ parse_partial_symbols(end_of_text_seg, objfile)
class = LOC_STATIC;
break;
}
- if (global_psymbols.next >=
- global_psymbols.list + global_psymbols.size)
- extend_psymbol_list (&global_psymbols, objfile);
- psym = global_psymbols.next++;
+ if (objfile->global_psymbols.next >=
+ objfile->global_psymbols.list + objfile->global_psymbols.size)
+ extend_psymbol_list (&objfile->global_psymbols, objfile);
+ psym = objfile->global_psymbols.next++;
SYMBOL_NAME (psym) = (char*)sh->iss;
SYMBOL_NAMESPACE (psym) = VAR_NAMESPACE;
SYMBOL_CLASS (psym) = class;
@@ -2004,8 +2077,7 @@ parse_partial_symbols(end_of_text_seg, objfile)
end_psymtab (save_pst, psymtab_include_list, includes_used,
-1, save_pst->texthigh,
- dependency_list, dependencies_used,
- global_psymbols.next, static_psymbols.next);
+ dependency_list, dependencies_used);
if (entry_point < save_pst->texthigh
&& entry_point >= save_pst->textlow) {
startup_file_start = save_pst->textlow;
@@ -2038,7 +2110,7 @@ parse_partial_symbols(end_of_text_seg, objfile)
}
pst->number_of_dependencies = fh->crfd - s_id0;
pst->dependencies = (struct partial_symtab **)
- obstack_alloc (psymbol_obstack,
+ obstack_alloc (&objfile->psymbol_obstack,
pst->number_of_dependencies *
sizeof (struct partial_symtab *));
for (s_idx = s_id0; s_idx < fh->crfd; s_idx++) {
@@ -2168,7 +2240,8 @@ psymtab_to_symtab_1(pst, filename)
/* See comment in parse_partial_symbols about the @stabs sentinel. */
have_stabs =
fh && fh->csym >= 2
- && strcmp(((SYMR *)fh->isymBase)[1].iss, stabs_symbol) == 0;
+ && strcmp((char *)(((SYMR *)fh->isymBase)[1].iss), stabs_symbol)
+ == 0;
if (!have_stabs) {
if (fh)
@@ -2268,7 +2341,7 @@ psymtab_to_symtab_1(pst, filename)
: fh[1].adr;
for (cur_sdx = 0; cur_sdx < fh->csym; ) {
sh = (SYMR *) (fh->isymBase) + cur_sdx;
- cur_sdx += parse_symbol(sh, fh->iauxBase);
+ cur_sdx += parse_symbol(sh, fh->iauxBase, fh->fBigendian);
}
/* Procedures next, note we need to look-ahead to
@@ -2303,7 +2376,7 @@ psymtab_to_symtab_1(pst, filename)
ext_ptr = PST_PRIVATE(pst)->extern_tab;
for (i = PST_PRIVATE(pst)->extern_count; --i >= 0; ext_ptr++)
- parse_external(*ext_ptr, 1);
+ parse_external(*ext_ptr, 1, fh->fBigendian);
/* If there are undefined, tell the user */
if (n_undef_symbols) {
@@ -2332,22 +2405,30 @@ psymtab_to_symtab_1(pst, filename)
/* Lookup the type at relative index RN. Return it in TPP
if found and in any event come up with its name PNAME.
- Return value says how many aux symbols we ate */
+ BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
+ Return value says how many aux symbols we ate. */
-static
-cross_ref(rn, tpp, type_code, pname)
- RNDXR *rn;
+static int
+cross_ref(ax, tpp, type_code, pname, bigend)
+ union aux_ext *ax;
struct type **tpp;
int type_code; /* Use to alloc new type if none is found. */
char **pname;
+ int bigend;
{
+ RNDXR rn[1];
unsigned rf;
+ int result = 1;
+
+ ecoff_swap_rndx_in (bigend, ax, rn);
/* Escape index means 'the next one' */
- if (rn->rfd == 0xfff)
- rf = *(unsigned *) (rn + 1);
- else
+ if (rn->rfd == 0xfff) {
+ result++;
+ rf = AUX_GET_ISYM (bigend, ax + 1);
+ } else {
rf = rn->rfd;
+ }
if (rf == -1) {
/* Ooops */
@@ -2391,7 +2472,7 @@ cross_ref(rn, tpp, type_code, pname)
}
/* We used one auxent normally, two if we got a "next one" rf. */
- return (rn->rfd == 0xfff? 2: 1);
+ return result;
}
@@ -2470,8 +2551,10 @@ add_block(b,s)
{
struct blockvector *bv = BLOCKVECTOR(s);
- bv = (struct blockvector *)xrealloc(bv, sizeof(struct blockvector) +
- BLOCKVECTOR_NBLOCKS(bv) * sizeof(bv->block));
+ bv = (struct blockvector *)xrealloc((char *) bv,
+ sizeof(struct blockvector) +
+ BLOCKVECTOR_NBLOCKS(bv)
+ * sizeof(bv->block));
if (bv != BLOCKVECTOR(s))
BLOCKVECTOR(s) = bv;
@@ -2614,6 +2697,9 @@ static
struct symtab *
new_symtab(name, maxsyms, maxlines, objfile)
char *name;
+ int maxsyms;
+ int maxlines;
+ struct objfile *objfile;
{
struct symtab *s = allocate_symtab (name, objfile);
@@ -2749,7 +2835,7 @@ new_symbol(name)
char *name;
{
struct symbol *s = (struct symbol *)
- obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
+ obstack_alloc (&current_objfile->symbol_obstack, sizeof (struct symbol));
memset (s, 0, sizeof (*s));
SYMBOL_NAME(s) = name;
@@ -2767,7 +2853,8 @@ new_type(name)
t = alloc_type (current_objfile);
TYPE_NAME(t) = name;
- TYPE_CPLUS_SPECIFIC(t) = &cplus_struct_default;
+ TYPE_CPLUS_SPECIFIC(t) = (struct cplus_struct_type *)
+ &cplus_struct_default;
return t;
}
@@ -2782,7 +2869,7 @@ new_type(name)
from MIPS does not do so, we make up that information ourselves.
If they fix the library (unlikely) this code will neutralize itself. */
-static
+static void
fixup_sigtramp()
{
struct symbol *s;
diff --git a/gdb/mmap-alloc.c b/gdb/mmap-alloc.c
index 5f8f0dc..d1ac6e4 100755
--- a/gdb/mmap-alloc.c
+++ b/gdb/mmap-alloc.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#if defined (HAVE_MMAP)
diff --git a/gdb/mmap-sbrk.c b/gdb/mmap-sbrk.c
index fe9c072..2622845 100755
--- a/gdb/mmap-sbrk.c
+++ b/gdb/mmap-sbrk.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#ifdef HAVE_MMAP
diff --git a/gdb/nindy-tdep.c b/gdb/nindy-tdep.c
index 4996b53..1d31601 100644
--- a/gdb/nindy-tdep.c
+++ b/gdb/nindy-tdep.c
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Miscellaneous NINDY-dependent routines.
Some replace macros normally defined in "tm.h". */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "frame.h"
diff --git a/gdb/ns32k-pinsn.c b/gdb/ns32k-pinsn.c
index 3cfbae5..2ce903a 100644
--- a/gdb/ns32k-pinsn.c
+++ b/gdb/ns32k-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "ns32k-opcode.h"
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index d863cd8..8937f24 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This file contains support routines for creating, manipulating, and
destroying objfile structures. */
-#include <stdio.h>
#include "defs.h"
#include "bfd.h" /* Binary File Description */
#include "symtab.h"
diff --git a/gdb/os68k-xdep.c b/gdb/os68k-xdep.c
index 295dff8..0253012 100644
--- a/gdb/os68k-xdep.c
+++ b/gdb/os68k-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
diff --git a/gdb/parse.c b/gdb/parse.c
index cb2909a..334733c 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -28,7 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
during the process of parsing; the lower levels of the tree always
come first in the result. */
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
diff --git a/gdb/procfs.c b/gdb/procfs.c
index acebc11..c10ba0a 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -32,13 +32,10 @@ regardless of whether or not the actual target has floating point hardware.
*/
-#include <stdio.h>
-
#include "defs.h"
#ifdef USE_PROC_FS /* Entire file goes away if not using /proc */
-#include <stdio.h>
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/gdb/pyr-pinsn.c b/gdb/pyr-pinsn.c
index 4a11dff..6968c54 100644
--- a/gdb/pyr-pinsn.c
+++ b/gdb/pyr-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/pyr.h"
diff --git a/gdb/pyr-xdep.c b/gdb/pyr-xdep.c
index bfe7b5e..4517c0b 100644
--- a/gdb/pyr-xdep.c
+++ b/gdb/pyr-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c
index b102d03..1a75b1b 100644
--- a/gdb/remote-adapt.c
+++ b/gdb/remote-adapt.c
@@ -29,9 +29,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
o - I can't get 19200 baud rate to work.
7/91 o - Freeze mode tracing can be done on a 29050. */
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "inferior.h"
#include "wait.h"
#include "value.h"
diff --git a/gdb/remote-eb.c b/gdb/remote-eb.c
index 01df861..778df86 100644
--- a/gdb/remote-eb.c
+++ b/gdb/remote-eb.c
@@ -25,11 +25,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
has PC/NFS, so it can access the same executables that gdb can,
over the net in real time. */
-#include <stdio.h>
-#include <string.h>
-
#define TM_FILE_OVERRIDE
#include "defs.h"
+#include <string.h>
#include "tm-29k.h"
#include "inferior.h"
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 75af3b9..fcf4d9f 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -19,7 +19,6 @@ 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 <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "wait.h"
diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c
index 316d6d2..dc13958 100644
--- a/gdb/remote-mm.c
+++ b/gdb/remote-mm.c
@@ -29,7 +29,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
You should get tagged at compile time if you need to make any
changes/additions. */
-#include <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "wait.h"
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index d5b4b59..d5b8e11 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -95,12 +95,11 @@ NINDY ROM monitor at the other end of the line.
*
******************************************************************************/
-#include <stdio.h>
+#include "defs.h"
#include <signal.h>
#include <sys/types.h>
#include <setjmp.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
diff --git a/gdb/remote-sa.sparc.c b/gdb/remote-sa.sparc.c
index 20f84a1..6dae0c9 100644
--- a/gdb/remote-sa.sparc.c
+++ b/gdb/remote-sa.sparc.c
@@ -4,10 +4,9 @@
/* Memory-access and commands for inferior process, for GDB.
*/
+#include "defs.h"
#include <sys/errno.h>
#include <setjmp.h>
-#include <stdio.h>
-#include "defs.h"
#include "frame.h"
#include "value.h"
#include "inferior.h"
diff --git a/gdb/remote-vx.68.c b/gdb/remote-vx.68.c
index c7b7058..f41ce7f 100644
--- a/gdb/remote-vx.68.c
+++ b/gdb/remote-vx.68.c
@@ -30,7 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symtab.h"
#include "symfile.h" /* for struct complaint */
-#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index a031bb5..ac92e2f 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/remote.c b/gdb/remote.c
index 8562124..49cdcfe 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -66,10 +66,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
kill req k
*/
-#include <stdio.h>
+#include "defs.h"
#include <string.h>
#include <fcntl.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
@@ -276,7 +275,7 @@ device is attached to the remote system (e.g. /dev/ttya).");
sg.c_cflag &= ~PARENB; /* No parity */
sg.c_cflag |= CS8; /* 8-bit path */
if (baudrate_set)
- sg.c_cflag = (sb.c_cflag & ~CBAUD) | b_rate;
+ sg.c_cflag = (sg.c_cflag & ~CBAUD) | b_rate;
#else
sg.sg_flags |= RAW | ANYP;
sg.sg_flags &= ~ECHO;
diff --git a/gdb/rs6000-pinsn.c b/gdb/rs6000-pinsn.c
index b54cb6e..5ecea53 100644
--- a/gdb/rs6000-pinsn.c
+++ b/gdb/rs6000-pinsn.c
@@ -18,7 +18,6 @@ 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 <stdio.h>
#include "defs.h"
#include "rs6k-opcode.h"
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 735678d..e64e378 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c
index 2dd170a..62f3f59 100644
--- a/gdb/rs6000-xdep.c
+++ b/gdb/rs6000-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/signame.c b/gdb/signame.c
index f0e88ba..1294279 100755
--- a/gdb/signame.c
+++ b/gdb/signame.c
@@ -17,10 +17,9 @@ 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 <stdio.h>
-#include <signal.h>
/* GDB-specific, FIXME. (This is for the SYS_SIGLIST_MISSING define). */
#include "defs.h"
+#include <signal.h>
#include "signame.h"
static void
diff --git a/gdb/sparc-pinsn.c b/gdb/sparc-pinsn.c
index cb4b5d2..0922ef9 100644
--- a/gdb/sparc-pinsn.c
+++ b/gdb/sparc-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/sparc.h"
diff --git a/gdb/sparc-xdep.c b/gdb/sparc-xdep.c
index 8fb5bb0..7fabdab 100644
--- a/gdb/sparc-xdep.c
+++ b/gdb/sparc-xdep.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
/* This code only compiles when we have the definitions in tm-sparc.h. */
#define TM_FILE_OVERRIDE
diff --git a/gdb/state.c b/gdb/state.c
index b6ce398..8b51bf7 100644
--- a/gdb/state.c
+++ b/gdb/state.c
@@ -64,7 +64,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
-#include <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
diff --git a/gdb/sun3-xdep.c b/gdb/sun3-xdep.c
index 2a3a4a1..b1f8cbe 100644
--- a/gdb/sun3-xdep.c
+++ b/gdb/sun3-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c
index b56a159..15f9d99 100644
--- a/gdb/sun386-xdep.c
+++ b/gdb/sun386-xdep.c
@@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if defined (GDB_TARGET_IS_SUN386)
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/symm-tdep.c b/gdb/symm-tdep.c
index e5161d5..64ab292 100644
--- a/gdb/symm-tdep.c
+++ b/gdb/symm-tdep.c
@@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* many 387-specific items of use taken from i386-dep.c */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/symm-xdep.c b/gdb/symm-xdep.c
index 0d20c53..b7d9a91 100644
--- a/gdb/symm-xdep.c
+++ b/gdb/symm-xdep.c
@@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* FIXME, some 387-specific items of use taken from i387-tdep.c -- ought to be
merged back in. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/tahoe-pinsn.c b/gdb/tahoe-pinsn.c
index 9c2efca..9b16d03 100644
--- a/gdb/tahoe-pinsn.c
+++ b/gdb/tahoe-pinsn.c
@@ -19,7 +19,6 @@ 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 <stdio.h>
#include "defs.h"
#include "symtab.h"
#include "opcode/tahoe.h"
diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c
index 505df6a..82ad286 100644
--- a/gdb/ultra3-xdep.c
+++ b/gdb/ultra3-xdep.c
@@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define DEBUG
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index 474416b..ce74023 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -17,7 +17,6 @@ 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 <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
diff --git a/gdb/utils.c b/gdb/utils.c
index 0f7b2f8..cc1573d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -17,7 +17,8 @@ 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 <stdio.h>
+#include "defs.h"
+
#include <sys/ioctl.h>
#include <sys/param.h>
#include <pwd.h>
@@ -25,7 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <ctype.h>
#include <string.h>
-#include "defs.h"
#include "signals.h"
#include "gdbcmd.h"
#include "terminal.h"
@@ -356,7 +356,8 @@ xrealloc (ptr, size)
char *ptr;
long size;
{
- register char *val = (char *) realloc (ptr, size);
+ register char *val =
+ ptr ? (char *) realloc (ptr, size) : (char*) malloc (size);
if (!val)
fatal ("virtual memory exhausted.", 0);
return val;
@@ -1100,7 +1101,7 @@ n_spaces (n)
{
if (spaces)
free (spaces);
- spaces = malloc (n+1);
+ spaces = (char *) malloc (n+1);
for (t = spaces+n; t != spaces;)
*--t = ' ';
spaces[n] = '\0';
@@ -1147,7 +1148,7 @@ _initialize_utils ()
"Set number of characters gdb thinks are in a line.",
&setlist);
add_show_from_set (c, &showlist);
- c->function = set_width_command;
+ c->function.sfunc = set_width_command;
add_show_from_set
(add_set_cmd ("height", class_support,
diff --git a/gdb/values.c b/gdb/values.c
index 09ff38a..34875ca 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -17,9 +17,8 @@ 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 <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
diff --git a/gdb/vax-pinsn.c b/gdb/vax-pinsn.c
index d62115e..a0f8e95 100644
--- a/gdb/vax-pinsn.c
+++ b/gdb/vax-pinsn.c
@@ -17,8 +17,6 @@ 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 <stdio.h>
-
#include "defs.h"
#include "symtab.h"
#include "opcode/vax.h"
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index 7259b21..e698ffc 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -21,7 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* xcoff-exec - deal with executing XCOFF files. */
-#include <stdio.h>
+#include "defs.h"
+
#include <sys/types.h>
#include <sys/param.h>
#include <fcntl.h>
@@ -30,7 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/stat.h>
#include <sys/ldr.h>
-#include "defs.h"
#include "frame.h"
#include "inferior.h"
#include "target.h"
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index c5a7925..738af31 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -19,7 +19,6 @@ 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 <stdio.h>
#include "defs.h"
#include "bfd.h"