aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/.Sanitize4
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/Makefile.in3
-rw-r--r--gdb/config/hp300bsd.mh4
-rw-r--r--gdb/config/hp300bsd.mt2
-rw-r--r--gdb/config/hp300hpux.mh4
-rw-r--r--gdb/config/hp300hpux.mt2
-rw-r--r--gdb/hp300ux-nat.c233
-rw-r--r--gdb/nm-hp300bsd.h43
-rw-r--r--gdb/nm-hp300hpux.h26
-rw-r--r--gdb/xm-hp300bsd.h24
-rw-r--r--gdb/xm-hp300hpux.h11
12 files changed, 334 insertions, 39 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize
index a61bcd0..8194131 100644
--- a/gdb/.Sanitize
+++ b/gdb/.Sanitize
@@ -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
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b3d282d..d7fd3ff 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 920d383..9e0c0c4 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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
diff --git a/gdb/config/hp300bsd.mh b/gdb/config/hp300bsd.mh
index bdc3c47..099203f 100644
--- a/gdb/config/hp300bsd.mh
+++ b/gdb/config/hp300bsd.mh
@@ -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
diff --git a/gdb/config/hp300bsd.mt b/gdb/config/hp300bsd.mt
index 2a730ce..7690f09 100644
--- a/gdb/config/hp300bsd.mt
+++ b/gdb/config/hp300bsd.mt
@@ -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
diff --git a/gdb/config/hp300hpux.mh b/gdb/config/hp300hpux.mh
index 395e4b8..7b5bb4c 100644
--- a/gdb/config/hp300hpux.mh
+++ b/gdb/config/hp300hpux.mh
@@ -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
diff --git a/gdb/config/hp300hpux.mt b/gdb/config/hp300hpux.mt
index d1837ac..a8902cd 100644
--- a/gdb/config/hp300hpux.mt
+++ b/gdb/config/hp300hpux.mt
@@ -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
index 0000000..f043acc
--- /dev/null
+++ b/gdb/hp300ux-nat.c
@@ -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;
+}
+
+
+/* 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
index 0000000..398f36d
--- /dev/null
+++ b/gdb/nm-hp300bsd.h
@@ -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
index 0000000..060f792
--- /dev/null
+++ b/gdb/nm-hp300hpux.h
@@ -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
+
diff --git a/gdb/xm-hp300bsd.h b/gdb/xm-hp300bsd.h
index 32102d8..c7da722 100644
--- a/gdb/xm-hp300bsd.h
+++ b/gdb/xm-hp300bsd.h
@@ -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
diff --git a/gdb/xm-hp300hpux.h b/gdb/xm-hp300hpux.h
index 36790c5..54979b5 100644
--- a/gdb/xm-hp300hpux.h
+++ b/gdb/xm-hp300hpux.h
@@ -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)))
-/* Do implement the attach and detach commands. */
-
-#define ATTACH_DETACH
-
/* Interface definitions for kernel debugger KDB. */
/* Map machine fault codes into signal numbers.