diff options
author | Stu Grossman <grossman@cygnus> | 1992-03-05 20:20:27 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1992-03-05 20:20:27 +0000 |
commit | 407a8389b40fa7af08cae8f1eb347c67cc2436ad (patch) | |
tree | 406cb28847fadd93989dfe892e36c65eb1dc65de /gdb | |
parent | d7eddc517782bf0673e4bcd15c4159ae5799a247 (diff) | |
download | gdb-407a8389b40fa7af08cae8f1eb347c67cc2436ad.zip gdb-407a8389b40fa7af08cae8f1eb347c67cc2436ad.tar.gz gdb-407a8389b40fa7af08cae8f1eb347c67cc2436ad.tar.bz2 |
* config.sub configure.in config/.Sanitize config/mh-irix4
gdb/.Sanitize gdb/configure.in gdb/mips-tdep.c gdb/mipsread.c
gdb/procfs.c gdb/signame.h gdb/tm-irix3.h gdb/tm-mips.h
gdb/xm-irix4.h gdb/config/.Sanitize gdb/config/mt-irix3
gdb/config/mh-irix4 texinfo/configure.in: Port to SGI Irix-4.x.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/.Sanitize | 1 | ||||
-rw-r--r-- | gdb/config/.Sanitize | 1 | ||||
-rw-r--r-- | gdb/config/irix3.mt | 2 | ||||
-rw-r--r-- | gdb/config/irix4.mh | 7 | ||||
-rw-r--r-- | gdb/configure.in | 7 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 113 | ||||
-rw-r--r-- | gdb/mipsread.c | 5 | ||||
-rw-r--r-- | gdb/procfs.c | 33 | ||||
-rwxr-xr-x | gdb/signame.h | 2 | ||||
-rw-r--r-- | gdb/tm-irix3.h | 14 | ||||
-rw-r--r-- | gdb/tm-mips.h | 2 | ||||
-rw-r--r-- | gdb/xm-irix4.h | 50 |
12 files changed, 230 insertions, 7 deletions
diff --git a/gdb/.Sanitize b/gdb/.Sanitize index 5cefd71..4c70922 100644 --- a/gdb/.Sanitize +++ b/gdb/.Sanitize @@ -266,6 +266,7 @@ xm-i386v.h xm-i386v4.h xm-i386v32.h xm-irix3.h +xm-irix4.h xm-isi.h xm-m68k.h xm-merlin.h diff --git a/gdb/config/.Sanitize b/gdb/config/.Sanitize index f66f767..cb48765 100644 --- a/gdb/config/.Sanitize +++ b/gdb/config/.Sanitize @@ -41,6 +41,7 @@ mh-i386v-g mh-i386v32 mh-i386v32-g mh-irix3 +mh-irix4 mh-isi mh-littlemips mh-m88k diff --git a/gdb/config/irix3.mt b/gdb/config/irix3.mt index 3cd05bb..18948d9 100644 --- a/gdb/config/irix3.mt +++ b/gdb/config/irix3.mt @@ -1,3 +1,3 @@ -# 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 diff --git a/gdb/config/irix4.mh b/gdb/config/irix4.mh new file mode 100644 index 0000000..d6276cc --- /dev/null +++ b/gdb/config/irix4.mh @@ -0,0 +1,7 @@ +# 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 diff --git a/gdb/configure.in b/gdb/configure.in index f4d9025..a5b1cd6 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -80,7 +80,12 @@ mips) 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 ;; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 8a9d93c..98520d4 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -36,6 +36,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #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 @@ -641,7 +647,114 @@ 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 *) ®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 */ + /* 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/mipsread.c b/gdb/mipsread.c index 3f2fcd0..61c3d3a 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -2347,10 +2347,11 @@ psymtab_to_symtab_1(pst, filename) /* 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 */ diff --git a/gdb/procfs.c b/gdb/procfs.c index c10ba0a..58e8878 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -36,6 +36,7 @@ regardless of whether or not the actual target has floating point hardware. #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> @@ -466,8 +467,23 @@ proc_set_exec_trap () _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); @@ -886,8 +902,21 @@ proc_wait (statloc) { 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; } diff --git a/gdb/signame.h b/gdb/signame.h index caa1bba..0010796 100755 --- a/gdb/signame.h +++ b/gdb/signame.h @@ -34,10 +34,12 @@ sig_abbrev PARAMS ((int)); 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) */ diff --git a/gdb/tm-irix3.h b/gdb/tm-irix3.h index f62a39e..f5f3469 100644 --- a/gdb/tm-irix3.h +++ b/gdb/tm-irix3.h @@ -102,6 +102,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 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 */ @@ -323,3 +324,16 @@ typedef struct mips_extra_func_info { 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) diff --git a/gdb/tm-mips.h b/gdb/tm-mips.h index 44390ef..bf726d2 100644 --- a/gdb/tm-mips.h +++ b/gdb/tm-mips.h @@ -122,7 +122,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 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 */ diff --git a/gdb/xm-irix4.h b/gdb/xm-irix4.h new file mode 100644 index 0000000..e25a144 --- /dev/null +++ b/gdb/xm-irix4.h @@ -0,0 +1,50 @@ +/* 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 |