[comp.sys.sun] Gnu gdb and SunOS 4.0

moraes@csri.toronto.edu (Mark Moraes) (01/13/89)

The following fix appears to get gdb 2.6 (the one that came with
emacs-18.51) work correctly under SunOS4.0. 

SunOS4.0 defines a struct called fpu which contains f_fpstatus, f_fparegs,
and f_pad, instead of putting c_fpstatus, c_fparegs and c_pad in the core
struct. It also defines FPU

This has been tested on Sun3/60s running SunOS4.0.

*** /tmp/,RCSt1a03427	Wed Jan  4 22:11:13 1989
--- core.c	Wed Sep 28 23:47:43 1988
***************
*** 36,41
  #endif

  #ifdef NEW_SUN_CORE
  #include <sys/core.h>
  #else /* not NEW_SUN_CORE */
  #ifdef UMAX_CORE

--- 36,42 -----
  #endif

  #ifdef NEW_SUN_CORE
+ #define FPU
  #include <sys/core.h>
  #else /* not NEW_SUN_CORE */
  #ifdef UMAX_CORE
***************
*** 204,209
  	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);

--- 205,211 -----
  	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;
+ #ifndef FPU
  	bcopy (corestr.c_fpstatus.fps_regs,
  	       &registers[REGISTER_BYTE (FP0_REGNUM)],
  	       sizeof corestr.c_fpstatus.fps_regs);
***************
*** 210,215
  	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));


--- 212,231 -----
  	bcopy (&corestr.c_fpstatus.fps_control,
  	       &registers[REGISTER_BYTE (FPC_REGNUM)],
  	       sizeof corestr.c_fpstatus - sizeof corestr.c_fpstatus.fps_regs);
+ #else
+ 	/*
+ 	 * SunOS4.0 defines a struct called fpu which contains f_fpstatus,
+ 	 * f_fparegs, and f_pad, instead of putting c_fpstatus, c_fparegs and
+ 	 * c_pad in the core struct. It also defines FPU
+ 	 */
+ 	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);
+ #endif

  	bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec));