2000-03-24 J.T. Conklin <jtc@redback.com>
authorJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 24 Mar 2000 23:06:57 +0000 (23:06 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 24 Mar 2000 23:06:57 +0000 (23:06 +0000)
        * i386/tm-nbsd.h (USE_STRUCT_CONVENTION): Define.
        * i386nbsd-nat.c (i386nbsd_use_struct_convention): New function.
        (fetch_core_registers): Read fp registers.
        (i386nbsd_core_fns, _initialize_i386nbsd_nat): Added.

gdb/ChangeLog
gdb/config/i386/tm-nbsd.h
gdb/i386nbsd-nat.c

index 2e8b4cac808f8bce62c6c8e38a5d30a47827934d..65f6e2c50db969262f6694a56e7110e9d031c95f 100644 (file)
@@ -1,3 +1,10 @@
+2000-03-24  J.T. Conklin  <jtc@redback.com> 
+       * i386/tm-nbsd.h (USE_STRUCT_CONVENTION): Define. 
+       * i386nbsd-nat.c (i386nbsd_use_struct_convention): New function. 
+       (fetch_core_registers): Read fp registers. 
+       (i386nbsd_core_fns, _initialize_i386nbsd_nat): Added. 
 2000-03-24  Jonathan Larmour  <jlarmour@redhat.co.uk>
 
        * arm-tdep.c (thumb_skip_prologue): Take function end addr argument
index 3be47b03fad76504d1705cf1e5c2887faec7893a..66002ed2c0991c9ee334a1e8512e6d6907b2925a 100644 (file)
 #include "i386/tm-i386bsd.h"
 #include "tm-nbsd.h"
 
+extern use_struct_convention_fn i386nbsd_use_struct_convention;
+#define USE_STRUCT_CONVENTION(gcc_p, type) \
+       i386nbsd_use_struct_convention(gcc_p, type)
+
+
 #define JB_ELEMENT_SIZE sizeof(int)    /* jmp_buf[_JBLEN] is array of ints */
 #define JB_PC  0               /* Setjmp()'s return PC saved here */
 
index 76a75ae84dd1d7c2c17be2f6fc125468aedc6249..5c5a1f3b3044291a07946378cf9c1d22d68e60a4 100644 (file)
@@ -148,11 +148,20 @@ store_inferior_registers (regno)
   ptrace (PT_SETFPREGS, inferior_pid,
          (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
 }
-
+\f
+int
+i386nbsd_use_struct_convention (int gcc_p, struct type *type)
+{
+  return !(TYPE_LENGTH (type) == 1
+          || TYPE_LENGTH (type) == 2
+          || TYPE_LENGTH (type) == 4
+          || TYPE_LENGTH (type) == 8);
+}
+\f
 struct md_core
 {
   struct reg intreg;
-  struct fpreg freg;
+  struct env387 freg;
 };
 
 void
@@ -167,6 +176,43 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
   /* integer registers */
   memcpy (&registers[REGISTER_BYTE (0)], &core_reg->intreg,
          sizeof (struct reg));
+
   /* floating point registers */
-  /* XXX */
+  RF (FP0_REGNUM,     core_reg->freg.regs[0]);
+  RF (FP0_REGNUM + 1, core_reg->freg.regs[1]);
+  RF (FP0_REGNUM + 2, core_reg->freg.regs[2]);
+  RF (FP0_REGNUM + 3, core_reg->freg.regs[3]);
+  RF (FP0_REGNUM + 4, core_reg->freg.regs[4]);
+  RF (FP0_REGNUM + 5, core_reg->freg.regs[5]);
+  RF (FP0_REGNUM + 6, core_reg->freg.regs[6]);
+  RF (FP0_REGNUM + 7, core_reg->freg.regs[7]);
+
+  RF (FCTRL_REGNUM,   core_reg->freg.control);
+  RF (FSTAT_REGNUM,   core_reg->freg.status);
+  RF (FTAG_REGNUM,    core_reg->freg.tag);
+  RF (FCS_REGNUM,     core_reg->freg.code_seg);
+  RF (FCOFF_REGNUM,   core_reg->freg.eip);
+  RF (FDS_REGNUM,     core_reg->freg.operand_seg);
+  RF (FDOFF_REGNUM,   core_reg->freg.operand);
+  RF (FOP_REGNUM,     core_reg->freg.opcode);
+
+  registers_fetched ();
+}
+
+/* Register that we are able to handle i386nbsd core file formats.
+   FIXME: is this really bfd_target_unknown_flavour? */
+
+static struct core_fns i386nbsd_core_fns =
+{
+  bfd_target_unknown_flavour,          /* core_flavour */
+  default_check_format,                        /* check_format */
+  default_core_sniffer,                        /* core_sniffer */
+  fetch_core_registers,                        /* core_read_registers */
+  NULL                                 /* next */
+};
+
+void
+_initialize_i386nbsd_nat ()
+{
+  add_core_fns (&i386nbsd_core_fns);
 }