]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
hp300 native support
authorK. Richard Pixley <rich@cygnus>
Wed, 28 Oct 1992 07:08:52 +0000 (07:08 +0000)
committerK. Richard Pixley <rich@cygnus>
Wed, 28 Oct 1992 07:08:52 +0000 (07:08 +0000)
12 files changed:
gdb/.Sanitize
gdb/ChangeLog
gdb/Makefile.in
gdb/config/hp300bsd.mh
gdb/config/hp300bsd.mt
gdb/config/hp300hpux.mh
gdb/config/hp300hpux.mt
gdb/hp300ux-nat.c [new file with mode: 0644]
gdb/nm-hp300bsd.h [new file with mode: 0644]
gdb/nm-hp300hpux.h [new file with mode: 0644]
gdb/xm-hp300bsd.h
gdb/xm-hp300hpux.h

index a61bcd04e00becf06b58eba63b8fc6bc392ddaf5..819413191d448e62f6b9d0e0024f56f0590f56bb 100644 (file)
@@ -95,7 +95,7 @@ go32-xdep.c
 gould-pinsn.c
 gould-xdep.c
 h8300-tdep.c
-hp300ux-xdep.c
+hp300ux-nat.c
 hppa-pinsn.c
 hppab-core.c
 hppab-nat.c
@@ -147,6 +147,8 @@ nindy-tdep.c
 nm-apollo68b.h
 nm-apollo68v.h
 nm-delta88.h
+nm-hp300bsd.h
+nm-hp300hpux.h
 nm-hppab.h
 nm-hppah.h
 nm-i386bsd.h
index b3d282dd4195c6f07ed95fd6c14f072b0c42c462..d7fd3ff367c0019af1d0cf351a914ca740c31b7c 100644 (file)
@@ -1,5 +1,22 @@
 Tue Oct 27 17:08:45 1992  K. Richard Pixley  (rich@cygnus.com)
 
+       hp300 native support (hp300hpux untested).
+
+       * hp300ux-xdep.c: removed.
+       * xm-hp300bsd.h (REGISTER_U_ADDR): removed.
+       * xm-hp300hpux.h: updated copyright.
+         (ATTACH_DETACH, FETCH_INFERIOR_REGISTERS): removed.
+       * nm-hp300bsd.h, nm-hp300hpux.h, hp300ux-nat.c: new files.
+       * Makefile.in (HFILES): added nm-hp300bsd.h and nm-hp300hpux.h.
+       * config/hp300bsd.mh (XDEPFILES): removed infptrace.o inftarg.o
+         fork-child.o coredep.o corelow.o.
+         (NAT_FILE, NATDEPFILES): new macros.
+       * config/hp300bsd.mt (TDEPFILES): removed exec.o.
+       * config/hp300hpux.mh (XDEPFILES): removed infptrace.o inftarg.o
+         fork-child.o.
+         (NAT_FILE, NATDEPFILES): new macros.
+       * config/hp300hpux.mt (TDEPFILES): removed exec.o.
+
        Vax ultrix native support.
 
        * nm-vax.h: new file.
index 920d383ce857388608471f708d58c6e0739542a8..9e0c0c4e7d3d991553035a859344b4fc0e61d711 100644 (file)
@@ -257,7 +257,8 @@ HFILES=     breakpoint.h buildsym.h call-cmds.h command.h defs.h \
        nm-irix4.h nm-linux.h nm-m88k.h nm-mips.h nm-news.h nm-rs6000.h \
        nm-sun2.h nm-sun3.h nm-sun386.h nm-sun4os4.h nm-trash.h \
        nm-ultra3.h nm-hppab.h nm-hppah.h nm-umax.h nm-sysv4.h \
-       nm-apollo68b.h nm-apollo68v.h nm-vax.h
+       nm-apollo68b.h nm-apollo68v.h nm-vax.h nm-hp300bsd.h \
+       nm-hp300hpux.h
 
 REMOTE_EXAMPLES = m68k-stub.c i386-stub.c sparc-stub.c rem-multi.shar
 
index bdc3c4708be4b3fb20100809946d012a6efcd6a7..099203f27fd65f75ba9edbdbd8292b1825a5567b 100644 (file)
@@ -1,3 +1,5 @@
 # Host: Hewlett-Packard 9000 series 300, running BSD
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o corelow.o
+XDEPFILES= 
 XM_FILE= xm-hp300bsd.h
+NAT_FILE= nm-hp300bsd.h
+NATDEPFILES= exec.o infptrace.o inftarg.o fork-child.o coredep.o corelow.o
index 2a730ce4d7666b4810f86c5aeecc81e6c64f4374..7690f09acb36d3793a584f7a13d397a9069a88ca 100644 (file)
@@ -1,3 +1,3 @@
 # Target: Hewlett-Packard 9000 series 300, running BSD
-TDEPFILES= exec.o m68k-pinsn.o m68k-tdep.o
+TDEPFILES= m68k-pinsn.o m68k-tdep.o
 TM_FILE= tm-hp300bsd.h
index 395e4b87ba6053927305334c495e2c7ec4aff22b..7b5bb4c690176e1c1622c4ef24548fd269f67fe3 100644 (file)
@@ -7,8 +7,10 @@
 
 # The headers in the directory hp-include override system headers
 # and tell GDB to use BSD executable file format (hence -Ihp-include)
-XDEPFILES= infptrace.o inftarg.o fork-child.o hp300ux-xdep.o
+XDEPFILES= hp300ux-xdep.o
 XM_FILE= xm-hp300hpux.h
+NAT_FILE= nm-hp300hpux.h
+NATDEPFILES= exec.o infptrace.o inftarg.o fork-child.o 
 SYSV_DEFINE=-DSYSV
 REGEX=regex.o
 REGEX1=regex.o
index d1837ac822bda1e0fef3cc98ed6070d1b8723d8b..a8902cdf22056b76c695acda4a9d79b07e25bd15 100644 (file)
@@ -7,5 +7,5 @@
 # The headers in the directory hp-include override system headers
 # and tell GDB to use BSD executable file format (hence -Ihp-include)
 MT_CFLAGS=-Ihp-include
-TDEPFILES= exec.o m68k-pinsn.o
+TDEPFILES= m68k-pinsn.o
 TM_FILE= tm-hp300hpux.h
diff --git a/gdb/hp300ux-nat.c b/gdb/hp300ux-nat.c
new file mode 100644 (file)
index 0000000..f043acc
--- /dev/null
@@ -0,0 +1,233 @@
+/* HP/UX interface for HP 300's, for GDB when running under Unix.
+   Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+   
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#include "defs.h"
+#include "frame.h"
+#include "inferior.h"
+
+/* Defining this means some system include files define some extra stuff.  */
+#define WOPR
+#include <sys/param.h>
+#include <sys/dir.h>
+#include <signal.h>
+#include <sys/user.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include <sys/ptrace.h>
+#include <sys/reg.h>
+#include <sys/trap.h>
+
+#include "gdbcore.h"
+
+#include <sys/file.h>
+#include <sys/stat.h>
+
+#define INFERIOR_AR0(u)                                                        \
+  ((ptrace                                                             \
+    (PT_RUAREA, inferior_pid,                                          \
+     (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0))         \
+   - KERNEL_U_ADDR)
+
+static void
+fetch_inferior_register (regno, regaddr)
+     register int regno;
+     register unsigned int regaddr;
+{
+#ifndef HPUX_VERSION_5
+  if (regno == PS_REGNUM)
+    {
+      union { int i; short s[2]; } ps_val;
+      int regval;
+      
+      ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+                         0));
+      regval = ps_val.s[0];
+      supply_register (regno, &regval);
+    }
+  else
+#endif /* not HPUX_VERSION_5 */
+    {
+      char buf[MAX_REGISTER_RAW_SIZE];
+      register int i;
+      
+      for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+       {
+         *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid,
+                                    (PTRACE_ARG3_TYPE) regaddr, 0);
+         regaddr += sizeof (int);
+       }
+      supply_register (regno, buf);
+    }
+  return;
+}
+
+static void
+store_inferior_register_1 (regno, regaddr, value)
+     int regno;
+     unsigned int regaddr;
+     int value;
+{
+  errno = 0;
+  ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
+#if 0
+  /* HP-UX randomly sets errno to non-zero for regno == 25.
+     However, the value is correctly written, so ignore errno. */
+  if (errno != 0)
+    {
+      char string_buf[64];
+      
+      sprintf (string_buf, "writing register number %d", regno);
+      perror_with_name (string_buf);
+    }
+#endif
+  return;
+}
+
+static void
+store_inferior_register (regno, regaddr)
+     register int regno;
+     register unsigned int regaddr;
+{
+#ifndef HPUX_VERSION_5
+  if (regno == PS_REGNUM)
+    {
+      union { int i; short s[2]; } ps_val;
+      
+      ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+                         0));
+      ps_val.s[0] = (read_register (regno));
+      store_inferior_register_1 (regno, regaddr, ps_val.i);
+    }
+  else
+#endif /* not HPUX_VERSION_5 */
+    {
+      char buf[MAX_REGISTER_RAW_SIZE];
+      register int i;
+      extern char registers[];
+      
+      for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+       {
+         store_inferior_register_1
+           (regno, regaddr,
+            (*(int *) &registers[(REGISTER_BYTE (regno)) + i]));
+         regaddr += sizeof (int);
+       }
+    }
+  return;
+}
+
+void
+fetch_inferior_registers (regno)
+     int regno;
+{
+  struct user u;
+  register unsigned int ar0_offset;
+  
+  ar0_offset = (INFERIOR_AR0 (u));
+  if (regno == -1)
+    {
+      for (regno = 0; (regno < FP0_REGNUM); regno++)
+       fetch_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno)));
+      for (; (regno < NUM_REGS); regno++)
+       fetch_inferior_register (regno, (FP_REGISTER_ADDR (u, regno)));
+    }
+  else
+    fetch_inferior_register (regno,
+                            (regno < FP0_REGNUM
+                             ? REGISTER_ADDR (ar0_offset, regno)
+                             : FP_REGISTER_ADDR (u, regno)));
+}
+
+/* Store our register values back into the inferior.
+   If REGNO is -1, do this for all registers.
+   Otherwise, REGNO specifies which register (so we can save time).  */
+
+void
+store_inferior_registers (regno)
+     register int regno;
+{
+  struct user u;
+  register unsigned int ar0_offset;
+  extern char registers[];
+
+  if (regno >= FP0_REGNUM)
+    {
+      store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno)));
+      return;
+    }
+  
+  ar0_offset = (INFERIOR_AR0 (u));
+  if (regno >= 0)
+    {
+      store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno)));
+      return;
+    }
+
+  for (regno = 0; (regno < FP0_REGNUM); regno++)
+    store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno)));
+  for (; (regno < NUM_REGS); regno++)
+    store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno)));
+  return;
+}
+
+\f
+/* Take the register values out of a core file and store
+   them where `read_register' will find them.  */
+
+#ifdef HPUX_VERSION_5
+#define e_PS e_regs[PS]
+#define e_PC e_regs[PC]
+#endif /* HPUX_VERSION_5 */
+
+void
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+     char *core_reg_sect;
+     int core_reg_size;
+     int which;
+     unsigned int reg_addr;    /* Unused in this version */
+{
+  int val, regno;
+  struct user u;
+  struct exception_stack *pes = (struct exception_stack *) core_reg_sect;
+#define es (*pes)
+  char *buf;
+
+  if (which == 0) {
+    if (core_reg_size < 
+                 ((char *) &es.e_offset - (char *) &es.e_regs[R0]))
+         error ("Not enough registers in core file");
+    for (regno = 0; (regno < PS_REGNUM); regno++)
+      supply_register (regno, &es.e_regs[regno + R0]);
+    val = es.e_PS;
+    supply_register (regno++, &val);
+    supply_register (regno++, &es.e_PC);
+
+  } else if (which == 2) {
+
+    /* FIXME: This may not work if the float regs and control regs are
+       discontinuous.  */
+    for (regno = FP0_REGNUM, buf = core_reg_sect;
+        (regno < NUM_REGS);
+        buf += REGISTER_RAW_SIZE (regno), regno++)
+      {
+       supply_register (regno, buf);
+      }
+  }
+}
diff --git a/gdb/nm-hp300bsd.h b/gdb/nm-hp300bsd.h
new file mode 100644 (file)
index 0000000..398f36d
--- /dev/null
@@ -0,0 +1,43 @@
+/* Parameters for Hewlett-Packard 9000/300 native support under bsd.
+   Copyright 1986, 1987, 1989, 1991, 1992  Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* This is a piece of magic that is given a register number REGNO
+   and as BLOCKEND the address in the system of the end of the user structure
+   and stores in ADDR the address in the kernel or core dump
+   of that register.  */
+
+#define REGISTER_U_ADDR(addr, blockend, regno)                         \
+{                                                                      \
+  if (regno < PS_REGNUM)                                               \
+    addr = (int) &((struct frame *)(blockend))->f_regs[regno];         \
+  else if (regno == PS_REGNUM)                                         \
+    addr = (int) &((struct frame *)(blockend))->f_stackadj;            \
+  else if (regno == PC_REGNUM)                                         \
+    addr = (int) &((struct frame *)(blockend))->f_pc;                  \
+  else if (regno < FPC_REGNUM)                                         \
+    addr = (int)                                                       \
+      &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\
+  else if (regno == FPC_REGNUM)                                                \
+    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr;       \
+  else if (regno == FPS_REGNUM)                                                \
+    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr;       \
+  else                                                                 \
+    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar;      \
+}
+
diff --git a/gdb/nm-hp300hpux.h b/gdb/nm-hp300hpux.h
new file mode 100644 (file)
index 0000000..060f792
--- /dev/null
@@ -0,0 +1,26 @@
+/* Parameters for native support on HP 9000 model 320, for GDB, the GNU debugger.
+   Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+/* Do implement the attach and detach commands.  */
+
+#define ATTACH_DETACH
+
+/* fetch_inferior_registers is in nat-hp300hpux.c.  */
+#define FETCH_INFERIOR_REGISTERS
+
index 32102d883f349bae52a1674c9b8852a00a1feeeb..c7da7221cb39605640c88ca3095bedcbe87ce1cc 100644 (file)
@@ -37,30 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Get kernel u area address at run-time using BSD style nlist ().  */
 #define KERNEL_U_ADDR_BSD
 
