From 9fa283782e3deddc1801ce554562318953279f0c Mon Sep 17 00:00:00 2001
From: John Gilmore <gnu@cygnus>
Date: Thu, 22 Aug 1991 01:42:18 +0000
Subject: HP 300 BSD port for machines at FSF.  Also minor mips change.

---
 gdb/ChangeLog      | 19 +++++++++++++++++++
 gdb/i960-tdep.c    |  4 ++--
 gdb/mcheck.c       | 10 ++--------
 gdb/remote-nindy.c |  6 +++---
 gdb/tm-68k.h       |  6 +++---
 gdb/tm-hp300bsd.h  |  4 ++--
 gdb/tm-i960.h      |  8 ++++----
 gdb/xm-hp300bsd.h  | 11 ++++++++---
 8 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c9d222f..63db43a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+Wed Aug 21 18:21:09 1991  John Gilmore  (gnu at cygint.cygnus.com)
+
+	* infptrace.c (KERNEL_U_ADDR_BSD):  Include a.out.gnu.h.
+	* i960-tdep.c, m68k-tdep.c, sparc-tdep.c, tm-i960.h,
+	tm-m68k.h, remote-nindy.c:  Change ext_format_XXX structs
+	to single structures rather than arrays; when passing
+	their address, use &.  This avoids trouble with bdead compilers.
+	* mcheck.c: Don't include <stdlib.h>; just declare "void abort();"
+	instead.  This avoids portability headaches.
+	* mips-tdep.c (mips_do_registers_info):  Only print FP regs if
+	asked to.
+	* source.c (open_source_file):  Avoid ANSI const bdeath by 
+	skipping declaration and then casting result value.
+	* tm-hp300bsd.h:  Clarify comment.
+	* utils.c (strstr):  Result is const char *; ANSI bdeath.
+	* xm-hp300bsd.h:  Define HOST_BYTE_ORDER.  Redefine INT_MIN,
+	since system include file defines it differently from "defs.h",
+	though the two are equivalent for our purposes.
+
 Tue Aug 20 16:01:11 1991  John Gilmore  (gnu at cygint.cygnus.com)
 
 	* tconfig/sun*4:  Remove warnings about system assembler.
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index d72bd75..27fde37 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -34,9 +34,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 /* Structure of i960 extended floating point format.  */
 
-const struct ext_format ext_format_i960 [] = {
+const struct ext_format ext_format_i960 = {
 /* tot sbyte smask expbyte manbyte */
- { 12, 9,    0x80, 9,8,	   4,0  },		/* i960 */
+   12, 9,    0x80, 9,8,	   4,0,		/* i960 */
 };
 
 /* gdb960 is always running on a non-960 host.  Check its characteristics.
diff --git a/gdb/mcheck.c b/gdb/mcheck.c
index 611a378..309fcfd 100755
--- a/gdb/mcheck.c
+++ b/gdb/mcheck.c
@@ -20,7 +20,6 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "ansidecl.h"
-#include <stdlib.h>
 #include "gmalloc.h"
 
 /* Old hook values.  */
@@ -28,14 +27,9 @@ static void EXFUN((*old_free_hook), (PTR ptr));
 static PTR EXFUN((*old_malloc_hook), (size_t size));
 static PTR EXFUN((*old_realloc_hook), (PTR ptr, size_t size));
 
-/* FIXME.  We cannot *declare* abort() as either being void or being
-   int, because if the system declares it as the other, we get a fatal
-   error.  It's senseless to configure the system for whether abort is
-   void or int.  So we simply fail to declare it, which works on all
-   systems, but might produce a warning on yours.  Please ignore the warning
-   and raise your middle finger in the general direction of the ANSI C
-   committee in tribute.  */
+
 /* Function to call when something awful happens. */
+extern void abort();
 static void EXFUN((*abortfunc), (void)) = (void (*)()) abort;
 
 /* Arbitrary magical numbers.  */
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index e8b2160..34bb3d2 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -130,7 +130,7 @@ extern void generic_mourn_inferior ();
 extern struct target_ops nindy_ops;
 extern jmp_buf to_top_level;
 extern FILE *instream;
-extern struct ext_format ext_format_i960[];	/* i960-tdep.c */
+extern struct ext_format ext_format_i960;	/* i960-tdep.c */
 
 extern char ninStopWhy ();
 
@@ -495,7 +495,7 @@ nindy_fetch_registers(regno)
 			 &nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)],
 			 &inv);
     /* dub now in host byte order */
-    double_to_ieee_extended (ext_format_i960, &dub,
+    double_to_ieee_extended (&ext_format_i960, &dub,
 			     &registers[REGISTER_BYTE (regnum)]);
   }
 
