* vax-tdep.c: Include "regset.h".
authorMark Kettenis <kettenis@gnu.org>
Thu, 15 Apr 2004 15:03:30 +0000 (15:03 +0000)
committerMark Kettenis <kettenis@gnu.org>
Thu, 15 Apr 2004 15:03:30 +0000 (15:03 +0000)
(vax_supply_gregset): New function.
(vax_gregset): New variable.
(vax_regset_from_core_section): New function.
(vax_gdbarch_init): Set regset_from_core_section.
* Makefile.in (vax-tdep.o): Update dependencies.

gdb/ChangeLog
gdb/Makefile.in
gdb/vax-tdep.c

index 4db9782..cb236d1 100644 (file)
@@ -1,3 +1,12 @@
+2004-04-15  Mark Kettenis  <kettenis@gnu.org>
+
+       * vax-tdep.c: Include "regset.h".
+       (vax_supply_gregset): New function.
+       (vax_gregset): New variable.
+       (vax_regset_from_core_section): New function.
+       (vax_gdbarch_init): Set regset_from_core_section.
+       * Makefile.in (vax-tdep.o): Update dependencies.
+
 2004-04-15  Andrew Cagney  <cagney@redhat.com>
 
        * observer.c (normal_stop_subject, observer_notify_normal_stop)
index f5c9ef6..29a027e 100644 (file)
@@ -2499,8 +2499,8 @@ varobj.o: varobj.c $(defs_h) $(value_h) $(expression_h) $(frame_h) \
        $(language_h) $(wrapper_h) $(gdbcmd_h) $(gdb_string_h) $(varobj_h)
 vax-tdep.o: vax-tdep.c $(defs_h) $(symtab_h) $(opcode_vax_h) $(gdbcore_h) \
        $(inferior_h) $(regcache_h) $(frame_h) $(frame_base_h) \
-       $(frame_unwind_h) $(value_h) $(arch_utils_h) $(gdb_string_h) \
-       $(osabi_h) $(dis_asm_h) $(vax_tdep_h)
+       $(frame_unwind_h) $(value_h) $(arch_utils_h) $(osabi_h) \
+       $(dis_asm_h) $(regset_h) $(gdb_string_h) $(vax_tdep_h)
 vaxbsd-nat.o: vaxbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) $(vax_tdep_h)
 vaxnbsd-tdep.o: vaxnbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \
        $(vax_tdep_h) $(solib_svr4_h)
index f697c9e..1e8986c 100644 (file)
 #include "trad-frame.h"
 #include "value.h"
 #include "arch-utils.h"
-#include "gdb_string.h"
 #include "osabi.h"
 #include "dis-asm.h"
+#include "regset.h"
+
+#include "gdb_string.h"
 
 #include "vax-tdep.h"
 
@@ -65,7 +67,47 @@ vax_register_type (struct gdbarch *gdbarch, int regnum)
   return builtin_type_int;
 }
 \f
+/* Core file support.  */
+
+/* Supply register REGNUM from the buffer specified by GREGS and LEN
+   in the general-purpose register set REGSET to register cache
+   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
+
+static void
+vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
+                   int regnum, const void *gregs, size_t len)
+{
+  const char *regs = gregs;
+  int i;
+
+  for (i = 0; i < VAX_NUM_REGS; i++)
+    {
+      if (regnum == i || regnum == -1)
+       regcache_raw_supply (regcache, i, regs + i * 4);
+    }
+}
 
+/* VAX register set.  */
+
+static struct regset vax_gregset =
+{
+  NULL,
+  vax_supply_gregset
+};
+
+/* Return the appropriate register set for the core section identified
+   by SECT_NAME and SECT_SIZE.  */
+
+static const struct regset *
+vax_regset_from_core_section (struct gdbarch *gdbarch,
+                             const char *sect_name, size_t sect_size)
+{
+  if (strcmp (sect_name, ".reg") == 0 && sect_size >= VAX_NUM_REGS * 4)
+    return &vax_gregset;
+
+  return NULL;
+}
+\f
 /* The VAX Unix calling convention uses R1 to pass a structure return
    value address instead of passing it as a first (hidden) argument as
    the VMS calling convention suggests.  */
@@ -428,6 +470,9 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
   set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
 
+  set_gdbarch_regset_from_core_section
+    (gdbarch, vax_regset_from_core_section);
+
   /* Frame and stack info */
   set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
   set_gdbarch_frame_num_args (gdbarch, vax_frame_num_args);