HPPA: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Sat, 29 Mar 2014 09:28:30 +0000 (09:28 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Tue, 30 Sep 2014 07:14:34 +0000 (09:14 +0200)
For HP PA-RISC targets, no longer define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

* hppa-hpux-tdep.c (hppa_hpux_regset_from_core_section): Remove.
(hppa_hpux_iterate_over_regset_sections): New.
(hppa_hpux_init_abi): Adjust gdbarch initialization.
* hppa-linux-tdep.c (hppa_linux_regset_from_core_section): Remove.
(hppa_linux_iterate_over_regset_sections): New.
(hppa_linux_init_abi): Adjust.
* hppanbsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
(hppanbsd_iterate_over_regset_sections): New.
(hppanbsd_init_abi): Adjust.
* hppaobsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
(hppaobsd_iterate_over_regset_sections): New.
(hppaobsd_init_abi): Adjust.

gdb/ChangeLog
gdb/hppa-hpux-tdep.c
gdb/hppa-linux-tdep.c
gdb/hppanbsd-tdep.c
gdb/hppaobsd-tdep.c

index 28bfea5f92238c44450b3a8c032bea76e9f7c7d2..dcc303bad47e9709420707dc5d9824e4bb4beea0 100644 (file)
@@ -1,3 +1,18 @@
+2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * hppa-hpux-tdep.c (hppa_hpux_regset_from_core_section): Remove.
+       (hppa_hpux_iterate_over_regset_sections): New.
+       (hppa_hpux_init_abi): Adjust gdbarch initialization.
+       * hppa-linux-tdep.c (hppa_linux_regset_from_core_section): Remove.
+       (hppa_linux_iterate_over_regset_sections): New.
+       (hppa_linux_init_abi): Adjust.
+       * hppanbsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
+       (hppanbsd_iterate_over_regset_sections): New.
+       (hppanbsd_init_abi): Adjust.
+       * hppaobsd-tdep.c (hppaobsd_regset_from_core_section): Remove.
+       (hppaobsd_iterate_over_regset_sections): New.
+       (hppaobsd_init_abi): Adjust.
+
 2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * frv-linux-tdep.c (frv_linux_regset_from_core_section): Remove.
index 688ac9a8cd2ebabcacc3c023c2afa26991ccf75c..ee59811ef646ddce3df6de5440b680ba6450453d 100644 (file)
@@ -1371,15 +1371,14 @@ static const struct regset hppa_hpux_regset =
   hppa_hpux_supply_save_state
 };
 
-static const struct regset *
-hppa_hpux_regset_from_core_section (struct gdbarch *gdbarch,
-                                   const char *sect_name, size_t sect_size)
+static void
+hppa_hpux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                       iterate_over_regset_sections_cb *cb,
+                                       void *cb_data,
+                                       const struct regcache *regcache)
 {
-  if (strcmp (sect_name, ".reg") == 0
-      && sect_size >= HPPA_HPUX_PA89_SAVE_STATE_SIZE + 8)
-    return &hppa_hpux_regset;
-
-  return NULL;
+  cb (".reg", HPPA_HPUX_PA89_SAVE_STATE_SIZE + 8, &hppa_hpux_regset,
+      NULL, cb_data);
 }
 \f
 
@@ -1495,8 +1494,8 @@ hppa_hpux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_skip_permanent_breakpoint
     (gdbarch, hppa_skip_permanent_breakpoint);
 
-  set_gdbarch_regset_from_core_section
-    (gdbarch, hppa_hpux_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, hppa_hpux_iterate_over_regset_sections);
 
   frame_unwind_append_unwinder (gdbarch, &hppa_hpux_sigtramp_frame_unwind);
 }
index 6bc604b6192c137475ea6d73ae2de4daefecf604..52837ee5552e86791ce4e607bc5c3989e799f151 100644 (file)
@@ -472,17 +472,17 @@ static const struct regset hppa_linux_fpregset =
   regcache_supply_regset, regcache_collect_regset
 };
 
