mh-decstation
mh-delta88
mh-dgux
+mh-irix4
mh-sco
mh-sysv
mh-sysv4
--- /dev/null
+# Makefile changes for SGI's running IRIX-4.x.
+# Tell compiler to use K&R C. We can't compile under the SGI Ansi environment.
+CC = cc -cckr
+SYSV = -DSYSV
+RANLIB = echo >/dev/null
case "${host_os}" in
m88kbcs) host_makefile_frag=config/mh-delta88;;
sysv4*) host_makefile_frag=config/mh-sysv4 ;;
-sysv* | irix*) host_makefile_frag=config/mh-sysv ;;
+sysv* | irix3) host_makefile_frag=config/mh-sysv ;;
+irix4) host_makefile_frag=config/mh-irix4 ;;
ultrix*)
case "${host_cpu}" in
mips) host_makefile_frag=config/mh-decstation ;;
xm-i386v4.h
xm-i386v32.h
xm-irix3.h
+xm-irix4.h
xm-isi.h
xm-m68k.h
xm-merlin.h
mh-i386v32
mh-i386v32-g
mh-irix3
+mh-irix4
mh-isi
mh-littlemips
mh-m88k
-# Target: Big-endian MIPS machine such as Sony News
+# Target: SGI mips
TDEPFILES= mips-pinsn.o mips-tdep.o mipsread.o exec.o
TM_FILE= tm-irix3.h
--- /dev/null
+# Host: SGI Iris running irix 4.x
+XDEPFILES= procfs.o coredep.o
+XM_FILE= xm-irix4.h
+ALLOCA=alloca.o
+ALLOCA1=alloca.o
+MUNCH_DEFINE=-B
+XM_CLIBS=-lbsd
sony) gdb_host=bigmips ;;
dec) gdb_host=decstation ;;
little) gdb_host=littlemips ;;
- sgi) gdb_host=irix3 ;;
+ sgi)
+ case "${host_os}" in
+ sysv) gdb_host=irix3 ;;
+ irix4) gdb_host=irix4 ;;
+ esac
+ ;;
esac
;;
#include <signal.h>
#include <sys/ioctl.h>
+#ifdef sgi
+/* Must do it this way only for SGIs, as other mips platforms get their
+ JB_ symbols from machine/pcb.h (included via sys/user.h). */
+#include <setjmp.h>
+#endif
+
#include "gdbcore.h"
#ifndef MIPSMAGIC
}
else return 1;
}
+\f
+/*
+ * 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 *) ®isters[REGISTER_BYTE (regi)];
+
+ if ((regno == -1) || (regno == PC_REGNUM))
+ gregsetp->gp_pc = *(greg_t *) ®isters[REGISTER_BYTE (PC_REGNUM)];
+
+ if ((regno == -1) || (regno == PS_REGNUM))
+ gregsetp->gp_cause = *(greg_t *) ®isters[REGISTER_BYTE (PS_REGNUM)];
+
+ if ((regno == -1) || (regno == HI_REGNUM))
+ gregsetp->gp_mdhi = *(greg_t *) ®isters[REGISTER_BYTE (HI_REGNUM)];
+
+ if ((regno == -1) || (regno == LO_REGNUM))
+ gregsetp->gp_mdlo = *(greg_t *) ®isters[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 *) ®isters[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 *) ®isters[REGISTER_BYTE(FCRCS_REGNUM)];
+}
+
+#endif /* USE_PROC_FS */
+\f
/* 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). */
/* Procedures next, note we need to look-ahead to
find out where the procedure's code ends */
- for (i = 0; i < fh->cpd-1; i++) {
+ if (fh->cpd > 0)
+ for (i = 0; i < fh->cpd-1; i++) {
pr = (PDR *) (IPDFIRST(cur_hdr, fh)) + i;
parse_procedure(pr, pr[1].adr); /* next proc up */
- }
+ }
if (fh->cpd) {
pr = (PDR *) (IPDFIRST(cur_hdr, fh)) + i;
parse_procedure(pr, bound); /* next file up */
#ifdef USE_PROC_FS /* Entire file goes away if not using /proc */
+#include <time.h>
#include <sys/procfs.h>
#include <fcntl.h>
#include <errno.h>
_exit (127);
}
premptyset (&exitset);
+
+/*
+ * GW: Rationale...
+ * Not all systems with /proc have all the exec* syscalls with the same
+ * names. On the SGI, for example, there is no SYS_exec, but there
+ * *is* a SYS_execv. So, we try to account for that.
+ */
+#ifdef SYS_exec
praddset (&exitset, SYS_exec);
+#endif
+#ifdef SYS_execve
praddset (&exitset, SYS_execve);
+#endif
+#ifdef SYS_execv
+ praddset(&exitset, SYS_execv);
+#endif
+
if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
{
perror (procname);
{
statval = (what << 8) | 0177;
}
- else if ((why == PR_SYSEXIT) &&
- (what == SYS_exec || what == SYS_execve))
+ else if ((why == PR_SYSEXIT)
+ &&
+ (
+#ifdef SYS_exec
+ what == SYS_exec
+#else
+ 0 == 0
+#endif
+#ifdef SYS_execve
+ || what == SYS_execve
+#endif
+#ifdef SYS_execv
+ || what == SYS_execv
+#endif
+ ))
{
statval = (SIGTRAP << 8) | 0177;
}
extern int
sig_number PARAMS ((const char *));
+#ifndef PSIGNAL_IN_SIGNAL_H
/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
a colon, and followed by a newline. */
extern void
psignal PARAMS ((unsigned, const char *));
+#endif
#endif /* !defined (SIGNAME_H) */
to be actual register numbers as far as the user is concerned
but do serve to get the desired values when passed to read_register. */
+#define A0_REGNUM 4 /* Loc of first arg during a subr call */
#define SP_REGNUM 29 /* Contains address of top of stack */
#define FP_REGNUM 30 /* Pseudo register that contains true address of executing stack frame */
#define RA_REGNUM 31 /* Contains return address value */
struct frame_saved_regs *saved_regs;
#define INIT_EXTRA_FRAME_INFO(fromleaf, fci) init_extra_frame_info(fci)
+
+/* Size of elements in jmpbuf */
+
+#define JB_ELEMENT_SIZE 4
+
+/* Figure out where the longjmp will land. We expect that we have just entered
+ longjmp and haven't yet setup the stack frame, so the args are still in the
+ argument regs. a0 (CALL_ARG0) points at the jmp_buf structure from which we
+ extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
+ This routine returns true on success */
+
+/* Note that caller must #include <setjmp.h> in order to get def of JB_* */
+#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
but do serve to get the desired values when passed to read_register. */
#define ZERO_REGNUM 0 /* read-only register, always 0 */
-#define A0_REGNUM 4 /* Lo of first arg during a subr call */
+#define A0_REGNUM 4 /* Loc of first arg during a subr call */
#define SP_REGNUM 29 /* Contains address of top of stack */
#define RA_REGNUM 31 /* Contains return address value */
#define PS_REGNUM 32 /* Contains processor status */
--- /dev/null
+/* Copyright (C) 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. */
+
+/* This is for the iris. */
+
+#define HAVE_TERMIO
+
+#define U_REGS_OFFSET 0
+
+#include "xm-bigmips.h"
+
+/* Override register locations in upage for SGI machines */
+#undef REGISTER_U_ADDR
+#define REGISTER_U_ADDR(addr, blockend, regno) \
+ if (regno < PC_REGNUM) \
+ addr = regno; \
+ 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"
+#define CREATE_INFERIOR_HOOK(pid) inferior_proc_init(pid)
+
+/* Irix defines psignal() in signal.h, which gets gcc rather angry at us
+ * because their definition is markedly different.
+ */
+#define PSIGNAL_IN_SIGNAL_H