+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.
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
/* 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) \
#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)
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, ®val);
+ supply_register (regno, (char *)®val);
}
else
#endif /* not HPUX_VERSION_5 */
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);
}
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. */
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);
}
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 */
{
((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) {
}
}
}
+
+int
+getpagesize ()
+{
+ return 4096;
+}
#include "inferior.h"
#include "target.h"
-#include "nm.h"
-
#ifdef USG
#include <sys/types.h>
#endif
#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
#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)
}
\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)