Tue Mar 3 15:11:52 1992 Michael Tiemann (tiemann@cygnus.com)
authorMichael Tiemann <tiemann@cygnus>
Tue, 3 Mar 1992 23:26:26 +0000 (23:26 +0000)
committerMichael Tiemann <tiemann@cygnus>
Tue, 3 Mar 1992 23:26:26 +0000 (23:26 +0000)
* All GDB files that #include defs.h: Removed stdio.h.
(defs.h): #include stdio.h.

This has been tested by building GDBs for all targets hosted on Sun4.
None of the build problems were related to stdio.h inclusion.  (n.b.
many configurations don't build for other reasons.)

84 files changed:
gdb/ChangeLog
gdb/a68v-xdep.c
gdb/altos-xdep.c
gdb/am29k-pinsn.c
gdb/am29k-tdep.c
gdb/arm-pinsn.c
gdb/arm-xdep.c
gdb/buildsym.c
gdb/command.c
gdb/convex-pinsn.c
gdb/convex-tdep.c
gdb/convex-xdep.c
gdb/core.c
gdb/coredep.c
gdb/cplus-dem.c
gdb/defs.h
gdb/dwarfread.c
gdb/ecoff.c
gdb/elfread.c
gdb/gdbtypes.c
gdb/gould-pinsn.c
gdb/gould-xdep.c
gdb/h8300-tdep.c
gdb/hp300ux-xdep.c
gdb/i386-pinsn.c
gdb/i386-tdep.c
gdb/i386-xdep.c
gdb/i387-tdep.c
gdb/i860-pinsn.c
gdb/i860-tdep.c
gdb/i960-pinsn.c
gdb/i960-tdep.c
gdb/ieee-float.c
gdb/infrun.c
gdb/infrun.hacked.c
gdb/language.c
gdb/m68k-pinsn.c
gdb/m88k-pinsn.c
gdb/m88k-tdep.c
gdb/m88k-xdep.c
gdb/mach386-xdep.c
gdb/minsyms.c
gdb/mips-pinsn.c
gdb/mips-tdep.c
gdb/mips-xdep.c
gdb/mipsread.c
gdb/mmap-alloc.c
gdb/mmap-sbrk.c
gdb/nindy-tdep.c
gdb/ns32k-pinsn.c
gdb/objfiles.c
gdb/os68k-xdep.c
gdb/parse.c
gdb/procfs.c
gdb/pyr-pinsn.c
gdb/pyr-xdep.c
gdb/remote-adapt.c
gdb/remote-eb.c
gdb/remote-hms.c
gdb/remote-mm.c
gdb/remote-nindy.c
gdb/remote-sa.sparc.c
gdb/remote-vx.68.c
gdb/remote-vx.c
gdb/remote.c
gdb/rs6000-pinsn.c
gdb/rs6000-tdep.c
gdb/rs6000-xdep.c
gdb/signame.c
gdb/sparc-pinsn.c
gdb/sparc-xdep.c
gdb/state.c
gdb/sun3-xdep.c
gdb/sun386-xdep.c
gdb/symm-tdep.c
gdb/symm-xdep.c
gdb/tahoe-pinsn.c
gdb/ultra3-xdep.c
gdb/umax-xdep.c
gdb/utils.c
gdb/values.c
gdb/vax-pinsn.c
gdb/xcoffexec.c
gdb/xcoffread.c

index f4802ffbaea6580ca85cb17750e3022ff59580f4..050dbebc3bbcc212a9ba6773732a10321390e1af 100644 (file)
@@ -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
index e9cf5979e2b0f70d7ad352cd3c6cc66904e25baa..036ef7bc0fa53a7f848a31bded4e62d9ce4cc896 100644 (file)
@@ -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"
index fafcb184231cd0be8d3c00691d54dc60e2a8ea2c..243f35e2c736d367ec67c2642dfa7f8a01724309 100644 (file)
@@ -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"
index d0e18fcb616056fcbcefa6d5cd72a69fa35d06ed..c226a3aa1c027fc0b00252fb6c06b457d26b121b 100644 (file)
@@ -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"
index 5c08a9bc07d228617da30c66e9db62a6523111e6..1600bb48590aa61be5871ab0e40b32917cdc8f3f 100644 (file)
@@ -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"
index 53a3019f3d0c4238f43b23fe2134d9bb6428b926..240f7cb11fa9dae2e361686b83a41b4b1785e612 100644 (file)
@@ -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"
 
index 4c477fb2729d57f1639b9ae4de7f334a3cbda7b1..149b30fd3cd01e6e3a552c9e61d7c1f1059b66e7 100644 (file)
@@ -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>
index 3a33a43fb83d33f983cc1029e90900bad4949db7..d5deff178c613c4f8754fe362907240a5dd99d4f 100644 (file)
@@ -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"
index 696547ff73297a326dd508ce64f4d46ef0fac792..4eed2a00d4c4e802272ae63eaa90675cebaa37bc 100644 (file)
@@ -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"
index 9a792ac7bc37e7eac27505d482fcf7561058b011..0c95e369d0fa5b53be867338dfb3e8a8b9478076 100644 (file)
@@ -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"
 
index 8c86ae8fc9f1e2fb2f736cdd2b363633c3492486..774bbcb604aecbb57eece9011f715d3a08382315 100644 (file)
@@ -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"
index 60b090c177cdd398ab245eeb7d7d1b055a7847ee..c078d9e298f0e6e3fc573552a0f12eeda5c7aac1 100644 (file)
@@ -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"
index deeb5238c0000dda6459b509949313920c86b1fb..72fb5fe87eb6d3f511a2f5436ce0778010ec5699 100644 (file)
@@ -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"
index 62644c6aefe39dafb85133ae8516b363000b7472..52b4f776d37f671254b1a11af177f129b7834c34 100644 (file)
@@ -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.  */
index 1bc5a359d2f75b753b79e92313916f20d07e39a8..ed40e37c081b36e7a1b3b4d8036df1e0b673dab3 100644 (file)
 /* 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>
index 45e081612340c4eeb5f075ed5edd1625f5bb185d..f96258bc18e51531deec7a25c79fad85f8ac8356 100644 (file)
@@ -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 */
+
 \f
 /* 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) */
index 0f0a8bd7721bd89f2319767a1f92c228743063a4..20c9dab6088d32302685d432dab041bc1544c089 100644 (file)
@@ -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"
index 4397c9c2302642dfdb0e00b2f54041c50128ef60..519763dcf979c7ec17958adb89e0d652848724d5 100755 (executable)
@@ -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 */
index 8b72f80b2e0347d521c222e85a39bfd54557ddc5..6a8977833556eac6912a32ce1608875c338a9f5b 100644 (file)
@@ -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"
index a2bf9439aa57272e9ffcff77e7f6140ee11980b8..aaf7d2775034b40a3800b22eb73f613b4963a054 100644 (file)
@@ -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"
index f206a1e898f606591cfb008c22fa055746aa3c88..876b8758068a7a76a2522c3f821a8d78684cc52f 100644 (file)
@@ -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"
index fe69c795cd8d94ea473a2e5ad232c3e6dcb21910..5a320ba6a1bebc53a144f5053e9c35999e509c30 100644 (file)
@@ -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"
index 0ef703d98b0e333471c198a8fde48f23e4d646cf..eb2f03f8a990bfd31fe4eafdc72b4a1e6b1947d3 100644 (file)
@@ -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"
index a7f8f728db3b1366ef03552c75f031169c482698..6c30766cff8dfcd24ecb8650d6dd462db4f14ec4 100644 (file)
@@ -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"
index eb0e17402d4f4cb6b145f0b5856d2506a4fe32d6..89261aa08e44ac32289df0ca53a20af26a218780 100644 (file)
@@ -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
index 8b8fb84beba647e38915c1173e32122deed0d041..ab56e62a7172877660b2490f7ef3e0e70b182d96 100644 (file)
@@ -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 */
index 44e9c8a55a0624a0c177f9daf8f4f8c86e738d87..f0a412a5cee2e81c51477781386ccbef4dbf20b5 100644 (file)
@@ -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"
index c968ade8f918caf54d2879cc9ca6084a9212a987..b930aaa4a4717ddf5b9a7a271f22c6466bdef42a 100644 (file)
@@ -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"
index aa3b9f84dbca9a818539cd965218427350bf8779..fd03c56b8ab432a16641c6e9c091f3f96c0ac805 100644 (file)
@@ -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"
index 759f8712e295e3087ad7fa8dcf26e3d4c5fc35cc..4d631db3496a332317a4d7648520bab27e0cb6c1 100644 (file)
    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"
index f13b201c99b381222c3fb02930afbff4edf9bf53..dcf8e221352d9044b7125f623f9bee0e543f6aa6 100644 (file)
@@ -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"
index eda9d60fe6f4cc0445a0028a94468f9e2965ce3e..35c145d819c000bdc25d4b513852f8df81664557 100644 (file)
@@ -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"
index 417186b436402e8013556f747eabff57834960b7..f170bd59ac628f28d3f6bae5ead8a3969c4766b4 100644 (file)
@@ -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 */
index f8bc976b707b325f8239bb02662cf2bd15c0c89b..07083f0757b0ca7807dc3115851e546c2950ab98 100644 (file)
@@ -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
index ae633e2bd1941b4b1228c3a06dd1322d182a4fc4..4fbb14d3392a3ec3b2c36ddc42c1b6ce32dab832 100644 (file)
@@ -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"
index 64da374f8432f995732ac91498a5254f52ede63e..d96b3b51ea704079d66c61e3f57d2538d7beba09 100644 (file)
@@ -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"
index 4a19289e1a2e77cddd33275b9c69f3aa3d285565..26edeeab78571e72a4ce1e41cfdd6f2fcae6fa08 100644 (file)
@@ -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"
index e6bb9d1e5c60e868a61ca2c1f9a3e518bc91aeec..711323233fba14446753c038a3c953aa9796bdbe 100644 (file)
@@ -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 ();
index 27d4bea0e57b6863a45ab109c7823694df36385c..d9a55c0b1456684e444d2ad6bc6688cd1700ffa4 100644 (file)
@@ -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"
index 2c14ed48c9f01217604a3b58ba6487beadb17a07..d2d338dae1fd7858388c5bc6fd552bf7a386f329 100644 (file)
@@ -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"
index 5152179ee69a5317b1316de4cde133a3a25bc711..b12cf5a44f6ebc6b2c206aa715f27a4222873be2 100644 (file)
@@ -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"
index 865b5a60618fb9a44c98de24f8e672e5fec21196..a1df5b68d05336f6b89fe4fd08e06e764f2d73ae 100644 (file)
@@ -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"
index 0b3391e07b27777f4d70fc8b0fe82ced9b32fcc2..39c82ffec0c76ab46d4a05ec70f5bb653226fed9 100644 (file)
@@ -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"
index 4dd70e63ea979b9474a71e4030207b36e9e9e797..8a9d93c70b6171fe13f17350c6b74740b5ba976c 100644 (file)
@@ -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;
+}
index d1f63190b7e28a15dee9592497ba645ecc63f270..e08ee6fc16b6de7d1b754ee38e0d47836723eefb 100644 (file)
@@ -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"
index 611d6f5909ea1f08c3c8e22c7fe31434c34d77db..3f2fcd0ec051aa771e3761af2645bf3572835d8d 100644 (file)
@@ -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;
index 5f8f0dc049bd42ba3b92662b1f2807fc3566254b..d1ac6e420425c611cc949a9f867c0c622a96292a 100755 (executable)
@@ -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)
index fe9c07283ea47b147e500d59af039f5441482d87..262284553d8c5f639d9e3c778245ca17b21ba7a7 100755 (executable)
@@ -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
index 4996b53beb30304e7f1bf4d3ef8659f018c79e80..1d31601b65939817f57dfa9f648b44fafb001406 100644 (file)
@@ -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"
index 3cfbae529985807f88f40937e75d8265bed8a234..2ce903ac4e5c0c91d4b21d9286ccb6cc5f320184 100644 (file)
@@ -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"
index d863cd8e14363c2a1a15cef3cf75d79e4ee5173a..8937f240031e0c0f3ec8818ddda513e91c3d4a66 100644 (file)
@@ -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"
index 295dff83dbaa42fd38452868181c721b277ddfdd..02530127a83aa34964802f8d7bff2d00778289e9 100644 (file)
@@ -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"
index cb2909a85450c09924f17cec097e2efdc483862e..334733c4631922bf5e7c539f04b084d054c2277a 100644 (file)
@@ -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"
index acebc11fa67058643420f3a971767bc52a4afb10..c10ba0a65440360869c1ae2e4640dc4dcbb4981a 100644 (file)
@@ -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>
index 4a11dff2f7cc584d389d33caa98a462c5840d98e..6968c5477036481ba647ce8adef9dd1cd1201931 100644 (file)
@@ -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"
index bfe7b5e467f2ea90003f81121f78127c054b4e55..4517c0b2224c080146c9bff09f919c3d198ba23e 100644 (file)
@@ -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"
index b102d034714db645c3421b0d79c15f668509cfa5..1a75b1b21d5ef13c2cd7e61c18773f5992fca97d 100644 (file)
@@ -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"
index 01df861396a9d1775fe2af915e5e2f1bb85ca2da..778df8649d0568f8a4340f82f9c71db57a4c9d9f 100644 (file)
@@ -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"
index 75af3b95057130b944b66645b02a0e92006dd92d..fcf4d9ff646836efee8e63873ee69d2949da8764 100644 (file)
@@ -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"
index 316d6d2583c3a3c1a46aa6beecb61aab27066cca..dc13958b4a80fbac1ad33d6c9f30230fa4674ee7 100644 (file)
@@ -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"
index d5b4b59e5351e075e6e152a5cdc78937768fb54e..d5b8e1195003d50c1a226b0dbb593075c1e063e8 100644 (file)
@@ -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"
index 20f84a15fe915b0c000f825210964b61ccff0bff..6dae0c942e3aab9a07db65698e80489ea0777d53 100644 (file)
@@ -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"
index c7b7058c400a5716a06b7f5b1c2341f806159d57..f41ce7f9142517ca6410d9f9c0d08ae842ed6e95 100644 (file)
@@ -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>
index a031bb51067d55b283319743658b39efddc773b3..ac92e2f74ffd18313d4a90f9c007f34ec417d8e7 100644 (file)
@@ -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"
index 85621249df4429b0db4eca669030d885d440a5d4..49cdcfec11c14680117eb14c58e9a9ebc7c19535 100644 (file)
@@ -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;
index b54cb6e8c9232af03e23fda24c5818f44412359f..5ecea533bb9a8f1e66a0166ad32943daf306237d 100644 (file)
@@ -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"
 
