SH: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Fri, 29 Nov 2013 16:57:54 +0000 (16:57 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Tue, 30 Sep 2014 07:14:37 +0000 (09:14 +0200)
For Super-H targets, no longer define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

* sh-linux-tdep.c (sh_linux_init_abi): Set tdep fields
'sizeof_gregset' and 'sizeof_fpregset'.
* sh-tdep.c (sh_regset_from_core_section): Remove.
(sh_iterate_over_regset_sections): New.
(sh_gdbarch_init): Adjust gdbarch initialization.
* sh-tdep.h (struct gdbarch_tdep): New fields sizeof_gregset and
sizeof_fpregset.
* shnbsd-tdep.c (shnbsd_init_abi): Set tdep field
'sizeof_gregset'.

gdb/ChangeLog
gdb/sh-linux-tdep.c
gdb/sh-tdep.c
gdb/sh-tdep.h
gdb/shnbsd-tdep.c

index 8b216e2ce857b071a570f1269f64c6f08598b337..fdbe9819cc37e83ebc01f02712e3d1a6f0badda7 100644 (file)
@@ -1,3 +1,15 @@
+2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * sh-linux-tdep.c (sh_linux_init_abi): Set tdep fields
+       'sizeof_gregset' and 'sizeof_fpregset'.
+       * sh-tdep.c (sh_regset_from_core_section): Remove.
+       (sh_iterate_over_regset_sections): New.
+       (sh_gdbarch_init): Adjust gdbarch initialization.
+       * sh-tdep.h (struct gdbarch_tdep): New fields sizeof_gregset and
+       sizeof_fpregset.
+       * shnbsd-tdep.c (shnbsd_init_abi): Set tdep field
+       'sizeof_gregset'.
+
 2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * score-tdep.c (score7_linux_regset_from_core_section): Remove.
index 19cba4167acb7c99f050993a4bbebde81698179e..2cc9fb8c823129a555025643ece4a52c52d8f569 100644 (file)
@@ -200,8 +200,12 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
     {
       struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+      /* Remember regset characteristics.  The sizes should match
+        elf_gregset_t and elf_fpregset_t from Linux.  */
       tdep->core_gregmap = (struct sh_corefile_regmap *)gregs_table;
+      tdep->sizeof_gregset = 92;
       tdep->core_fpregmap = (struct sh_corefile_regmap *)fpregs_table;
+      tdep->sizeof_fpregset = 136;
 
       tramp_frame_prepend_unwinder (gdbarch, &sh_linux_sigreturn_tramp_frame);
       tramp_frame_prepend_unwinder (gdbarch, &sh_linux_rt_sigreturn_tramp_frame);
index c8c36db0f56e7d3c0df8e0b5635273f3134abc1e..d91a29217c7461b4d3fe569b14b98d0f9395ce92 100644 (file)
@@ -2207,19 +2207,19 @@ static const struct regset sh_corefile_fpregset =
   sh_corefile_collect_regset
 };
 
-static const struct regset *
-sh_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name,
-                            size_t sect_size)
+static void
+sh_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                iterate_over_regset_sections_cb *cb,
+                                void *cb_data,
+                                const struct regcache *regcache)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  if (tdep->core_gregmap && strcmp (sect_name, ".reg") == 0)
-    return &sh_corefile_gregset;
-
-  if (tdep->core_fpregmap && strcmp (sect_name, ".reg2") == 0)
-    return &sh_corefile_fpregset;
+  if (tdep->core_gregmap != NULL)
+    cb (".reg", tdep->sizeof_gregset, &sh_corefile_gregset, NULL, cb_data);
 
-  return NULL;
+  if (tdep->core_fpregmap != NULL)
+    cb (".reg2", tdep->sizeof_fpregset, &sh_corefile_fpregset, NULL, cb_data);
 }
 
 /* This is the implementation of gdbarch method
@@ -2298,7 +2298,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   dwarf2_frame_set_init_reg (gdbarch, sh_dwarf2_frame_init_reg);
 
-  set_gdbarch_regset_from_core_section (gdbarch, sh_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, sh_iterate_over_regset_sections);
 
   switch (info.bfd_arch_info->mach)
     {
index 5d64c744f2695ec71cf6e67fadad589ea3f10942..da96a84b8e40d9be34c187ecc8da07bf7b9a022f 100644 (file)
@@ -95,10 +95,12 @@ struct gdbarch_tdep
      where each general-purpose register is stored inside the associated
      core file section.  */
   struct sh_corefile_regmap *core_gregmap;
+  int sizeof_gregset;
   /* Non-NULL when debugging from a core file and when FP registers are
      available.  Provides the offset where each FP register is stored
      inside the associated core file section.  */
   struct sh_corefile_regmap *core_fpregmap;
+  int sizeof_fpregset;
 };
 
 extern const struct regset sh_corefile_gregset;
index 2936661900aa02d48c6cea40f254e52ca43e0654..a81c2a1f73af3716d56222575ae8b92f22015fad 100644 (file)
@@ -64,6 +64,7 @@ shnbsd_init_abi (struct gdbarch_info info,
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
   tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
+  tdep->sizeof_gregset = 84;
 
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_ilp32_fetch_link_map_offsets);