*** gdb/config/i386/fbsd.mh	Thu Jan 11 12:07:01 1996
--- gdb/config/i386/fbsd.mh	Sun Aug 25 15:37:43 1996
***************
*** 1,5 ****
  # Host: Intel 386 running FreeBSD
  XDEPFILES= 
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
  XM_FILE= xm-i386bsd.h
  NAT_FILE= nm-fbsd.h
--- 1,5 ----
  # Host: Intel 386 running FreeBSD
  XDEPFILES= 
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o kvm-fbsd.o
  XM_FILE= xm-i386bsd.h
  NAT_FILE= nm-fbsd.h
*** gdb/config/i386/fbsd.mt	Mon Jan 16 20:50:37 1995
--- gdb/config/i386/fbsd.mt	Sun Aug 25 14:00:01 1996
***************
*** 1,3 ****
  # Target: Intel 386 running FreeBSD
  TDEPFILES= i386-tdep.o i387-tdep.o solib.o
! TM_FILE= tm-i386bsd.h
--- 1,3 ----
  # Target: Intel 386 running FreeBSD
  TDEPFILES= i386-tdep.o i387-tdep.o solib.o
! TM_FILE= tm-fbsd.h
*** gdb/config/i386/nm-fbsd.h	Thu Jan  4 13:09:31 1996
--- gdb/config/i386/nm-fbsd.h	Sun Aug 25 15:27:19 1996
***************
*** 17,24 ****
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! #ifndef NM_FREEBSD_H
! #define NM_FREEBSD_H
  
  /* Be shared lib aware */
  #include "solib.h"
--- 17,26 ----
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! #ifndef NM_FBSD_H
! #define NM_FBSD_H
! 
! #define	ATTACH_DETACH
  
  /* Be shared lib aware */
  #include "solib.h"
***************
*** 29,37 ****
  #include <machine/vmparam.h>
  #define KERNEL_U_ADDR USRSTACK
  
- #define FLOAT_INFO extern i386_float_info (); \
- 						  i386_float_info ()
- 
  #define REGISTER_U_ADDR(addr, blockend, regno) \
  	(addr) = i386_register_u_addr ((blockend),(regno));
  
--- 31,36 ----
***************
*** 98,101 ****
  #define KERNEL_U_SIZE kernel_u_size()
  extern int kernel_u_size PARAMS ((void));
  
! #endif /* NM_FREEBSD_H */
--- 97,116 ----
  #define KERNEL_U_SIZE kernel_u_size()
  extern int kernel_u_size PARAMS ((void));
  
! #define ADDITIONAL_OPTIONS \
! 	{"kernel", no_argument, &kernel_debugging, 1}, \
! 	{"k", no_argument, &kernel_debugging, 1}, \
! 	{"wcore", no_argument, &kernel_writablecore, 1}, \
! 	{"w", no_argument, &kernel_writablecore, 1},
! 
! #define ADDITIONAL_OPTION_HELP \
! 	"\
!   --kernel           Enable kernel debugging.\n\
!   --wcore            Make core file writable (only works for /dev/mem).\n\
!                      This option only works while debugging a kernel !!\n\
! "
! 
! extern int kernel_debugging;
! extern int kernel_writablecore;
! 
! #endif /* NM_FBSD_H */
*** gdb/core-aout.c	Fri Mar 29 21:58:16 1996
--- gdb/core-aout.c	Sat Aug 17 15:44:16 1996
***************
*** 67,81 ****
  
  static void
  fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