-static const struct regset *
-hppa_linux_regset_from_core_section (struct gdbarch *gdbarch,
-                                    const char *sect_name,
-                                    size_t sect_size)
+static void
+hppa_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                        iterate_over_regset_sections_cb *cb,
+                                        void *cb_data,
+                                        const struct regcache *regcache)
 {
-  if (strcmp (sect_name, ".reg") == 0)
-    return &hppa_linux_regset;
-  else if (strcmp (sect_name, ".reg2") == 0)
-    return &hppa_linux_fpregset;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  return NULL;
+  cb (".reg", 80 * tdep->bytes_per_address, &hppa_linux_regset,
+      NULL, cb_data);
+  cb (".reg2", 64 * 4, &hppa_linux_fpregset, NULL, cb_data);
 }
 \f
 
@@ -520,8 +520,8 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
      more work in gcc and glibc first.  */
   set_gdbarch_long_double_bit (gdbarch, 64);
 
-  set_gdbarch_regset_from_core_section
-    (gdbarch, hppa_linux_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, hppa_linux_iterate_over_regset_sections);
 
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa_dwarf_reg_to_regnum);
 
index b3f04c794730aa875aaee0979dc0e6d0c8279b6e..45874663e3e70b567c1c4bfe642259a5ef54b211 100644 (file)
@@ -184,17 +184,15 @@ static const struct regset hppanbsd_gregset =
   hppanbsd_supply_gregset
 };
 
-/* Return the appropriate register set for the core section identified
-   by SECT_NAME and SECT_SIZE.  */
+/* Iterate over supported core file register note sections. */
 
-static const struct regset *
-hppanbsd_regset_from_core_section (struct gdbarch *gdbarch,
-                                 const char *sect_name, size_t sect_size)
+static void
+hppanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                      iterate_over_regset_sections_cb *cb,
+                                      void *cb_data,
+                                      const struct regcache *regcache)
 {
-  if (strcmp (sect_name, ".reg") == 0 && sect_size >= HPPANBSD_SIZEOF_GREGS)
-    return &hppanbsd_gregset;
-
-  return NULL;
+  cb (".reg", HPPANBSD_SIZEOF_GREGS, &hppanbsd_gregset, NULL, cb_data);
 }
 \f
 static void
@@ -204,8 +202,8 @@ hppanbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   hppabsd_init_abi (info, gdbarch);
 
   /* Core file support.  */
-  set_gdbarch_regset_from_core_section
-    (gdbarch, hppanbsd_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, hppanbsd_iterate_over_regset_sections);
 
   tramp_frame_prepend_unwinder (gdbarch, &hppanbsd_sigtramp_si4);
 }
index c5213599198b53a8778b2f4559412ef4c95f93ef..3d2f2175035886517840d431f471a4732a2d90fe 100644 (file)
@@ -140,20 +140,16 @@ static const struct regset hppaobsd_fpregset =
   hppaobsd_supply_fpregset
 };
 
-/* Return the appropriate register set for the core section identified
-   by SECT_NAME and SECT_SIZE.  */
+/* Iterate over supported core file register note sections. */
 
-static const struct regset *
-hppaobsd_regset_from_core_section (struct gdbarch *gdbarch,
-                                 const char *sect_name, size_t sect_size)
+static void
+hppaobsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+                                      iterate_over_regset_sections_cb *cb,
+                                      void *cb_data,
+                                      const struct regcache *regcache)
 {
-  if (strcmp (sect_name, ".reg") == 0 && sect_size >= HPPAOBSD_SIZEOF_GREGS)
-    return &hppaobsd_gregset;
-
-  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= HPPAOBSD_SIZEOF_FPREGS)
-    return &hppaobsd_fpregset;
-
-  return NULL;
+  cb (".reg", HPPAOBSD_SIZEOF_GREGS, &hppaobsd_gregset, NULL, cb_data);
+  cb (".reg2", HPPAOBSD_SIZEOF_FPREGS, &hppaobsd_fpregset, NULL, cb_data);
 }
 \f
 
@@ -164,8 +160,8 @@ hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   hppabsd_init_abi (info, gdbarch);
 
   /* Core file support.  */
-  set_gdbarch_regset_from_core_section
-    (gdbarch, hppaobsd_regset_from_core_section);
+  set_gdbarch_iterate_over_regset_sections
+    (gdbarch, hppaobsd_iterate_over_regset_sections);
 }
 \f