SPARC: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections'
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Fri, 29 Nov 2013 17:02:53 +0000 (17:02 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Tue, 30 Sep 2014 07:14:38 +0000 (09:14 +0200)
For SPARC targets, no longer define the gdbarch method
'regset_from_core_section', but the iterator method instead.

gdb/ChangeLog:

* sparc-tdep.c (sparc_regset_from_core_section): Remove.
(sparc_iterate_over_regset_sections): New.
(sparc32_gdbarch_init): Adjust gdbarch initialization.
* configure.tgt (gdb_target_obs): Add fbsd-tdep.o for SPARC FreeBSD
targets.
* sparc64fbsd-tdep.c (fbsd-tdep.h): Include.
(sparc64fbsd_init_abi): Call fbsd_init_abi.
* sparc64fbsd-nat.c (_initialize_sparc64fbsd_nat): Do not set
target method 'make_corefile_notes'.

gdb/ChangeLog
gdb/configure.tgt
gdb/sparc-tdep.c
gdb/sparc64fbsd-nat.c
gdb/sparc64fbsd-tdep.c

index fdbe9819cc37e83ebc01f02712e3d1a6f0badda7..77abe1beb874ab32e069dd72d9e4daf176cd1726 100644 (file)
@@ -1,3 +1,15 @@
+2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * sparc-tdep.c (sparc_regset_from_core_section): Remove.
+       (sparc_iterate_over_regset_sections): New.
+       (sparc32_gdbarch_init): Adjust gdbarch initialization.
+       * configure.tgt (gdb_target_obs): Add fbsd-tdep.o for SPARC FreeBSD
+       targets.
+       * sparc64fbsd-tdep.c (fbsd-tdep.h): Include.
+       (sparc64fbsd_init_abi): Call fbsd_init_abi.
+       * sparc64fbsd-nat.c (_initialize_sparc64fbsd_nat): Do not set
+       target method 'make_corefile_notes'.
+
 2014-09-30  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * sh-linux-tdep.c (sh_linux_init_abi): Set tdep fields
index 3111a2c520d51188ada78cfa67019cb05f7cd406..9aea728cb48af6c990c5fd195961655eeb2baf7d 100644 (file)
@@ -543,7 +543,7 @@ sparc64-*-linux*)
 sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
        # Target: FreeBSD/sparc64
        gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64fbsd-tdep.o \
-                       solib-svr4.o \
+                       fbsd-tdep.o solib-svr4.o \
                        ravenscar-thread.o sparc-ravenscar-thread.o"
        ;;
 sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
index bcd4f6e7464d8e2cb4cfe53ab23e786a7939aed4..7eb3b18b550a8f4d7476eea3fa74b8429fdce6a2 100644 (file)
@@ -1645,22 +1645,18 @@ sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
 }
 \f
 
-/* Return the appropriate register set for the core section identified
-   by SECT_NAME and SECT_SIZE.  */
+/* Iterate over core file register note sections.  */
 
-static const struct regset *
-sparc_regset_from_core_section (struct gdbarch *gdbarch,
-                               const char *sect_name, size_t sect_size)
+static void
+sparc_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 (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
-    return tdep->gregset;
-
-  if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
-    return tdep->fpregset;
-
-  return NULL;
+  cb (".reg", tdep->sizeof_gregset, tdep->gregset, NULL, cb_data);
+  cb (".reg2", tdep->sizeof_fpregset, tdep->fpregset, NULL, cb_data);
 }
 \f
 
@@ -1740,8 +1736,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* If we have register sets, enable the generic core file support.  */
   if (tdep->gregset)
-    set_gdbarch_regset_from_core_section (gdbarch,
-                                         sparc_regset_from_core_section);
+    set_gdbarch_iterate_over_regset_sections
+      (gdbarch, sparc_iterate_over_regset_sections);
 
   register_sparc_ravenscar_ops (gdbarch);
 
index 59a20047f3273fa936af7b830a98a1cf46bc111f..67ed8f50090177e69fa17248476ca06b6ebdd973 100644 (file)
@@ -72,7 +72,6 @@ _initialize_sparc64fbsd_nat (void)
   t = sparc_target ();
   t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
   t->to_find_memory_regions = fbsd_find_memory_regions;
-  t->to_make_corefile_notes = fbsd_make_corefile_notes;
   add_target (t);
 
   sparc_gregmap = &sparc64fbsd_gregmap;
index 568db72f98c93dbee5b3e3dc7c3b07620fe1c3bb..0ba6c6da292c873e22a6bd5ba91fcc536da8715b 100644 (file)
@@ -28,6 +28,7 @@
 #include "trad-frame.h"
 
 #include "sparc64-tdep.h"
+#include "fbsd-tdep.h"
 #include "solib-svr4.h"
 
 /* From <machine/reg.h>.  */
@@ -221,6 +222,9 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  /* Generic FreeBSD support. */
+  fbsd_init_abi (info, gdbarch);
+
   tdep->gregset = &sparc64fbsd_gregset;
   tdep->sizeof_gregset = 256;