@@ -524,7 +524,7 @@ nindy_store_registers(regno)
   bcopy (&registers[REGISTER_BYTE (TCW_REGNUM)], nindy_regs.tcw,         1*4);
   /* Float regs.  Only works on IEEE_FLOAT hosts.  */
   for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) {
-    ieee_extended_to_double (ext_format_i960,
+    ieee_extended_to_double (&ext_format_i960,
 			     &registers[REGISTER_BYTE (regnum)], &dub);
     /* dub now in host byte order */
     /* FIXME-someday, the arguments to unpack_double are backward.
diff --git a/gdb/tm-68k.h b/gdb/tm-68k.h
index 3afbdf2..ee471c0 100644
--- a/gdb/tm-68k.h
+++ b/gdb/tm-68k.h
@@ -149,7 +149,7 @@ read_memory_integer (read_register (SP_REGNUM), 4)
 
 /* Put the declaration out here because if it's in the macros, PCC
    will complain.  */
-extern struct ext_format ext_format_68881 [];
+extern struct ext_format ext_format_68881;
 
 /* Convert data from raw format for register REGNUM
    to virtual format for register REGNUM.  */
@@ -157,7 +157,7 @@ extern struct ext_format ext_format_68881 [];
 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)	\
 { \
   if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM)	\
-    ieee_extended_to_double (ext_format_68881, (FROM), (TO));	\
+    ieee_extended_to_double (&ext_format_68881, (FROM), (double *)(TO)); \
   else					\
     bcopy ((FROM), (TO), 4);	\
 }
@@ -168,7 +168,7 @@ extern struct ext_format ext_format_68881 [];
 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)	\
 { \
   if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM)	\
-    double_to_ieee_extended (ext_format_68881, (FROM), (TO));	\
+    double_to_ieee_extended (&ext_format_68881, (double *)(FROM), (TO)); \
   else					\
     bcopy ((FROM), (TO), 4);	\
 }
diff --git a/gdb/tm-hp300bsd.h b/gdb/tm-hp300bsd.h
index 1e662b3..dccbc7d 100644
--- a/gdb/tm-hp300bsd.h
+++ b/gdb/tm-hp300bsd.h
@@ -1,5 +1,5 @@
-/* Parameters for execution on a Hewlett-Packard 9000/300, running bsd.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Parameters for target machine Hewlett-Packard 9000/300, running bsd.
+   Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
diff --git a/gdb/tm-i960.h b/gdb/tm-i960.h
index 0b8785f..8c3116b 100644
--- a/gdb/tm-i960.h
+++ b/gdb/tm-i960.h
@@ -175,10 +175,10 @@ extern CORE_ADDR saved_pc_after_call ();
 
 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)     \
 { \
-  extern struct ext_format ext_format_i960[];		\
+  extern struct ext_format ext_format_i960;		\
   \
   if ((REGNUM) >= FP0_REGNUM)   \
-    ieee_extended_to_double (ext_format_i960, (FROM), (TO));     \
+    ieee_extended_to_double (&ext_format_i960, (FROM), (double *)(TO));     \
   else                                  \
     bcopy ((FROM), (TO), 4);	\
 }
@@ -188,10 +188,10 @@ extern CORE_ADDR saved_pc_after_call ();
 
 #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
 { \
-  extern struct ext_format ext_format_i960[];		\
+  extern struct ext_format ext_format_i960;		\
   \
   if ((REGNUM) >= FP0_REGNUM)   \
-    double_to_ieee_extended (ext_format_i960, (FROM), (TO));     \
+    double_to_ieee_extended (&ext_format_i960, (double *)(FROM), (TO));     \
   else                                  \
     bcopy ((FROM), (TO), 4); 	\
 }
diff --git a/gdb/xm-hp300bsd.h b/gdb/xm-hp300bsd.h
index 42b5662..fbbef6f 100644
--- a/gdb/xm-hp300bsd.h
+++ b/gdb/xm-hp300bsd.h
@@ -1,5 +1,5 @@
-/* Parameters for execution on a Hewlett-Packard 9000/300, running bsd.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Parameters for hosting on a Hewlett-Packard 9000/300, running bsd.
+   Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -23,7 +23,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  * Problems to hpbsd-bugs@cs.utah.edu
  */
 
-#include <machine/endian.h>
+#define	HOST_BYTE_ORDER	BIG_ENDIAN
+
+/* Avoid "INT_MIN redefined" warnings -- by defining it here, exactly
+   the same as in the system <machine/machtypes.h> file.  */
+#undef	INT_MIN
+#define	INT_MIN		0x80000000
 
 /* Get rid of any system-imposed stack limit if possible.  */
 
-- 
cgit v1.1