!      char *core_reg_sect;
!      unsigned core_reg_size;
!      int which;
!      unsigned reg_addr;
  {
    register int regno;
!   register unsigned int addr;
    int bad_reg = -1;
!   register reg_ptr = -reg_addr;		/* Original u.u_ar0 is -reg_addr. */
    int numregs = ARCH_NUM_REGS;
  
    /* If u.u_ar0 was an absolute address in the core file, relativize it now,
--- 67,81 ----
  
  static void
  fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
! 	char *core_reg_sect;
! 	unsigned core_reg_size;
! 	int which;
! 	CORE_ADDR reg_addr;
  {
    register int regno;
!   register CORE_ADDR addr;
    int bad_reg = -1;
!   register CORE_ADDR reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
    int numregs = ARCH_NUM_REGS;
  
    /* If u.u_ar0 was an absolute address in the core file, relativize it now,
***************
*** 84,90 ****
       CORE_REGISTER_ADDR to offset to the other registers.  If this is a modern
       core file without a upage, reg_ptr will be zero and this is all a big
       NOP.  */
!   if (reg_ptr > (int) core_reg_size)
      reg_ptr -= KERNEL_U_ADDR;
  
    for (regno = 0; regno < numregs; regno++)
--- 84,90 ----
       CORE_REGISTER_ADDR to offset to the other registers.  If this is a modern
       core file without a upage, reg_ptr will be zero and this is all a big
       NOP.  */
!   if (reg_ptr > core_reg_size)
      reg_ptr -= KERNEL_U_ADDR;
  
    for (regno = 0; regno < numregs; regno++)
***************
*** 114,120 ****
       int regno;
       int blockend;
  {
!   int addr;
  
    if (regno < 0 || regno >= ARCH_NUM_REGS)
      error ("Invalid register number %d.", regno);
--- 114,120 ----
       int regno;
       int blockend;
  {
!   CORE_ADDR addr;
  
    if (regno < 0 || regno >= ARCH_NUM_REGS)
      error ("Invalid register number %d.", regno);
*** gdb/i386b-nat.c	Thu Mar  7 12:13:45 1996
--- gdb/i386b-nat.c	Sun Aug 25 15:40:49 1996
***************
*** 72,84 ****
  
  #include <machine/reg.h>
  
  /* this table must line up with REGISTER_NAMES in tm-i386.h */
  /* symbols like 'tEAX' come from <machine/reg.h> */
  static int tregmap[] = 
  {
    tEAX, tECX, tEDX, tEBX,
    tESP, tEBP, tESI, tEDI,
!   tEIP, tEFLAGS, tCS, tSS
  };
  
  #ifdef sEAX
--- 72,103 ----
  
  #include <machine/reg.h>
  
+ /* Some systems don't provide all the registers on a trap.  Use SS as a
+    default if so.  */
+ 
+ #ifndef tDS
+ #define tDS tSS
+ #endif
+ #ifndef tES
+ #define tES tSS
+ #endif
+ #ifndef tFS
+ #define tFS tSS
+ #endif
+ #ifndef tGS
+ #define tGS tSS
+ #endif
+ 
+ /* These tables map between the registers on a trap frame, and the register
+    order used by the rest of GDB.  */
  /* this table must line up with REGISTER_NAMES in tm-i386.h */
  /* symbols like 'tEAX' come from <machine/reg.h> */
  static int tregmap[] = 
  {
    tEAX, tECX, tEDX, tEBX,
    tESP, tEBP, tESI, tEDI,
!   tEIP, tEFLAGS, tCS, tSS,
!   tDS, tES, tFS, tGS
  };
  
  #ifdef sEAX
***************
*** 97,103 ****
  {
    tEAX, tECX, tEDX, tEBX,
    tESP, tEBP, tESI, tEDI,
!   tEIP, tEFLAGS, tCS, tSS
  };
  #endif /* No sEAX */
  
--- 116,123 ----
  {
    tEAX, tECX, tEDX, tEBX,
    tESP, tEBP, tESI, tEDI,
!   tEIP, tEFLAGS, tCS, tSS,
!   tDS, tES, tFS, tGS
  };
  #endif /* No sEAX */
  
***************
*** 125,130 ****
--- 145,151 ----
  #endif /* !FETCH_INFERIOR_REGISTERS */
  
  #ifdef FLOAT_INFO
+ #include "expression.h"
  #include "language.h"			/* for local_hex_string */
  #include "floatformat.h"
  
***************
*** 195,201 ****
      }
    
    print_387_control_word ((unsigned int)ep->control);
!   printf_unfiltered ("last exception: ");
    printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
    printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
    printf_unfiltered ("%s; ", local_hex_string(ep->eip));
--- 216,222 ----
      }
    
    print_387_control_word ((unsigned int)ep->control);
!   printf_unfiltered ("last instruction: ");
    printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
    printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
    printf_unfiltered ("%s; ", local_hex_string(ep->eip));
***************
*** 227,232 ****
--- 248,254 ----
      }
  }
  
+ void
  i386_float_info ()
  {
    struct user u; /* just for address computations */
***************
*** 271,279 ****
        skip = 0;
  #endif
      }
!   
    print_387_status (0, (struct env387 *)buf);
  }
  
  int
  kernel_u_size ()
--- 293,307 ----
        skip = 0;
  #endif
      }
! 
! #ifdef	__FreeBSD__
!   fpstatep = (struct fpstate *)(buf + skip);
!   print_387_status (fpstatep->sv_ex_sw, (struct env387 *)fpstatep);
! #else
    print_387_status (0, (struct env387 *)buf);
+ #endif
  }
+ #endif /* FLOAT_INFO */
  
  int
  kernel_u_size ()
***************
*** 281,284 ****
    return (sizeof (struct user));
  }
  
! #endif
--- 309,324 ----
    return (sizeof (struct user));
  }
  
! #ifdef	SETUP_ARBITRARY_FRAME
! #include "frame.h"
! struct frame_info *
! setup_arbitrary_frame (argc, argv)
! 	int argc;
! 	CORE_ADDR *argv;
! {
!     if (argc != 2)
! 	error ("i386 frame specifications require two arguments: sp and pc");
! 
!     return create_new_frame (argv[0], argv[1]);
! }
! #endif	/* SETUP_ARBITRARY_FRAME */
*** gdb/target.c	Tue Aug  1 20:24:28 1995
--- gdb/target.c	Sun Aug 25 15:22:55 1996
***************
*** 905,911 ****
    for (t = target_structs; t < target_structs + target_struct_size;
         ++t)
      {
!       if ((*t)->to_stratum == core_stratum)
  	{
  	  runable = *t;
  	  ++count;
--- 905,911 ----
    for (t = target_structs; t < target_structs + target_struct_size;
         ++t)
      {
!       if ((*t)->to_stratum == (kernel_debugging ? kcore_stratum : core_stratum))
  	{
  	  runable = *t;
  	  ++count;
*** gdb/target.h	Sat Nov  4 10:59:56 1995
--- gdb/target.h	Sun Aug 25 15:21:36 1996
***************
*** 46,51 ****
--- 46,52 ----
  	dummy_stratum,		/* The lowest of the low */
  	file_stratum,		/* Executable files, etc */
  	core_stratum,		/* Core dump files */
+ 	kcore_stratum,		/* Kernel core files */
  	download_stratum,	/* Downloading of remote targets */
  	process_stratum		/* Executing processes */
  };