index 735678dd53159521540a6b9cda13c16153f4e3d9..e64e37815adbbd5b076deb0786fdeead248cac0b 100644 (file)
@@ -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"
index 2dd170ab53322d550b7cefac86f22b99471a2b19..62f3f592f7f5f644f7d5d588b0101963e01dfaa7 100644 (file)
@@ -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"
index f0e88babcadea81e0c821ad6515c5e80ff6501c0..129427924e1d44035dd2a2ae92b3e827410ec0bb 100755 (executable)
@@ -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
index cb4b5d29707ded89a7903742e1006b73903f6040..0922ef9a31629aa62062303cc513c6eb7fd001e9 100644 (file)
@@ -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"
index 8fb5bb0b04c259f41c54b6ed0c47301643526463..7fabdab9a02f30fb3cdd897508665772e5a85c0d 100644 (file)
@@ -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
index b6ce398015b4444379d2008b3f24622617a884a9..8b51bf704143b206598096701c4b368f1fd4e46b 100644 (file)
@@ -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"
index 2a3a4a19931bc105f1b9d61ec5110c2fb70430d8..b1f8cbe63121810341f116b7ed069758c9f217b5 100644 (file)
@@ -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"
index b56a159135f5aa9973498c124280a65dafa01127..15f9d99d5c5e361373392890bfb1500abc664b99 100644 (file)
@@ -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"
index e5161d526e1e495d0d6ec4d5ead5dfc229757ad2..64ab2927081b6e94aac47e0d66a2995d49280536 100644 (file)
@@ -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"
index 0d20c53ebfed8535d0c7c89e9c191207ab819ed4..b7d9a9104b0ff41b789595ef961ab55da4844ae2 100644 (file)
@@ -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"
index 9c2efca0932a124e0dd3747ff8f01a62c9d60b4a..9b16d032e317b8e515882a90048772cd1f5f5b07 100644 (file)
@@ -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"
index 505df6aca053c031e43cf4d6092d2de75763bf54..82ad2867b42cf6e52ea64c9eafa62819ba1a550d 100644 (file)
@@ -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"
index 474416b9fe740efec18da0e403876783b322febc..ce74023880791db7f9f9fa12771bb076dc5bcde8 100644 (file)
@@ -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"
index 0f7b2f841c9b5a8fe01bbcc4a316f6d9f4aa1e40..cc1573dbea9765c1711210a3179b84482b08dc80 100644 (file)
@@ -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,
index 09ff38a3d4f164d307d37a2422ef3ca8cbc7762b..34875ca0f20a3d6247b2f7615477d9bf0b9a4201 100644 (file)
@@ -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"
index d62115e942459259bddc91bc6ec739480952734b..a0f8e9549e1a417d70c08a6ea2b3185eae1e53e0 100644 (file)
@@ -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"
index 7259b2199e2398950f5effb0b8311e23326dcfdb..e698ffcc0f6b64cd4414b4032822385f4e1ab20e 100644 (file)
@@ -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"
index c5a79251f7dd318be4b5f103d78f3feadf8df244..738af3173c2a4fdbe7c55012d433bb5428585eb5 100644 (file)
@@ -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"
 
This page took 0.077911 seconds and 4 git commands to generate.