* solib.c: *BSD systems need <a.out.h> to be included before
authorJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 23 Sep 1994 22:30:31 +0000 (22:30 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 23 Sep 1994 22:30:31 +0000 (22:30 +0000)
  <link.h>.

* i386b-nat.c: Add i386_float_info(), etc.
* config/i386/nm-nbsd.h: #define FLOAT_INFO.

* config/nm-nbsd.h: New file, for generic NetBSD native support.
* config/i386/nm-nbsd.h: Use it.
* config/sparc/nm-nbsd.h: Use it.
* config/ns32k/nm-nbsd.h: Use it.

* configure.in (i386-*-netbsd): Use config/i386/nbsd.m[ht].
  (ns32k-*-netbsd): Use config/ns32k/nbsd.m[ht].
* config/i386/{nbsd.mh,nbsd.mt,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}:
  New files, support for NetBSD/i386.
* config/ns32k/{nbsd.mh,nbsd.mh,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}:
  New files, support for NetBSD/ns32k.

16 files changed:
gdb/ChangeLog
gdb/config/.Sanitize
gdb/config/i386/.Sanitize
gdb/config/i386/nbsd.mh [new file with mode: 0644]
gdb/config/i386/nm-nbsd.h [new file with mode: 0644]
gdb/config/i386/tm-nbsd.h [new file with mode: 0644]
gdb/config/i386/xm-nbsd.h [new file with mode: 0644]
gdb/config/ns32k/.Sanitize
gdb/config/ns32k/nbsd.mh [new file with mode: 0644]
gdb/config/ns32k/nbsd.mt [new file with mode: 0644]
gdb/config/ns32k/nm-nbsd.h [new file with mode: 0644]
gdb/config/ns32k/tm-nbsd.h [new file with mode: 0644]
gdb/config/ns32k/xm-nbsd.h [new file with mode: 0644]
gdb/config/sparc/nm-nbsd.h
gdb/configure.in
gdb/i386b-nat.c

index 0bc137eeb2bbc17f67ca2742009a3ca8e4bd7ada..3724eff0092df63f10bb1ded138b939ac1017d95 100644 (file)
@@ -1,5 +1,27 @@
+Fri Sep 23 14:58:49 1994  J.T. Conklin  (jtc@rtl.cygnus.com)
+
+       * solib.c: *BSD systems need <a.out.h> to be included before
+         <link.h>.
+
+       * i386b-nat.c: Add i386_float_info(), etc.
+       * config/i386/nm-nbsd.h: #define FLOAT_INFO.
+
+       * config/nm-nbsd.h: New file, for generic NetBSD native support.
+       * config/i386/nm-nbsd.h: Use it.
+       * config/sparc/nm-nbsd.h: Use it.
+       * config/ns32k/nm-nbsd.h: Use it.
+
+       * configure.in (i386-*-netbsd): Use config/i386/nbsd.m[ht].
+         (ns32k-*-netbsd): Use config/ns32k/nbsd.m[ht].
+       * config/i386/{nbsd.mh,nbsd.mt,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}:
+         New files, support for NetBSD/i386.
+       * config/ns32k/{nbsd.mh,nbsd.mh,nm-nbsd.h,tm-nbsd.h,xm-nbsd.h}:
+         New files, support for NetBSD/ns32k.
+
 Tue Sep 20 11:34:27 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
+       * .gdbinit: Add list-objfiles command.
+
        * TODO: Reword item regarding NO_STD_REGS.
 
        * coffread.c (record_minimal_symbol, coff_read_enum_type,
index c8eb93d0acca44be5eebf3df1479bad262034957..27a7a3c3a1c9ddf22dc0c20a55e98a240be4c48a 100644 (file)
@@ -38,6 +38,7 @@ mips
 nm-empty.h
 nm-lynx.h
 nm-m3.h
+nm-nbsd.h
 nm-sysv4.h
 none
 ns32k
index ad0592822da099e287cff8a64bd245a56ae638ec..5c2f3a74eee4146983f2440a69c573edf83baf3d 100644 (file)
@@ -50,6 +50,8 @@ i386v4.mh
 i386v4.mt
 linux.mh
 linux.mt
+nbsd.mh
+nbsd.mt
 ncr3000.mh
 ncr3000.mt
 nm-i386aix.h
@@ -83,6 +85,7 @@ tm-i386os9k.h
 tm-i386v.h
 tm-i386v4.h
 tm-linux.h
+tm-nbsd.h
 tm-ptx.h
 tm-ptx4.h
 tm-sun386.h
@@ -99,6 +102,7 @@ xm-i386v.h
 xm-i386v32.h
 xm-i386v4.h
 xm-linux.h
+xm-nbsd.h
 xm-ptx.h
 xm-ptx4.h
 xm-sun386.h
diff --git a/gdb/config/i386/nbsd.mh b/gdb/config/i386/nbsd.mh
new file mode 100644 (file)
index 0000000..0a3cfca
--- /dev/null
@@ -0,0 +1,7 @@
+# Host: Intel 386 running NetBSD
+XDEPFILES= 
+NATDEPFILES= exec.o fork-child.o infptrace.o inftarg.o corelow.o coredep.o i386b-nat.o
+XM_FILE= xm-nbsd.h
+NAT_FILE= nm-nbsd.h
+REGEX=regex.o
+REGEX1=regex.o
diff --git a/gdb/config/i386/nm-nbsd.h b/gdb/config/i386/nm-nbsd.h
new file mode 100644 (file)
index 0000000..44257d6
--- /dev/null
@@ -0,0 +1,34 @@
+/* Native-dependent definitions for Intel 386 running NetBSD, for GDB.
+   Copyright 1986, 1987, 1989, 1992, 1994 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifndef NM_NBSD_H
+#define NM_NBSD_H
+
+/* Get generic NetBSD native definitions. */
+#include "nm-nbsd.h"
+
+#define FLOAT_INFO     { i386_float_info(); }
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+       (addr) = i386_register_u_addr ((blockend),(regno));
+
+extern int
+i386_register_u_addr PARAMS ((int, int));
+
+#endif /* NM_NBSD_H */
diff --git a/gdb/config/i386/tm-nbsd.h b/gdb/config/i386/tm-nbsd.h
new file mode 100644 (file)
index 0000000..7cb2b87
--- /dev/null
@@ -0,0 +1,26 @@
+/* Macro definitions for Sparc running under NetBSD.
+   Copyright 1994 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifndef TM_NBSD_H
+#define TM_NBSD_H
+
+#include "i386/tm-i386bsd.h"
+#include "tm-nbsd.h"
+
+#endif /* TM_NBSD_H */
diff --git a/gdb/config/i386/xm-nbsd.h b/gdb/config/i386/xm-nbsd.h
new file mode 100644 (file)
index 0000000..5ba6700
--- /dev/null
@@ -0,0 +1,21 @@
+/* Parameters for execution on a i386 running NetBSD, for GDB.
+   Copyright 1994 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* Get generic NetBSD host definitions. */
+#include "xm-nbsd.h"
index 69b0407b5996d711062b3f68e78877e6689aa87c..7ae6862c9fa7e32618a35be3280ecfecb676c495 100644 (file)
@@ -23,21 +23,25 @@ Things-to-keep:
 
 merlin.mh
 merlin.mt
+nbsd.mh
+nbsd.mt
+nm-nbsd.h
 nm-umax.h
 ns32km3.mh
 ns32km3.mt
 tm-merlin.h
+tm-nbsd.h
 tm-ns32km3.h
 tm-umax.h
 umax.mh
 umax.mt
 xm-merlin.h
+xm-nbsd.h
 xm-ns32km3.h
 xm-umax.h
 
 Things-to-lose:
 
-
 Do-last:
 
 # End of file.
diff --git a/gdb/config/ns32k/nbsd.mh b/gdb/config/ns32k/nbsd.mh
new file mode 100644 (file)
index 0000000..f9cc72a
--- /dev/null
@@ -0,0 +1,4 @@
+# Host: PC532 running NetBSD
+XM_FILE= xm-nbsd.h
+NAT_FILE= nm-nbsd.h
+NATDEPFILES= exec.o fork-child.o infptrace.o inftarg.o corelow.o coredep.o ns32k-nat.o
diff --git a/gdb/config/ns32k/nbsd.mt b/gdb/config/ns32k/nbsd.mt
new file mode 100644 (file)
index 0000000..0a18632
--- /dev/null
@@ -0,0 +1,3 @@
+# Target: PC532 running NetBSD
+TDEPFILES= exec.o ns32k-tdep.o ns32k-pinsn.o solib.o
+TM_FILE= tm-nbsd.h
diff --git a/gdb/config/ns32k/nm-nbsd.h b/gdb/config/ns32k/nm-nbsd.h
new file mode 100644 (file)
index 0000000..d22218c
--- /dev/null
@@ -0,0 +1,36 @@
+/* Native-dependent definitions for ns32k running NetBSD, for GDB.
+   Copyright 1986, 1987, 1989, 1992, 1994 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#ifndef NM_NBSD_H
+#define NM_NBSD_H
+
+/* Get generic NetBSD native definitions. */
+#include "nm-nbsd.h"
+
+#if 0
+#define FLOAT_INFO     { extern ns32k_float_info(); ns32k_float_info(); }
+#endif
+
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+       (addr) = ns32k_register_u_addr ((blockend),(regno));
+
+extern int
+ns32k_register_u_addr PARAMS ((int, int));
+
+#endif /* NM_NBSD_H */
diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h
new file mode 100644 (file)
index 0000000..871a153
--- /dev/null
@@ -0,0 +1,38 @@
+/* Macro definitions for ns32k running under NetBSD.
+   Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* Override number of expected traps from sysv. */
+#define START_INFERIOR_TRAPS_EXPECTED 2
+
+/* Most definitions from umax could be used. */
+#define INVALID_FLOAT(p, s) isa_NAN(p, s)
+#include "ns32k/tm-umax.h"
+#include "tm-nbsd.h"
+
+/* Saved Pc.  Get it from sigcontext if within sigtramp.  */
+
+/* Offset to saved PC in sigcontext, from <machine/signal.h>.  */
+#define SIGCONTEXT_PC_OFFSET 20
+
+#undef FRAME_SAVED_PC(FRAME)
+#define FRAME_SAVED_PC(FRAME) \
+  (((FRAME)->signal_handler_caller \
+    ? sigtramp_saved_pc (FRAME) \
+    : read_memory_integer ((FRAME)->frame + 4, 4)) \
+   )
diff --git a/gdb/config/ns32k/xm-nbsd.h b/gdb/config/ns32k/xm-nbsd.h
new file mode 100644 (file)
index 0000000..b601f0e
--- /dev/null
@@ -0,0 +1,21 @@
+/* Parameters for execution on a ns32k running NetBSD, for GDB.
+   Copyright 1994 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* Get generic NetBSD host definitions. */
+#include "xm-nbsd.h"
index 83d918e4182a5eb686fca9de7ca81cacd769230b..9116d1d7f790a60d0c10f07faa2f38f89ffd0853 100644 (file)
@@ -20,15 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #ifndef NM_NBSD_H
 #define NM_NBSD_H
 
-/* This is the amount to subtract from u.u_ar0
-   to get the offset in the core file of the register values.  */
-
-#include <machine/vmparam.h>
-#define KERNEL_U_ADDR USRSTACK
-
-#define PTRACE_ARG3_TYPE char*
-
-#define ATTACH_DETACH
+/* Get generic NetBSD native definitions. */
+#include "nm-nbsd.h"
 
 #define FETCH_INFERIOR_REGISTERS
 
index ddb37b8a0b586a2f751b55ad1b63fbed2af30ad9..a07bf32f42998ce42c0fc24b232d25d4f44a8609 100644 (file)
@@ -111,6 +111,7 @@ none-*-*)           gdb_host=none ;;
 np1-*-*)               gdb_host=np1 ;;
 
 ns32k-*-mach3*)                gdb_host=mach3 ;;
