aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/.Sanitize5
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/config/decstation.mh4
-rw-r--r--gdb/config/irix3.mh4
-rw-r--r--gdb/config/irix4.mh6
-rw-r--r--gdb/irix4-nat.c126
-rw-r--r--gdb/mips-nat.c165
-rw-r--r--gdb/mips-tdep.c171
-rw-r--r--gdb/nm-irix3.h24
-rw-r--r--gdb/nm-irix4.h31
-rw-r--r--gdb/nm-mips.h23
-rw-r--r--gdb/procfs.c2
-rw-r--r--gdb/xm-irix3.h4
-rw-r--r--gdb/xm-irix4.h16
-rw-r--r--gdb/xm-mips.h3
15 files changed, 461 insertions, 149 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize
index ce88acb..a3c9e42 100644
--- a/gdb/.Sanitize
+++ b/gdb/.Sanitize
@@ -116,6 +116,7 @@ inflow.c
infptrace.c
infrun.c
inftarg.c
+irix4-nat.c
kdb-start.c
language.c
language.h
@@ -132,14 +133,16 @@ maint.c
mem-break.c
minimon.h
minsyms.c
+mips-nat.c
mips-pinsn.c
mips-tdep.c
-mips-xdep.c
mipsread.c
munch
news-xdep.c
nindy-share
nindy-tdep.c
+nm-irix4.h
+nm-mips.h
nm-rs6000.h
nm-sun3.h
nm-sun4os4.h
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 06469cf..f476bbb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+Fri Oct 9 00:31:33 1992 K. Richard Pixley (rich@sendai.cygnus.com)
+
+ Mips native support. Decstation and iris4 have been tested.
+ Iris3 has not.
+
+ * mips-tdep.c (supply_gregset, fill_gregset, supply_fpregset,
+ fill_fpregset): removed to irix4-nat.c
+ * mips-xdep.c: removed.
+ * irix4-nat.c, mips-nat.c, nm-irix3.h, nm-irix4.h, nm-mips.h: new
+ files.
+ * procfs.c: include nm.h.
+ * xm-irix3.h (U_REGS_OFFSET, FETCH_INFERIOR_REGISTERS): removed.
+ * xm-irix4.h: bump copyright.
+ (U_REGS_OFFSET, FETCH_INFERIOR_REGISTERS, USE_PROC_FS,
+ PROC_NAME_FMT): removed.
+ * xm-mips.h (FETCH_INFERIOR_REGISTERS): removed.
+ * config/irix4.mh (XDEPFILES): removed procfs.o fork-child.o.
+ (NAT_FILE, NATDEPFILES): new macros for native support.
+ (CC): supply default compiler switches.
+ * config/irix3.mh (XDEPFILES): removed infptrace.o inftarg.o fork-child.o coredep.o.
+ (NAT_FILE, NATDEPFILES): new macros for native support. Note that
+ irix3 is untested.
+ * config/decstation.mh (XDEPFILES): removed infptrace.o inftarg.o
+ fork-child.o mips-xdep.o coredep.o.
+ (NAT_FILE, NATDEPFILES): new macros for native support.
+
Thu Oct 8 23:50:51 1992 K. Richard Pixley (rich@sendai.cygnus.com)
* config/rs6000.mh (XDEPFILES): removed fork-child.o.
diff --git a/gdb/config/decstation.mh b/gdb/config/decstation.mh
index 4a71ca2..28da9e3 100644
--- a/gdb/config/decstation.mh
+++ b/gdb/config/decstation.mh
@@ -1,6 +1,8 @@
# Host: Little-endian MIPS machine such as DECstation.
-XDEPFILES= infptrace.o inftarg.o fork-child.o mips-xdep.o coredep.o
+XDEPFILES=
XM_FILE= xm-mips.h
+NAT_FILE= nm-mips.h
+NATDEPFILES= infptrace.o inftarg.o coredep.o mips-nat.o fork-child.o
# We can't use MMALLOC because the DECstation RPC library can't cope
# with a malloc(0) that returns 0. Besides, it's useless on a machine
diff --git a/gdb/config/irix3.mh b/gdb/config/irix3.mh
index d585d92..854272d 100644
--- a/gdb/config/irix3.mh
+++ b/gdb/config/irix3.mh
@@ -1,6 +1,8 @@
# Host: SGI Iris running irix 3.x
-XDEPFILES= infptrace.o inftarg.o fork-child.o coredep.o
+XDEPFILES=
XM_FILE= xm-irix3.h
+NAT_FILE= nm-irix3.h
+NATDEPFILES= fork-child.o coredep.o infptrace.o inftarg.o nat-mips.o
ALLOCA=alloca.o
ALLOCA1=alloca.o
MUNCH_DEFINE=-B
diff --git a/gdb/config/irix4.mh b/gdb/config/irix4.mh
index fcea27e..854fa69 100644
--- a/gdb/config/irix4.mh
+++ b/gdb/config/irix4.mh
@@ -1,8 +1,12 @@
# Host: SGI Iris running irix 4.x
-XDEPFILES= procfs.o fork-child.o
+XDEPFILES=
XM_FILE= xm-irix4.h
+NAT_FILE= nm-irix4.h
+NATDEPFILES= fork-child.o procfs.o irix4-nat.o
ALLOCA=alloca.o
ALLOCA1=alloca.o
MUNCH_DEFINE=-B
XM_CLIBS=-lbsd -lsun
INSTALL = cp
+# use cc in K&R mode, bump up some static compiler tables.
+CC = cc -cckr -Wf,-XNg1500 -Wf,-XNk1000 -Wf,-XNh1100
diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c
new file mode 100644
index 0000000..5127bc2
--- /dev/null
+++ b/gdb/irix4-nat.c
@@ -0,0 +1,126 @@
+/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
+ Copyright 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
+ and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
+
+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"
+
+/*
+ * Implemented for Irix 4.x by Garrett A. Wollman
+ */
+
+#include <sys/time.h>
+#include <sys/procfs.h>
+
+typedef unsigned int greg_t; /* why isn't this defined? */
+
+/*
+ * See the comment in m68k-tdep.c regarding the utility of these functions.
+ */
+
+void
+supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+{
+ register int regi;
+ register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
+
+ /* FIXME: somewhere, there should be a #define for the meaning
+ of this magic number 32; we should use that. */
+ for(regi = 0; regi < 32; regi++)
+ supply_register (regi, (char *)(regp + regi));
+
+ supply_register (PC_REGNUM, (char *)&(gregsetp->gp_pc));
+ supply_register (HI_REGNUM, (char *)&(gregsetp->gp_mdhi));
+ supply_register (LO_REGNUM, (char *)&(gregsetp->gp_mdlo));
+ supply_register (PS_REGNUM, (char *)&(gregsetp->gp_cause));
+}
+
+void
+fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+{
+ int regi;
+ register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
+ extern char registers[];
+
+ /* same FIXME as above wrt 32*/
+ for (regi = 0; regi < 32; regi++)
+ if ((regno == -1) || (regno == regi))
+ *(regp + regi) = *(greg_t *) &registers[REGISTER_BYTE (regi)];
+
+ if ((regno == -1) || (regno == PC_REGNUM))
+ gregsetp->gp_pc = *(greg_t *) &registers[REGISTER_BYTE (PC_REGNUM)];
+
+ if ((regno == -1) || (regno == PS_REGNUM))
+ gregsetp->gp_cause = *(greg_t *) &registers[REGISTER_BYTE (PS_REGNUM)];
+
+ if ((regno == -1) || (regno == HI_REGNUM))
+ gregsetp->gp_mdhi = *(greg_t *) &registers[REGISTER_BYTE (HI_REGNUM)];
+
+ if ((regno == -1) || (regno == LO_REGNUM))
+ gregsetp->gp_mdlo = *(greg_t *) &registers[REGISTER_BYTE (LO_REGNUM)];
+}
+
+/*
+ * Now we do the same thing for floating-point registers.
+ * We don't bother to condition on FP0_REGNUM since any
+ * reasonable MIPS configuration has an R3010 in it.
+ *
+ * Again, see the comments in m68k-tdep.c.
+ */
+
+void
+supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+{
+ register int regi;
+
+ for (regi = 0; regi < 32; regi++)
+ supply_register (FP0_REGNUM + regi,
+ (char *)&fpregsetp->fp_r.fp_regs[regi]);
+
+ supply_register (FCRCS_REGNUM, (char *)&fpregsetp->fp_csr);
+
+ /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
+}
+
+void
+fill_fpregset (fpregsetp, regno)
+ fpregset_t *fpregsetp;
+ int regno;
+{
+ int regi;
+ char *from, *to;
+ extern char registers[];
+
+ for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
+ {
+ if ((regno == -1) || (regno == regi))
+ {
+ from = (char *) &registers[REGISTER_BYTE (regi)];
+ to = (char *) &(fpregsetp->fp_r.fp_regs[regi]);
+ bcopy(from, to, REGISTER_RAW_SIZE (regi));
+ }
+ }
+
+ if ((regno == -1) || (regno == FCRCS_REGNUM))
+ fpregsetp->fp_csr = *(unsigned *) &registers[REGISTER_BYTE(FCRCS_REGNUM)];
+}
diff --git a/gdb/mips-nat.c b/gdb/mips-nat.c
new file mode 100644
index 0000000..458f91f
--- /dev/null
+++ b/gdb/mips-nat.c
@@ -0,0 +1,165 @@
+/* Low level MIPS interface to ptrace, for GDB when running under Unix.
+ Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
+ Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
+ and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
+
+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 "inferior.h"
+#include "gdbcore.h"
+
+/* For now we stub this out; sgi core format is super-hairy (and completely
+ different in the new release).
+ For most mips systems, this function is defined in coredep.c. */
+
+#if defined(sgi)
+void
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ unsigned int reg_addr;
+{
+ return;
+}
+#endif
+
+/* Access to the inferior is only good for native systems, not cross.
+ I am not sure why this is stubbed out on SGI... --gnu@cygnus.com */
+
+#if defined(sgi) || !defined(GDB_TARGET_IS_MIPS)
+
+/* ARGSUSED */
+void
+fetch_inferior_registers (regno)
+ int regno;
+{
+ return;
+}
+
+/* ARGSUSED */
+void
+store_inferior_registers (regno)
+ int regno;
+{
+ return;
+}
+
+
+#else
+
+/* DECstation native... */
+
+#include <sys/ptrace.h>
+
+/* Map gdb internal register number to ptrace ``address''.
+ These ``addresses'' are defined in DECstation <sys/ptrace.h> */
+
+#define REGISTER_PTRACE_ADDR(regno) \
+ (regno < 32 ? GPR_BASE + regno \
+ : regno == PC_REGNUM ? PC \
+ : regno == CAUSE_REGNUM ? CAUSE \
+ : regno == HI_REGNUM ? MMHI \
+ : regno == LO_REGNUM ? MMLO \
+ : regno == FCRCS_REGNUM ? FPC_CSR \
+ : regno == FCRIR_REGNUM ? FPC_EIR \
+ : regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) \
+ : 0)
+
+static const char zerobuf[MAX_REGISTER_RAW_SIZE];
+
+/* Get all registers from the inferior */
+
+void
+fetch_inferior_registers (regno)
+ int regno;
+{
+ register unsigned int regaddr;
+ char buf[MAX_REGISTER_RAW_SIZE];
+ register int i;
+
+ registers_fetched ();
+
+ for (regno = 1; regno < NUM_REGS; regno++)
+ {
+ regaddr = REGISTER_PTRACE_ADDR (regno);
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ {
+ *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
+ regaddr += sizeof (int);
+ }
+ supply_register (regno, buf);
+ }
+
+ supply_register (ZERO_REGNUM, zerobuf);
+ /* Frame ptr reg must appear to be 0; it is faked by stack handling code. */
+ supply_register (FP_REGNUM, zerobuf);
+}
+
+/* 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)
+ int regno;
+{
+ register unsigned int regaddr;
+ char buf[80];
+
+ if (regno == 0)
+ return;
+
+ if (regno > 0)
+ {
+ regaddr = REGISTER_PTRACE_ADDR (regno);
+ errno = 0;
+ ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
+ if (errno != 0)
+ {
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
+ else
+ {
+ for (regno = 0; regno < NUM_REGS; regno++)
+ {
+ if (regno == ZERO_REGNUM || regno == PS_REGNUM
+ || regno == BADVADDR_REGNUM || regno == CAUSE_REGNUM
+ || regno == FCRIR_REGNUM || regno == FP_REGNUM
+ || (regno >= FIRST_EMBED_REGNUM && regno <= LAST_EMBED_REGNUM))
+ continue;
+ regaddr = register_addr (regno, 1);
+ errno = 0;
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
+ if (errno != 0)
+ {
+ sprintf (buf, "writing all regs, number %d", regno);
+ perror_with_name (buf);
+ }
+ }
+ }
+}
+
+#endif /* sgi */
+
+
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c7e6547..c4bf929 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -165,6 +165,8 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
if (start_pc == 0) return NULL;
bzero(&temp_proc_desc, sizeof(temp_proc_desc));
bzero(&temp_saved_regs, sizeof(struct frame_saved_regs));
+ PROC_LOW_ADDR(&temp_proc_desc) = start_pc;
+
if (start_pc + 200 < limit_pc) limit_pc = start_pc + 200;
restart:
frame_size = 0;
@@ -172,7 +174,7 @@ heuristic_proc_desc(start_pc, limit_pc, next_frame)
unsigned long word;
int status;
- status = read_memory_nobpt (cur_pc, &word, 4);
+ status = read_memory_nobpt (cur_pc, (char *)&word, 4);
if (status) memory_error (status, cur_pc);
SWAP_TARGET_AND_HOST (&word, sizeof (word));
if ((word & 0xFFFF0000) == 0x27bd0000) /* addiu $sp,$sp,-i */
@@ -320,13 +322,16 @@ init_extra_frame_info(fci)
/* r0 bit means kernel trap */
int kernel_trap = PROC_REG_MASK(proc_desc) & 1;
- /* Fixup frame-pointer - only needed for top frame */
- /* This may not be quite right, if procedure has a real frame register */
- if (fci->pc == PROC_LOW_ADDR(proc_desc))
- fci->frame = read_register (SP_REGNUM);
- else
+ if (fci->frame == 0)
+ {
+ /* Fixup frame-pointer - only needed for top frame */
+ /* This may not be quite right, if proc has a real frame register */
+ if (fci->pc == PROC_LOW_ADDR(proc_desc))
+ fci->frame = read_register (SP_REGNUM);
+ else
fci->frame = READ_FRAME_REG(fci, PROC_FRAME_REG(proc_desc))
- + PROC_FRAME_OFFSET(proc_desc);
+ + PROC_FRAME_OFFSET(proc_desc);
+ }
if (proc_desc == &temp_proc_desc)
*fci->saved_regs = temp_saved_regs;
@@ -366,6 +371,29 @@ init_extra_frame_info(fci)
}
}
+/* MIPS stack frames are almost impenetrable. When execution stops,
+ we basically have to look at symbol information for the function
+ that we stopped in, which tells us *which* register (if any) is
+ the base of the frame pointer, and what offset from that register
+ the frame itself is at.
+
+ This presents a problem when trying to examine a stack in memory
+ (that isn't executing at the moment), using the "frame" command. We
+ don't have a PC, nor do we have any registers except SP.
+
+ This routine takes two arguments, SP and PC, and tries to make the
+ cached frames look as if these two arguments defined a frame on the
+ cache. This allows the rest of info frame to extract the important
+ arguments without difficulty. */
+
+FRAME
+setup_arbitrary_frame (stack, pc)
+ FRAME_ADDR stack;
+ CORE_ADDR pc;
+{
+ return create_new_frame (stack, pc);
+}
+
CORE_ADDR
mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
@@ -405,8 +433,8 @@ mips_push_arguments(nargs, args, sp, struct_return, struct_addr)
write_memory(sp + m_arg->offset, m_arg->contents, m_arg->len);
if (struct_return) {
buf = struct_addr;
- write_memory(sp, &buf, sizeof(CORE_ADDR));
-}
+ write_memory(sp, (char *)&buf, sizeof(CORE_ADDR));
+ }
return sp;
}
@@ -464,7 +492,7 @@ mips_push_dummy_frame()
if (PROC_REG_MASK(proc_desc) & (1 << ireg))
{
buffer = read_register (ireg);
- write_memory (save_address, &buffer, sizeof(REGISTER_TYPE));
+ write_memory (save_address, (char *)&buffer, sizeof(REGISTER_TYPE));
save_address -= 4;
}
/* save floating-points registers */
@@ -473,20 +501,20 @@ mips_push_dummy_frame()
if (PROC_FREG_MASK(proc_desc) & (1 << ireg))
{
buffer = read_register (ireg + FP0_REGNUM);
- write_memory (save_address, &buffer, 4);
+ write_memory (save_address, (char *)&buffer, 4);
save_address -= 4;
}
write_register (PUSH_FP_REGNUM, sp);
PROC_FRAME_REG(proc_desc) = PUSH_FP_REGNUM;
PROC_FRAME_OFFSET(proc_desc) = 0;
buffer = read_register (PC_REGNUM);
- write_memory (sp - 4, &buffer, sizeof(REGISTER_TYPE));
+ write_memory (sp - 4, (char *)&buffer, sizeof(REGISTER_TYPE));
buffer = read_register (HI_REGNUM);
- write_memory (sp - 8, &buffer, sizeof(REGISTER_TYPE));
+ write_memory (sp - 8, (char *)&buffer, sizeof(REGISTER_TYPE));
buffer = read_register (LO_REGNUM);
- write_memory (sp - 12, &buffer, sizeof(REGISTER_TYPE));
+ write_memory (sp - 12, (char *)&buffer, sizeof(REGISTER_TYPE));
buffer = read_register (FCRCS_REGNUM);
- write_memory (sp - 16, &buffer, sizeof(REGISTER_TYPE));
+ write_memory (sp - 16, (char *)&buffer, sizeof(REGISTER_TYPE));
sp -= 4 * (GEN_REG_SAVE_COUNT+FLOAT_REG_SAVE_COUNT+SPECIAL_REG_SAVE_COUNT);
write_register (SP_REGNUM, sp);
PROC_LOW_ADDR(proc_desc) = sp - CALL_DUMMY_SIZE + CALL_DUMMY_START_OFFSET;
@@ -500,7 +528,7 @@ mips_pop_frame()
{ register int regnum;
FRAME frame = get_current_frame ();
CORE_ADDR new_sp = frame->frame;
- mips_extra_func_info_t proc_desc = (mips_extra_func_info_t)frame->proc_desc;
+ mips_extra_func_info_t proc_desc = frame->proc_desc;
if (PROC_DESC_IS_DUMMY(proc_desc))
{
struct linked_proc_info **ptr = &linked_proc_desc_table;;
@@ -529,10 +557,10 @@ mips_pop_frame()
}
static void
-mips_print_register(regnum, all)
+mips_print_register (regnum, all)
int regnum, all;
{
- unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE];
+ unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE * 2]; /* *2 for doubles */
REGISTER_TYPE val;
/* Get the data in raw format. */
@@ -649,113 +677,6 @@ isa_NAN(p, len)
else return 1;
}
-/*
- * Implemented for Irix 4.x by Garrett A. Wollman
- */
-#ifdef USE_PROC_FS /* Target-dependent /proc support */
-
-#include <sys/time.h>
-#include <sys/procfs.h>
-
-typedef unsigned int greg_t; /* why isn't this defined? */
-
-/*
- * See the comment in m68k-tdep.c regarding the utility of these functions.
- */
-
-void
-supply_gregset (gregsetp)
- gregset_t *gregsetp;
-{
- register int regno;
- register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
-
- /* FIXME: somewhere, there should be a #define for the meaning
- of this magic number 32; we should use that. */
- for(regno = 0; regno < 32; regno++)
- supply_register (regno, (char *)(regp + regno));
-
- supply_register (PC_REGNUM, (char *)&(gregsetp->gp_pc));
- supply_register (HI_REGNUM, (char *)&(gregsetp->gp_mdhi));
- supply_register (LO_REGNUM, (char *)&(gregsetp->gp_mdlo));
- supply_register (PS_REGNUM, (char *)&(gregsetp->gp_cause));
-}
-
-void
-fill_gregset (gregsetp, regno)
- gregset_t *gregsetp;
- int regno;
-{
- int regi;
- register greg_t *regp = (greg_t *)(gregsetp->gp_regs);
- extern char registers[];
-
- /* same FIXME as above wrt 32*/
- for (regi = 0; regi < 32; regi++)
- if ((regno == -1) || (regno == regi))
- *(regp + regno) = *(greg_t *) &registers[REGISTER_BYTE (regi)];
-
- if ((regno == -1) || (regno == PC_REGNUM))
- gregsetp->gp_pc = *(greg_t *) &registers[REGISTER_BYTE (PC_REGNUM)];
-
- if ((regno == -1) || (regno == PS_REGNUM))
- gregsetp->gp_cause = *(greg_t *) &registers[REGISTER_BYTE (PS_REGNUM)];
-
- if ((regno == -1) || (regno == HI_REGNUM))
- gregsetp->gp_mdhi = *(greg_t *) &registers[REGISTER_BYTE (HI_REGNUM)];
-
- if ((regno == -1) || (regno == LO_REGNUM))
- gregsetp->gp_mdlo = *(greg_t *) &registers[REGISTER_BYTE (LO_REGNUM)];
-}
-
-/*
- * Now we do the same thing for floating-point registers.
- * We don't bother to condition on FP0_REGNUM since any
- * reasonable MIPS configuration has an R3010 in it.
- *
- * Again, see the comments in m68k-tdep.c.
- */
-
-void
-supply_fpregset (fpregsetp)
- fpregset_t *fpregsetp;
-{
- register int regno;
-
- for (regno = 0; regno < 32; regno++)
- supply_register (FP0_REGNUM + regno,
- (char *)&fpregsetp->fp_r.fp_regs[regno]);
-
- supply_register (FCRCS_REGNUM, (char *)&fpregsetp->fp_csr);
-
- /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
-}
-
-void
-fill_fpregset (fpregsetp, regno)
- fpregset_t *fpregsetp;
- int regno;
-{
- int regi;
- char *from, *to;
- extern char registers[];
-
- for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
- {
- if ((regno == -1) || (regno == regi))
- {
- from = (char *) &registers[REGISTER_BYTE (regi)];
- to = (char *) &(fpregsetp->fp_r.fp_regs[regi]);
- bcopy(from, to, REGISTER_RAW_SIZE (regno));
- }
- }
-
- if ((regno == -1) || (regno == FCRCS_REGNUM))
- fpregsetp->fp_csr = *(unsigned *) &registers[REGISTER_BYTE(FCRCS_REGNUM)];
-}
-
-#endif /* USE_PROC_FS */
-
/* To skip prologues, I use this predicate. Returns either PC
itself if the code at PC does not look like a function prologue,
PC+4 if it does (our caller does not need anything more fancy). */
diff --git a/gdb/nm-irix3.h b/gdb/nm-irix3.h
new file mode 100644
index 0000000..fcf98a2
--- /dev/null
+++ b/gdb/nm-irix3.h
@@ -0,0 +1,24 @@
+/* Definitions for irix3 native support.
+
+Copyright (C) 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. */
+
+/* Don't need special routines for the SGI -- we can use infptrace.c */
+#undef FETCH_INFERIOR_REGISTERS
+
+#define U_REGS_OFFSET 0
diff --git a/gdb/nm-irix4.h b/gdb/nm-irix4.h
new file mode 100644
index 0000000..340dade
--- /dev/null
+++ b/gdb/nm-irix4.h
@@ -0,0 +1,31 @@
+/* Definitions for native support of irix4.
+
+Copyright (C) 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. */
+
+/*
+ * Let's use /debug instead of all this dangerous mucking about
+ * with ptrace(), which seems *extremely* fragile, anyway.
+ */
+#define USE_PROC_FS
+#define PROC_NAME_FMT "/debug/%d"
+
+/* Don't need special routines for the SGI -- we can use infptrace.c */
+#undef FETCH_INFERIOR_REGISTERS
+
+#define U_REGS_OFFSET 0
diff --git a/gdb/nm-mips.h b/gdb/nm-mips.h
new file mode 100644
index 0000000..4a264fe
--- /dev/null
+++ b/gdb/nm-mips.h
@@ -0,0 +1,23 @@
+/* Definitions for GDB on mips.
+ Copyright (C) 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
+ Contributed by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin
+ and by Alessandro Forin(af@cs.cmu.edu) at CMU
+
+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 copies of {fetch,store}_inferior_registers in infptrace.c. */
+#define FETCH_INFERIOR_REGISTERS
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1a694e0..dfab0ba 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -45,6 +45,8 @@ regardless of whether or not the actual target has floating point hardware.
#include "command.h"
#include "gdbcore.h"
+#include "nm.h"
+
#define MAX_SYSCALLS 256 /* Maximum number of syscalls for table */
#ifndef PROC_NAME_FMT
diff --git a/gdb/xm-irix3.h b/gdb/xm-irix3.h
index e155a41..f12855e 100644
--- a/gdb/xm-irix3.h
+++ b/gdb/xm-irix3.h
@@ -20,8 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_TERMIO
-#define U_REGS_OFFSET 0
-
#include "xm-bigmips.h"
/* Override register locations in upage for SGI machines */
@@ -32,5 +30,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
else \
addr = regno + NSIG_HNDLRS; /* Skip over signal handlers */
-/* Don't need special routines for the SGI -- we can use infptrace.c */
-#undef FETCH_INFERIOR_REGISTERS
diff --git a/gdb/xm-irix4.h b/gdb/xm-irix4.h
index 21ee98f..7a21cf5 100644
--- a/gdb/xm-irix4.h
+++ b/gdb/xm-irix4.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
+/* Definitions for irix4 hosting support.
+
+Copyright (C) 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,8 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HAVE_TERMIO
-#define U_REGS_OFFSET 0
-
#include "xm-bigmips.h"
/* Override register locations in upage for SGI machines */
@@ -32,17 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
else \
addr = regno + NSIG_HNDLRS; /* Skip over signal handlers */
-/* Don't need special routines for the SGI -- we can use infptrace.c */
-#undef FETCH_INFERIOR_REGISTERS
-
/* BEGIN GW MODS */
-/*
- * Let's use /debug instead of all this dangerous mucking about
- * with ptrace(), which seems *extremely* fragile, anyway.
- */
-#define USE_PROC_FS
-#define PROC_NAME_FMT "/debug/%d"
-
/* Irix defines psignal() in signal.h, which gets gcc rather angry at us
* because their definition is markedly different.
*/
diff --git a/gdb/xm-mips.h b/gdb/xm-mips.h
index 6a8a5bb..030d472 100644
--- a/gdb/xm-mips.h
+++ b/gdb/xm-mips.h
@@ -61,8 +61,5 @@ extern void *memset();
sizeof (int) * (regno - FP0_REGNUM); \
}
-/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */
-#define FETCH_INFERIOR_REGISTERS
-
/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */
#define ONE_PROCESS_WRITETEXT