[gnu.gdb.bug] Gdb 3.1 on 4.3BSD ISI machines

ray@MAXWELL.PHYSICS.PURDUE.EDU (Ray Moody) (03/26/89)

    Gdb 3.1 does not work on 4.3BSD ISI machines.

    First of all, m-isi.h must be patched or else REGISTER_U_ADDR is not able
to correctly compute the address of certain registers (namely D2-D7).

    (This hasn't been tested on a 4.2BSD ISI machine....)

-------------------------------------------------------------------------------
RCS file: m-isi.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1006852	Fri Mar 24 21:44:53 1989
--- /tmp/,RCSt2006852	Fri Mar 24 21:44:55 1989
***************
*** 181,186
  #define FP0_REGNUM 18		/* Floating point register 0 */
  #define FPC_REGNUM 26		/* 68881 control register */
  
  #ifdef BSD43_ISI40D
  #define BLOCKFUDGE	0x400000
  #else

--- 181,187 -----
  #define FP0_REGNUM 18		/* Floating point register 0 */
  #define FPC_REGNUM 26		/* 68881 control register */
  
+ #include <machine/reg.h>
  #ifdef BSD43_ISI40D
  #define BLOCKFUDGE	0x400000
  #else
***************
*** 186,203
  #else
  #define BLOCKFUDGE	0
  #endif
! #define REGISTER_U_ADDR(addr, blockend, regno)			\
! {	blockend -= BLOCKFUDGE;					\
! 	if (regno < 2) addr = blockend - 0x18 + regno * 4;	\
! 	else if (regno < 8) addr = blockend - 0x54 + regno * 4;	\
! 	else if (regno < 10) addr = blockend - 0x30 + regno * 4;\
! 	else if (regno < 15) addr = blockend - 0x5c + regno * 4;\
! 	else if (regno < 16) addr = blockend - 0x1c;		\
! 	else if (regno < 18) addr = blockend - 0x44 + regno * 4;\
! 	else if (regno < 26) addr = (int) ((struct user *)0)->u_68881_regs \
! 	    + (regno - 18) * 12;				\
! 	else if (regno < 29) addr = (int) ((struct user *)0)->u_68881_regs \
! 	    + 8 * 12 + (regno - 26) * 4;			\
  }
  
  /* Total amount of space needed to store our copies of the machine's

--- 187,210 -----
  #else
  #define BLOCKFUDGE	0
  #endif
! #define REGISTER_U_ADDR(addr, blockend, regno)			            \
! {      	       	       	       						    \
!   static int r[] = {D0, D1, D2, D3, D4, D5, D6, D7,			    \
! 		    A0, A1, A2, A3, A4, A5, A6, A7,			    \
! 		    PS, PC};   						    \
! 			       						    \
!   if (regno < 18)	       						    \
!     {			       						    \
!       addr = blockend - BLOCKFUDGE + r[regno]*4;			    \
!     }			       						    \
!   else if (regno < 26)	       						    \
!     {			       						    \
!       addr = (int) ((struct user *)0)->u_68881_regs + (regno-18)*12;	    \
!     }			       						    \
!   else			       						    \
!     {			       						    \
!       addr = (int) ((struct user *)0)->u_68881_regs + 8*12 + (regno-26)*4;  \
!     }									    \
  }
  
  /* Total amount of space needed to store our copies of the machine's
-------------------------------------------------------------------------------

    Next, default-dep.c should probably be changed so that it does not include
<fcntl.h>.  This is really a workaround for an ISI bug.  It is not possible to
include both <sys/file.h> and <fcntl.h> in the same source file!  Warning
messages to the effect "/usr/include/fcntl.h: 13: O_RDONLY redefined" result.

    I can't find anything in default-dep.c that actually uses <fcntl.h>.

-------------------------------------------------------------------------------
RCS file: default-dep.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1007014	Fri Mar 24 21:55:09 1989
--- /tmp/,RCSt2007014	Fri Mar 24 21:55:10 1989
***************
*** 33,39
  #include <signal.h>
  #include <sys/user.h>
  #include <sys/ioctl.h>
- #include <fcntl.h>
  
  #ifdef COFF_ENCAPSULATE
  #include "a.out.encap.h"

--- 33,38 -----
  #include <signal.h>
  #include <sys/user.h>
  #include <sys/ioctl.h>
  
  #ifdef COFF_ENCAPSULATE
  #include "a.out.encap.h"
-------------------------------------------------------------------------------

    Finally, a comment in the Makefile about -DBSD43_ISI40D really should be
added.  I spend much time looking through source that I really didn't want to
read before I discovered this was required for our machines.

-------------------------------------------------------------------------------
RCS file: Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff  -r1.1 -r1.2
20a21,23
> # On ISI machines, make sure to compile gdb with -DBSD43_ISI40D if you run
> # 4.3BSD.
> 
-------------------------------------------------------------------------------

    Ok.  That about does it.

    Keep up the good work guys.  This is the most marvelous debugger that I
have seen in my life!!!!

								Ray