+ns32k-*-netbsd*)       gdb_host=nbsd ;;
 ns32k-umax-*)          gdb_host=umax ;;
 ns32k-utek-sysv*)      gdb_host=merlin ;;
 
@@ -299,6 +300,7 @@ none-*-*)           gdb_target=none ;;
 np1-*-*)               gdb_target=np1 ;;
 
 ns32k-*-mach3*)                gdb_target=mach3 ;;
+ns32k-*-netbsd*)       gdb_target=nbsd ;;
 ns32k-utek-sysv*)      gdb_target=merlin ;;
 ns32k-utek-*)          gdb_target=umax ;;
 
index 0bcde9c121e8b5425ae9eda63403b49c37132b19..beff646311d9ab2c3ae81cf72b9bc95b62252d43 100644 (file)
@@ -1,5 +1,5 @@
 /* Native-dependent code for BSD Unix running on i386's, for GDB.
-   Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1988, 1989, 1991, 1992, 1994 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -69,3 +69,157 @@ i386_register_u_addr (blockend, regnum)
   else
     return (blockend + 4 * sregmap[regnum]);
 }
+
+
+#ifdef FLOAT_INFO
+#include "floatformat.h"
+
+#include <sys/param.h>
+#include <sys/dir.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include <a.out.h>
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/uio.h>
+#define curpcb Xcurpcb /* XXX avoid leaking declaration from pcb.h */
+#include <sys/user.h>
+#undef curpcb
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/ptrace.h>
+
+extern void print_387_control_word ();         /* i387-tdep.h */
+extern void print_387_status_word ();
+
+#define        fpstate         save87
+#define        U_FPSTATE(u)    u.u_pcb.pcb_savefpu
+
+struct env387 
+{
+  unsigned short control;
+  unsigned short r0;
+  unsigned short status;
+  unsigned short r1;
+  unsigned short tag;
+  unsigned short r2;
+  unsigned long eip;
+  unsigned short code_seg;
+  unsigned short opcode;
+  unsigned long operand;
+  unsigned short operand_seg;
+  unsigned short r3;
+  unsigned char regs[8][10];
+};
+
+static
+print_387_status (status, ep)
+     unsigned short status;
+     struct env387 *ep;
+{
+  int i;
+  int bothstatus;
+  int top;
+  int fpreg;
+  unsigned char *p;
+  
+  bothstatus = ((status != 0) && (ep->status != 0));
+  if (status != 0) 
+    {
+      if (bothstatus)
+       printf_unfiltered ("u: ");
+      print_387_status_word ((unsigned int)status);
+    }
+  
+  if (ep->status != 0) 
+    {
+      if (bothstatus)
+       printf_unfiltered ("e: ");
+      print_387_status_word ((unsigned int)ep->status);
+    }
+  
+  print_387_control_word ((unsigned int)ep->control);
+  printf_unfiltered ("last exception: ");
+  printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
+  printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
+  printf_unfiltered ("%s; ", local_hex_string(ep->eip));
+  printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg));
+  printf_unfiltered (":%s\n", local_hex_string(ep->operand));
+
+  top = (ep->status >> 11) & 7;
+  
+  printf_unfiltered ("regno     tag  msb              lsb  value\n");
+  for (fpreg = 7; fpreg >= 0; fpreg--) 
+    {
+      double val;
+      
+      printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : "  ", fpreg); 
+
+      switch ((ep->tag >> (fpreg * 2)) & 3) 
+       {
+       case 0: printf_unfiltered ("valid "); break;
+       case 1: printf_unfiltered ("zero  "); break;
+       case 2: printf_unfiltered ("trap  "); break;
+       case 3: printf_unfiltered ("empty "); break;
+       }
+      for (i = 9; i >= 0; i--)
+       printf_unfiltered ("%02x", ep->regs[fpreg][i]);
+      
+      floatformat_to_double(&floatformat_i387_ext, (char *) ep->regs[fpreg], 
+                             &val);
+      printf_unfiltered ("  %g\n", val);
+    }
+}
+
+i386_float_info ()
+{
+  struct user u; /* just for address computations */
+  int i;
+  /* fpstate defined in <sys/user.h> */
+  struct fpstate *fpstatep;
+  char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
+  unsigned int uaddr;
+  char fpvalid;
+  unsigned int rounded_addr;
+  unsigned int rounded_size;
+  /*extern int corechan;*/
+  int skip;
+  extern int inferior_pid;
+  
+  uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
+  if (inferior_pid) 
+    {
+      int *ip;
+      
+      rounded_addr = uaddr & -sizeof (int);
+      rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
+                     sizeof (int) - 1) / sizeof (int);
+      skip = uaddr - rounded_addr;
+      
+      ip = (int *)buf;
+      for (i = 0; i < rounded_size; i++) 
+       {
+         *ip++ = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
+         rounded_addr += sizeof (int);
+       }
+    } 
+  else 
+    {
+      printf("float info: can't do a core file (yet)\n");
+      return;
+#if 0
+      if (lseek (corechan, uaddr, 0) < 0)
+       perror_with_name ("seek on core file");
+      if (myread (corechan, buf, sizeof (struct fpstate)) < 0) 
+       perror_with_name ("read from core file");
+      skip = 0;
+#endif
+    }
+  
+  print_387_status (0, (struct env387 *)buf);
+}
+
+#endif
This page took 0.035023 seconds and 4 git commands to generate.