[gnu.gdb.bug] gdb under sunos 4.0

tale@pawl.rpi.edu (David C Lawrence) (03/15/89)

(This is a re-request for help.  I received no response on the first.)

In the Emacs 18.53 distribution, gdb is broken in SunOS 4.0 due to
changes in <sys/core.h>, which changed the struct in core.h which was
originally declared in <sun#/reg.h>.  This is fixed by fixing the
references to that part of the struct in core.c.

Well, -almost- fixed.  The pointer that used to be surrounded with
#ifdef's for sun in core.h are now surrounded by FPU.  Unfortunately,
FPU is only #defined in reg.h if KERNEL is defined.  Not knowing my
way well enough around 4.0, all I've done is #define FPU and hoped for
the best.  It might work just fine, but because it is only defined if
KERNEL is (in theory), I fear I may have only replaced a broken
version that doesn't compile with a broken one that does.  Would
someone either please tell me whether this patch is adequate or if it
made a serious blunder?  Thanks.

(It is now three hours after I started this note and I am ready for
bed.  In between doing other things, I remade gdb and now am unable to
run any programmes within gdb.  It sets exec-file and load-file and
when it starts to run, it bombs out with a return code of 0177 and a
"crt0: /usr/lib/ld.so mapping failure".  The following is the only
modifications I made; is this a SunOS 4.0 problem?  Or is my waning
energy playing with my brain?  Either way, you help is appreciated.)

*** core.orig.c	Thu Mar  9 22:58:50 1989
--- core.c	Fri Mar 10 00:28:50 1989
***************
*** 36,41 ****
--- 36,44 ----
  #endif
  
  #ifdef NEW_SUN_CORE
+ #ifndef FPU
+ #define FPU
+ #endif /* FPU */
  #include <sys/core.h>
  #else /* not NEW_SUN_CORE */
  #ifdef UMAX_CORE
***************
*** 204,215 ****
  	bcopy (&corestr.c_regs, registers, 16 * 4);
  	*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = corestr.c_regs.r_ps;
  	*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = corestr.c_regs.r_pc;
! 	bcopy (corestr.c_fpstatus.fps_regs,
  	       &registers[REGISTER_BYTE (FP0_REGNUM)],
! 	       sizeof corestr.c_fpstatus.fps_regs);
! 	bcopy (&corestr.c_fpstatus.fps_control,
  	       &registers[REGISTER_BYTE (FPC_REGNUM)],
! 	       sizeof corestr.c_fpstatus - sizeof corestr.c_fpstatus.fps_regs);
  
  	bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec));
  
--- 207,218 ----
  	bcopy (&corestr.c_regs, registers, 16 * 4);
  	*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = corestr.c_regs.r_ps;
  	*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = corestr.c_regs.r_pc;
! 	bcopy (corestr.c_fpu.f_fpstatus.fps_regs,
  	       &registers[REGISTER_BYTE (FP0_REGNUM)],
! 	       sizeof corestr.c_fpu.f_fpstatus.fps_regs);
! 	bcopy (&corestr.c_fpu.f_fpstatus.fps_control,
  	       &registers[REGISTER_BYTE (FPC_REGNUM)],
! 	       sizeof corestr.c_fpu.f_fpstatus - sizeof corestr.c_fpu.f_fpstatus.fps_regs);
  
  	bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec));
--
      tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu