🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #72

Patches to gdb under Irix 4.0.1

#72
From: Miron Cuperman
Date: Sat, 11 Apr 1992 21:27
263 lines
7956 bytes
Notes:
	- When compiling gcc look in the config files and enable dollar signs
	in identifiers.
	- There's some flakiness (which I haven't looked at) in calling
	functions from gdb and other stuff.
	- The changes were made to the irix3 config file.  An irix4 config
	file should be created instead.
	- Someone should write a proper supply_gregset, etc.
	- Compile your programs with -ggdb.

diff -rc gdb-4.4/gdb/Makefile gdb-4.5.miron/gdb/Makefilegdb-4.4/gdb/buildsym.c gdb-4.5.miron/gdb/buildsym.c
*** gdb-4.4/gdb/buildsym.c	Mon Jan 27 14:10:00 1992
--- gdb-4.5.miron/gdb/buildsym.c	Tue Mar 31 23:24:34 1992
***************
*** 2072,2077 ****
--- 2072,2078 ----
  		{
  		  complain (&invalid_cpp_type_complaint, symnum);
  		  TYPE_NAME (context) = name;
+ 		  name = "";
  		}
  	      list->field.name = obconcat (prefix, name, "");
  	      p = ++(*pp);
diff -rc gdb-4.4/gdb/infptrace.c gdb-4.5.miron/gdb/infptrace.cgdb-4.4/gdb/infrun.c gdb-4.5.miron/gdb/infrun.c
*** gdb-4.4/gdb/infrun.c	Thu Jan 30 17:24:32 1992
--- gdb-4.5.miron/gdb/infrun.c	Thu Apr  2 23:44:41 1992
***************
*** 612,617 ****
--- 612,618 ----
    pending_execs = 2;
  #endif
  
+   inferior_proc_init(inferior_pid);
    init_wait_for_inferior ();
  
    /* Set up the "saved terminal modes" of the inferior
diff -rc gdb-4.4/gdb/inftarg.c gdb-4.5.miron/gdb/inftarg.cgdb-4.4/gdb/mips-tdep.c gdb-4.5.miron/gdb/mips-tdep.c
*** gdb-4.4/gdb/mips-tdep.c	Sun Jan 12 13:10:37 1992
--- gdb-4.5.miron/gdb/mips-tdep.c	Wed Apr  1 23:28:38 1992
***************
*** 686,688 ****
--- 686,758 ----
  
      return pc;
  }
+ 
+ #include <sys/procfs.h>
+ /*  Given a pointer to a general register set in /proc format (gregset_t *),
+     unpack the register contents and supply them as gdb's idea of the current
+     register values. */
+ 
+ void
+ supply_gregset (gregsetp)
+ gregset_t *gregsetp;
+ {
+   register int regno;
+   int* regp = gregsetp->gp_regs;
+ 
+   for (regno = 0 ; regno < PS_REGNUM ; regno++)
+     {
+       supply_register (regno, (char *) (regp + regno));
+     }
+     supply_register(PC_REGNUM, (char*) &gregsetp->gp_pc);
+ }
+ 
+ void
+ fill_gregset (gregsetp, regno)
+ gregset_t *gregsetp;
+ int regno;
+ {
+   int regi;
+   int* regp = gregsetp->gp_regs;
+   extern char registers[];
+ 
+   for (regi = 0 ; regi < NUM_REGS ; regi++)
+     {
+       if ((regno == -1) || (regno == regi))
+ 	{
+ 	  regp[regi] = *(int *) &registers[REGISTER_BYTE (regi)];
+ 	}
+     }
+     gregsetp->gp_pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
+ }
+ 
+ /*  Given a pointer to a floating point register set in /proc format
+     (fpregset_t *), unpack the register contents and supply them as gdb's
+     idea of the current floating point register values. */
+ 
+ void 
+ supply_fpregset (fpregsetp)
+ fpregset_t *fpregsetp;
+ {
+   register int regno;
+   
+   /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+ }
+ 
+ /*  Given a pointer to a floating point register set in /proc format
+     (fpregset_t *), update the register specified by REGNO from gdb's idea
+     of the current floating point register set.  If REGNO is -1, update
+     them all. */
+ 
+ void
+ fill_fpregset (fpregsetp, regno)
+ fpregset_t *fpregsetp;
+ int regno;
+ {
+   int regi;
+   char *to;
+   char *from;
+   extern char registers[];
+ 
+   /* FIXME: see m68k-tdep.c for an example, for the m68k. */
+ }
+ 
diff -rc gdb-4.4/gdb/mips-tdep.c gdb-4.5.miron/gdb/mips-tdep.cgdb-4.4/gdb/procfs.c gdb-4.5.miron/gdb/procfs.c
*** gdb-4.4/gdb/procfs.c	Thu Jan 23 22:52:41 1992
--- gdb-4.5.miron/gdb/procfs.c	Thu Apr  2 23:48:24 1992
***************
*** 37,42 ****
--- 37,43 ----
  
  #ifdef USE_PROC_FS	/* Entire file goes away if not using /proc */
  
+ #include <sys/time.h>
  #include <stdio.h>
  #include <sys/procfs.h>
  #include <fcntl.h>
***************
*** 47,53 ****
  #include "target.h"
  
  #ifndef PROC_NAME_FMT
