[gnu.utils.bug] Sun-2 support in GDB

dupuy@CS.COLUMBIA.EDU (Alexander Dupuy) (01/25/89)

GDB 3.0 lacks complete support for Sun-2s running SunOS 3.x or 4.x.  Since
Sun-2s are pretty similar to Sun-3s, it is fairly easy to add the requisite
files.  Since most Sun-2s are running a 3.x operating system, we make that the
default in config.gdb.

First the new files, then the patches.

: This is a shar archive.  Extract with sh, not csh.
: The rest of this file will extract: 
:
:	m-sun2os2.h
:	m-sun2os4.h
:
echo x - m-sun2os2.h
sed 's/^X//' > m-sun2os2.h << '//go.sysin dd *'
X#include "m-sun2.h"
X#undef NEW_SUN_PTRACE
X#undef NEW_SUN_CORE
X#undef ATTACH_DETACH
//go.sysin dd *
echo x - m-sun2os4.h
sed 's/^X//' > m-sun2os4.h << '//go.sysin dd *'
X#include "m-sun2.h"
X#define SUNOS4
//go.sysin dd *
exit

*** /tmp/,RCSt1a14916	Tue Jan 24 17:27:42 1989
--- sun3-dep.c	Tue Jan 24 17:25:52 1989
***************
*** 131,137 ****
--- 131,139 ----
  fetch_inferior_registers ()
  {
    struct regs inferior_registers;
+ #ifndef sun2
    struct fp_status inferior_fp_registers;
+ #endif sun2
    extern char registers[];
  
    if (remote_debugging)
***************
*** 139,154 ****
--- 141,162 ----
    else
      {
        ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
+ #ifndef sun2
        ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ #endif sun2
  
        bcopy (&inferior_registers, registers, 16 * 4);
+ #ifndef sun2
        bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
  	     sizeof inferior_fp_registers.fps_regs);
+ #endif sun2
        *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
        *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
+ #ifndef sun2
        bcopy (&inferior_fp_registers.fps_control,
  	     &registers[REGISTER_BYTE (FPC_REGNUM)],
  	     sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
+ #endif sun2
      }
  }
  
***************
*** 160,166 ****
--- 168,176 ----
       int regno;
  {
    struct regs inferior_registers;
+ #ifndef sun2
    struct fp_status inferior_fp_registers;
+ #endif sun2
    extern char registers[];
  
    if (remote_debugging)
***************
*** 168,183 ****
--- 178,199 ----
    else
      {
        bcopy (registers, &inferior_registers, 16 * 4);
+ #ifndef sun2
        bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
  	     sizeof inferior_fp_registers.fps_regs);
+ #endif sun2
        inferior_registers.r_ps = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
        inferior_registers.r_pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
+ #ifndef sun2
        bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
  	     &inferior_fp_registers.fps_control,
  	     sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
+ #endif sun2
  
        ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
+ #ifndef sun2
        ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ #endif sun2
      }
  }
  
***************
*** 441,446 ****
--- 457,463 ----
  	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 sun2
  #ifdef SUNOS4
       bcopy (corestr.c_fpu.f_fpstatus.fps_regs,
              &registers[REGISTER_BYTE (FP0_REGNUM)],
***************
*** 456,461 ****
--- 473,479 ----
  	       &registers[REGISTER_BYTE (FPC_REGNUM)],
  	       sizeof corestr.c_fpstatus - sizeof corestr.c_fpstatus.fps_regs);
  #endif
+ #endif sun2
  	bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec));
  
  	printf ("Core file is from \"%s\".\n", corestr.c_cmdname);

*** /tmp/,RCSt1a16227	Tue Jan 24 18:18:07 1989
--- m-sun2.h	Tue Jan 24 18:09:31 1989
***************
*** 193,198 ****
--- 193,215 ----
  
  #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
  
+ /* Enable use of alternate code to read and write registers.  */
+ 
+ #define NEW_SUN_PTRACE
+ 
+ /* Enable use of alternate code for Sun's format of core dump file.  */
+ 
+ #define NEW_SUN_CORE
+ 
+ /* Do implement the attach and detach commands.  */
+ 
+ #define ATTACH_DETACH
+ 
+ /* It is safe to look for symsegs on a Sun, because Sun's ld
+    does not screw up with random garbage at end of file.  */
+ 
+ #define READ_GDB_SYMSEGS
+ 
  /* This is a piece of magic that is given a register number REGNO
     and as BLOCKEND the address in the system of the end of the user structure
     and stores in ADDR the address in the kernel or core dump

*** /tmp/,RCSt1a14977	Tue Jan 24 17:33:31 1989
--- config.gdb	Mon Jan 23 19:27:34 1989
***************
*** 81,86 ****
--- 81,95 ----
  	pinsnfile=gld-pinsn.c
  	;;
  sun2)
+ 	case $os in
+ 	os4|sunos4)
+ 		paramfile=m-sun2os4.h
+		depfile=sun3-dep.c;;
+	none|os3|sunos3)
+		depfile=sun3-dep.c;;
+	os2|sunos2)
+ 		paramfile=m-sun2os2.h;;
+ 	esac
  	pinsnfile=m68k-pinsn.c
  	opcodefile=m68k-opcode.h
  	;;

-- 
inet: dupuy@cs.columbia.edu
uucp: ...!rutgers!cs.columbia.edu!dupuy