-/* This is a piece of magic that is given a register number REGNO
-   and as BLOCKEND the address in the system of the end of the user structure
-   and stores in ADDR the address in the kernel or core dump
-   of that register.  */
-
-#define REGISTER_U_ADDR(addr, blockend, regno)                         \
-{                                                                      \
-  if (regno < PS_REGNUM)                                               \
-    addr = (int) &((struct frame *)(blockend))->f_regs[regno];         \
-  else if (regno == PS_REGNUM)                                         \
-    addr = (int) &((struct frame *)(blockend))->f_stackadj;            \
-  else if (regno == PC_REGNUM)                                         \
-    addr = (int) &((struct frame *)(blockend))->f_pc;                  \
-  else if (regno < FPC_REGNUM)                                         \
-    addr = (int)                                                       \
-      &((struct user *)0)->u_pcb.pcb_fpregs.fpf_regs[((regno)-FP0_REGNUM)*3];\
-  else if (regno == FPC_REGNUM)                                                \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpcr;       \
-  else if (regno == FPS_REGNUM)                                                \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpsr;       \
-  else                                                                 \
-    addr = (int) &((struct user *)0)->u_pcb.pcb_fpregs.fpf_fpiar;      \
-}
-
 /* Kernel is a bit tenacious about sharing text segments, disallowing bpts.  */
 #define        ONE_PROCESS_WRITETEXT
 \f
index 36790c56bafc423ca898cbed2bd8e3ada7833b52..54979b530a80d52e43281619e39bfd3cbd8bdb84 100644 (file)
@@ -1,5 +1,5 @@
-/* Parameters for execution on an HP 9000 model 320, for GDB, the GNU debugger.
-   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Parameters for HP 9000 model 320 hosting, for GDB, the GNU debugger.
+   Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -25,9 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* Define this to indicate problems with traps after continuing.  */
 #define HP_OS_BUG
 
-/* fetch_inferior_registers is in hp300hpux-dep.c.  */
-#define FETCH_INFERIOR_REGISTERS
-
 /* Set flag to indicate whether HP's assembler is in use. */
 #ifdef __GNUC__
 #ifdef __HPUX_ASM__
@@ -81,10 +78,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
      : (&u.u_pcb.pcb_mc68881[FMC68881_C + ((regno) - FPC_REGNUM)])))   \
    - ((char *) (& u)))
 \f
-/* Do implement the attach and detach commands.  */
-
-#define ATTACH_DETACH
-\f
 /* Interface definitions for kernel debugger KDB.  */
 
 /* Map machine fault codes into signal numbers.