! #define PROC_NAME_FMT "/proc/%d"
  #endif
  
  extern void EXFUN(supply_gregset, (gregset_t *gregsetp));
--- 48,54 ----
  #include "target.h"
  
  #ifndef PROC_NAME_FMT
! #define PROC_NAME_FMT "/debug/%d"
  #endif
  
  extern void EXFUN(supply_gregset, (gregset_t *gregsetp));
***************
*** 446,452 ****
        _exit (127);
      }
    premptyset (&exitset);
!   praddset (&exitset, SYS_exec);
    praddset (&exitset, SYS_execve);
    if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
      {
--- 447,453 ----
        _exit (127);
      }
    premptyset (&exitset);
!   praddset (&exitset, SYS_execv);
    praddset (&exitset, SYS_execve);
    if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
      {
***************
*** 848,854 ****
  	}
        else
  	{
! 	  print_sys_errmsg (pi.pathname, errno);
  	  error ("PIOCSTATUS or PIOCWSTOP failed.");
  	  /* NOTREACHED */
  	}
--- 849,855 ----
  	}
        else
  	{
! 	  print_sys_errmsg ((pi.pathname != NULL) ? pi.pathname:"<nopath>", errno);
  	  error ("PIOCSTATUS or PIOCWSTOP failed.");
  	  /* NOTREACHED */
  	}
***************
*** 863,869 ****
  	  statval = (what << 8) | 0177;
  	}
        else if ((why == PR_SYSEXIT) &&
! 	       (what == SYS_exec || what == SYS_execve))
  	{
  	  statval = (SIGTRAP << 8) | 0177;
  	}
--- 864,870 ----
  	  statval = (what << 8) | 0177;
  	}
        else if ((why == PR_SYSEXIT) &&
! 	       (what == SYS_execv || what == SYS_execve))
  	{
  	  statval = (SIGTRAP << 8) | 0177;
  	}
***************
*** 1183,1190 ****
--- 1184,1200 ----
    sprintf (pip -> pathname, PROC_NAME_FMT, pid);
    if ((pip -> fd = open (pip -> pathname, O_RDWR)) >= 0)
      {
+       long int i;
+       
        pip -> valid = 1;
        pip -> pid = pid;
+       
+       i = PR_FORK;
+       if (ioctl(pip->fd, PIOCRESET, &i) < 0)
+ 	      perror("reset PR_FORK");
+       i = PR_KLC;
+       if (ioctl(pip->fd, PIOCSET, &i) < 0)
+ 	      perror("set PR_KLC");
      }
    return (pip -> valid);
  }
diff -rc gdb-4.4/gdb/procfs.c gdb-4.5.miron/gdb/procfs.cgdb-4.4/gdb/signame.h gdb-4.5.miron/gdb/signame.h
*** gdb-4.4/gdb/signame.h	Tue Jun  4 00:29:55 1991
--- gdb-4.5.miron/gdb/signame.h	Wed Apr  1 18:43:52 1992
***************
*** 36,41 ****
--- 36,43 ----
  
  char *sig_abbrev ();
  int sig_number ();
+ #ifndef __sgi
  void psignal ();
+ #endif
  
  #endif
diff -rc gdb-4.4/gdb/signame.h gdb-4.5.miron/gdb/signame.hgdb-4.4/gdb/tm-irix3.h gdb-4.5.miron/gdb/tm-irix3.h
*** gdb-4.4/gdb/tm-irix3.h	Mon Nov 18 15:51:32 1991
--- gdb-4.5.miron/gdb/tm-irix3.h	Thu Apr  2 00:02:00 1992
***************
*** 17,22 ****
--- 17,23 ----
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
+ #define USE_PROC_FS
  #define TARGET_BYTE_ORDER BIG_ENDIAN
  
  /* Floating point is IEEE compliant */
diff -rc gdb-4.4/gdb/config/mh-irix3 gdb-4.5.miron/gdb/config/mh-irix3
*** gdb-4.4/gdb/config/mh-irix3	Mon Nov 25 12:33:19 1991
--- gdb-4.5.miron/gdb/config/mh-irix3	Thu Apr  2 00:06:27 1992
***************
*** 1,5 ****
  # Host: SGI Iris running irix 3.x
! XDEPFILES= infptrace.o coredep.o
  XM_FILE= xm-irix3.h
  ALLOCA=alloca.o
  ALLOCA1=alloca.o
--- 1,5 ----
  # Host: SGI Iris running irix 3.x
! XDEPFILES= procfs.o
  XM_FILE= xm-irix3.h
  ALLOCA=alloca.o
  ALLOCA1=alloca.o
-- 
Forever, Miron Cuperman <miron@cs.sfu.ca>		(NeXTmail ok)

	Laissez faire.
Technical Details
Message-ID: <1992Apr11.212704.22382@cs.sfu.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.sfu.ca!miron

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.sfu.ca!miron
From: miron@cs.sfu.ca (Miron Cuperman)
Subject: Patches to gdb under Irix 4.0.1
Message-ID: <1992Apr11.212704.22382@cs.sfu.ca>
Summary: not perfect
Sender: gnulists@ai.mit.edu
Organization: Simon Fraser University
Distribution: gnu
Date: Sat, 11 Apr 1992 21:27:04 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 264