* hp300ux-nat.c: Cast second arg to supply_register calls.
authorJim Kingdon <jkingdon@engr.sgi.com>
Wed, 28 Apr 1993 21:20:40 +0000 (21:20 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Wed, 28 Apr 1993 21:20:40 +0000 (21:20 +0000)
(_initialize_kernel_u_addr, getpagesize): New functions.
(store_inferior_register_1): Change arg name from value to val.
(fetch_core_registers): Make arg core_reg_size unsigned.
Pass 5 args to ptrace.
* config/m68k/xm-hp300hpux.h: Define FIVE_ARG_PTRACE.
Remove KERNEL_U_ADDR stuff.
* infptrace.c [FIVE_ARG_PTRACE]: Pass 5th arg to ptrace.
* config/m68k/hp300hpux.m{t,h}:
Move exec.o from NATDEPFILES to TDEPFILES
* config/m68k/hp300hpux.mt: Mention GAS requirement.  Remove
hp-include stuff.  Add m68k-tdep.o to TDEPFILES.

gdb/ChangeLog
gdb/config/m68k/hp300hpux.mh
gdb/config/m68k/hp300hpux.mt
gdb/config/m68k/xm-hp300hpux.h
gdb/hp300ux-nat.c
gdb/infptrace.c

index 4c6a7f4374c96a4d6cf4d7fdd3fb2a2a1fbcb08e..9b0952318ff6da33e7ab178728edee5b3411aa04 100644 (file)
@@ -1,3 +1,18 @@
+Wed Apr 28 06:11:38 1993  Jim Kingdon  (kingdon@cygnus.com)
+
+       * hp300ux-nat.c: Cast second arg to supply_register calls.
+       (_initialize_kernel_u_addr, getpagesize): New functions.
+       (store_inferior_register_1): Change arg name from value to val.
+       (fetch_core_registers): Make arg core_reg_size unsigned.
+       Pass 5 args to ptrace.
+       * config/m68k/xm-hp300hpux.h: Define FIVE_ARG_PTRACE.
+       Remove KERNEL_U_ADDR stuff.
+       * infptrace.c [FIVE_ARG_PTRACE]: Pass 5th arg to ptrace.
+       * config/m68k/hp300hpux.m{t,h}:
+       Move exec.o from NATDEPFILES to TDEPFILES
+       * config/m68k/hp300hpux.mt: Mention GAS requirement.  Remove
+       hp-include stuff.  Add m68k-tdep.o to TDEPFILES.
+
 Wed Apr 28 13:27:54 1993  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
 
        * ch-exp.y (yylex): Don't STREQ with simplename if it is NULL.
index 43e27a3c50b72db23540d0db1dd38a65ce727bda..825311f49094697713f4b892f7f1d81e72edaba6 100644 (file)
@@ -7,7 +7,7 @@
 
 XM_FILE= xm-hp300hpux.h
 NAT_FILE= nm-hp300hpux.h
-NATDEPFILES= exec.o infptrace.o inftarg.o fork-child.o hp300ux-nat.o
+NATDEPFILES= infptrace.o inftarg.o fork-child.o hp300ux-nat.o
 SYSV_DEFINE=-DSYSV
 REGEX=regex.o
 REGEX1=regex.o
index a8902cdf22056b76c695acda4a9d79b07e25bd15..2a53b4bfc3fa78e2e6a25338513aac70b88783fb 100644 (file)
@@ -1,11 +1,8 @@
 # Target: Hewlett-Packard 9000 series 300, running HPUX
 
 #msg Note that GDB can only read symbols from programs that were
-#msg compiled with GCC
+#msg compiled with GCC using GAS.
 #msg
 
-# 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= m68k-pinsn.o
+TDEPFILES= exec.o m68k-pinsn.o m68k-tdep.o
 TM_FILE= tm-hp300hpux.h
index 54979b530a80d52e43281619e39bfd3cbd8bdb84..8edc0e0d34b3b8e57ef701da6192477aaaa63e6f 100644 (file)
@@ -17,11 +17,16 @@ 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.  */
 
-/* HP/UX is USG, but it does have <ptrace.h>  */
-#include <sys/ptrace.h>
-
 #define HOST_BYTE_ORDER BIG_ENDIAN
 
+/* HPUX 8.0, in its infinite wisdom, has chosen to prototype ptrace
+   with five arguments, so programs written for normal ptrace lose.
+
+   Idiots.
+
+   (They should have just made it varadic).  */
+#define FIVE_ARG_PTRACE
+
 /* Define this to indicate problems with traps after continuing.  */
 #define HP_OS_BUG
 
@@ -53,16 +58,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 /* So we'll just have to avoid big alloca's.  */
 #define BROKEN_LARGE_ALLOCA
 
-/* This is the amount to subtract from u.u_ar0
-   to get the offset in the core file of the register values.  */
-
-#ifdef HPUX_VERSION_5
-#define KERNEL_U_ADDR 0x00979000
-#else /* Not HPUX version 5.  */
-/* Use HPUX-style nlist() to get kernel_u_addr.  */
-#define KERNEL_U_ADDR_HPUX
-#endif /* Not HPUX version 5.  */
-
 #define REGISTER_ADDR(u_ar0, regno)                                    \
   (unsigned int)                                                       \
   (((regno) < PS_REGNUM)                                               \
index 05590551771bb27aae3e268814eccdb1c8ef20f8..0f392ab0f9b5afd682b463f1e180ee9c2b412578 100644 (file)
@@ -39,11 +39,35 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <sys/file.h>
 #include <sys/stat.h>
 
+/* Get kernel_u_addr using HPUX-style nlist().  */
+CORE_ADDR kernel_u_addr;
+
+struct hpnlist {
+        char *          n_name;
+        long            n_value;
+        unsigned char   n_type;
+        unsigned char   n_length;
+        short           n_almod;
+        short           n_unused;
+};
+static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }};
+
+/* read the value of the u area from the hp-ux kernel */
+void _initialize_kernel_u_addr ()
+{
+#ifndef HPUX_VERSION_5
+    nlist ("/hp-ux", nl);
+    kernel_u_addr = nl[0].n_value;
+#else /* HPUX version 5.  */
+    kernel_u_addr = (CORE_ADDR) 0x0097900;
+#endif
+}
+
 #define INFERIOR_AR0(u)                                                        \
   ((ptrace                                                             \
     (PT_RUAREA, inferior_pid,                                          \
-     (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0))         \
-   - KERNEL_U_ADDR)
+     (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0, 0))              \
+   - kernel_u_addr)
 
 static void
 fetch_inferior_register (regno, regaddr)
@@ -57,9 +81,9 @@ fetch_inferior_register (regno, regaddr)
       int regval;
       
       ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-                         0));
+                         0, 0));
       regval = ps_val.s[0];
-      supply_register (regno, &regval);
+      supply_register (regno, (char *)&regval);
     }
   else
 #endif /* not HPUX_VERSION_5 */
@@ -70,7 +94,7 @@ fetch_inferior_register (regno, regaddr)
       for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
        {
          *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid,
-                                    (PTRACE_ARG3_TYPE) regaddr, 0);
+                                    (PTRACE_ARG3_TYPE) regaddr, 0, 0);
          regaddr += sizeof (int);
        }
       supply_register (regno, buf);
@@ -79,13 +103,13 @@ fetch_inferior_register (regno, regaddr)
 }
 
 static void
-store_inferior_register_1 (regno, regaddr, value)
+store_inferior_register_1 (regno, regaddr, val)
      int regno;
      unsigned int regaddr;
-     int value;
+     int val;
 {
   errno = 0;
-  ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
+  ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, val, 0);
 #if 0
   /* HP-UX randomly sets errno to non-zero for regno == 25.
      However, the value is correctly written, so ignore errno. */
@@ -111,7 +135,7 @@ store_inferior_register (regno, regaddr)
       union { int i; short s[2]; } ps_val;
       
       ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
-                         0));
+                         0, 0));
       ps_val.s[0] = (read_register (regno));
       store_inferior_register_1 (regno, regaddr, ps_val.i);
     }
@@ -199,7 +223,7 @@ store_inferior_registers (regno)
 void
 fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
      char *core_reg_sect;
-     int core_reg_size;
+     unsigned int core_reg_size;
      int which;
      unsigned int reg_addr;    /* Unused in this version */
 {
@@ -214,10 +238,10 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
                  ((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]);
+      supply_register (regno, (char *) &es.e_regs[regno + R0]);
     val = es.e_PS;
-    supply_register (regno++, &val);
-    supply_register (regno++, &es.e_PC);
+    supply_register (regno++, (char *) &val);
+    supply_register (regno++, (char *) &es.e_PC);
 
   } else if (which == 2) {
 
@@ -231,3 +255,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
       }
   }
 }
+
+int
+getpagesize ()
+{
+  return 4096;
+}
index f97d2c32f9805e9818380782900890f78dd4af4e..aafbd85f64f42f0edd9f89b366b992410489c280 100644 (file)
@@ -22,8 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "inferior.h"
 #include "target.h"
 
-#include "nm.h"
-
 #ifdef USG
 #include <sys/types.h>
 #endif
@@ -33,11 +31,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <signal.h>
 #include <sys/ioctl.h>
 
+#ifndef NO_PTRACE_H
 #ifdef PTRACE_IN_WRONG_PLACE
 #include <ptrace.h>
 #else
 #include <sys/ptrace.h>
 #endif
+#endif /* NO_PTRACE_H */
 
 #if !defined (PT_KILL)
 #define PT_KILL 8
@@ -64,6 +64,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #endif
 #include <sys/stat.h>
 
+#if defined (FIVE_ARG_PTRACE
+/* Deal with HPUX 8.0 braindamage.  */
+#define ptrace(a,b,c,d) ptrace(a,b,c,d,0)
+#endif
+
 #if !defined (FETCH_INFERIOR_REGISTERS)
 #include <sys/user.h>          /* Probably need to poke the user structure */
 #if defined (KERNEL_U_ADDR_BSD)
@@ -133,10 +138,6 @@ child_resume (step, signal)
 }
 \f
 #ifdef ATTACH_DETACH
-/* Nonzero if we are debugging an attached process rather than
-   an inferior.  */
-extern int attach_flag;
-
 /* Start debugging the process whose number is PID.  */
 int
 attach (pid)
This page took 0.07108 seconds and 4 git commands to generate.