From patchwork Fri Sep 12 15:39:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 2798 Received: (qmail 31891 invoked by alias); 12 Sep 2014 15:40:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31665 invoked by uid 89); 12 Sep 2014 15:40:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp13.uk.ibm.com Received: from e06smtp13.uk.ibm.com (HELO e06smtp13.uk.ibm.com) (195.75.94.109) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Sep 2014 15:40:07 +0000 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Sep 2014 16:40:03 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Sep 2014 16:40:02 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id CCAE717D8066 for ; Fri, 12 Sep 2014 16:42:03 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8CFe1aO35586240 for ; Fri, 12 Sep 2014 15:40:01 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8CAcQ36015021 for ; Fri, 12 Sep 2014 06:38:26 -0400 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s8CAcL6t014757; Fri, 12 Sep 2014 06:38:26 -0400 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Kevin Buettner , Mark Kettenis Subject: [PATCH 17/26] PPC: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Date: Fri, 12 Sep 2014 17:39:47 +0200 Message-Id: <1410536396-25524-18-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1410536396-25524-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1410536396-25524-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14091215-2966-0000-0000-0000011D0BD9 X-IsSubscribed: yes For PPC targets, no longer define the gdbarch method 'regset_from_core_section', but the iterator method instead. gdb/ChangeLog: * configure.tgt (gdb_target_obs): Add fbsd-tdep.o for PowerPC FreeBSD targets. * ppcfbsd-nat.c (_initialize_ppcfbsd_nat): Do not set target method 'make_corefile_notes'. * ppcfbsd-tdep.c (fbsd-tdep.h): Include. (ppcfbsd_regset_from_core_section): Remove. (ppcfbsd_iterate_over_regset_sections): New. (ppcfbsd_init_abi): Call fbsd_init_abi. Adjust gdbarch initialization. * ppcnbsd-tdep.c (ppcnbsd_regset_from_core_section): Remove. (ppcnbsd_iterate_over_regset_sections): New. (ppcnbsd_init_abi): Adjust. * ppcobsd-tdep.c (ppcobsd_regset_from_core_section): Remove. (ppcobsd_iterate_over_regset_sections): New. (ppcobsd_init_abi): Adjust. * rs6000-aix-tdep.c (rs6000_aix_regset_from_core_section): Remove. (rs6000_aix_iterate_over_regset_sections): New. (rs6000_aix_init_osabi): Adjust. --- gdb/configure.tgt | 2 +- gdb/ppcfbsd-nat.c | 1 - gdb/ppcfbsd-tdep.c | 35 ++++++++++++++++++----------------- gdb/ppcnbsd-tdep.c | 24 ++++++++++-------------- gdb/ppcobsd-tdep.c | 20 +++++++++----------- gdb/rs6000-aix-tdep.c | 27 ++++++++++----------------- 6 files changed, 48 insertions(+), 61 deletions(-) diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 4b09d3a..3111a2c 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -415,7 +415,7 @@ nios2*-*-*) powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ - ppcfbsd-tdep.o solib-svr4.o \ + ppcfbsd-tdep.o fbsd-tdep.o solib-svr4.o \ ravenscar-thread.o ppc-ravenscar-thread.o" ;; diff --git a/gdb/ppcfbsd-nat.c b/gdb/ppcfbsd-nat.c index 1b27c6b..1e33764 100644 --- a/gdb/ppcfbsd-nat.c +++ b/gdb/ppcfbsd-nat.c @@ -214,7 +214,6 @@ _initialize_ppcfbsd_nat (void) t->to_store_registers = ppcfbsd_store_inferior_registers; 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); /* Support debugging kernel virtual memory images. */ diff --git a/gdb/ppcfbsd-tdep.c b/gdb/ppcfbsd-tdep.c index b78ccfc..d497c69 100644 --- a/gdb/ppcfbsd-tdep.c +++ b/gdb/ppcfbsd-tdep.c @@ -33,6 +33,7 @@ #include "ppc-tdep.h" #include "ppc64-tdep.h" #include "ppcfbsd-tdep.h" +#include "fbsd-tdep.h" #include "solib-svr4.h" @@ -128,24 +129,21 @@ ppc_fbsd_fpregset (void) return &ppc32_fbsd_fpregset; } -/* 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 * -ppcfbsd_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +ppcfbsd_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 >= 148) - { - if (tdep->wordsize == 4) - return &ppc32_fbsd_gregset; - else - return &ppc64_fbsd_gregset; - } - if (strcmp (sect_name, ".reg2") == 0 && sect_size >= 264) - return &ppc32_fbsd_fpregset; - return NULL; + + if (tdep->wordsize == 4) + cb (".reg", 148, &ppc32_fbsd_gregset, NULL, cb_data); + else + cb (".reg", 296, &ppc64_fbsd_gregset, NULL, cb_data); + cb (".reg2", 264, &ppc32_fbsd_fpregset, NULL, cb_data); } /* Default page size. */ @@ -300,6 +298,9 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + /* Generic FreeBSD support. */ + fbsd_init_abi (info, gdbarch); + /* FreeBSD doesn't support the 128-bit `long double' from the psABI. */ set_gdbarch_long_double_bit (gdbarch, 64); set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); @@ -329,8 +330,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc"); } - set_gdbarch_regset_from_core_section - (gdbarch, ppcfbsd_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, ppcfbsd_iterate_over_regset_sections); set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index a5c1e3d..0028e51 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -51,20 +51,16 @@ const struct regset ppcnbsd_fpregset = ppc_supply_fpregset }; -/* 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 * -ppcnbsd_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +ppcnbsd_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 >= 148) - return &ppcnbsd_gregset; - - if (strcmp (sect_name, ".reg2") == 0 && sect_size >= 264) - return &ppcnbsd_fpregset; - - return NULL; + cb (".reg", 148, &ppcnbsd_gregset, NULL, cb_data); + cb (".reg2", 264, &ppcnbsd_fpregset, NULL, cb_data); } @@ -185,8 +181,8 @@ ppcnbsd_init_abi (struct gdbarch_info info, set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); - set_gdbarch_regset_from_core_section - (gdbarch, ppcnbsd_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, ppcnbsd_iterate_over_regset_sections); tramp_frame_prepend_unwinder (gdbarch, &ppcnbsd_sigtramp); tramp_frame_prepend_unwinder (gdbarch, &ppcnbsd2_sigtramp); diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c index d745dd0..5e8fa43 100644 --- a/gdb/ppcobsd-tdep.c +++ b/gdb/ppcobsd-tdep.c @@ -80,17 +80,15 @@ const struct regset ppcobsd_fpregset = ppc_supply_fpregset }; -/* 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 * -ppcobsd_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +ppcobsd_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 >= 412) - return &ppcobsd_gregset; - - return NULL; + cb (".reg", 412, &ppcobsd_gregset, NULL, cb_data); } @@ -257,8 +255,8 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); - set_gdbarch_regset_from_core_section - (gdbarch, ppcobsd_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, ppcobsd_iterate_over_regset_sections); frame_unwind_append_unwinder (gdbarch, &ppcobsd_sigtramp_frame_unwind); } diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 03dc8c0..0cea0b2 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -147,25 +147,18 @@ static const struct regset rs6000_aix64_regset = rs6000_aix_collect_regset, }; -/* 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 * -rs6000_aix_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +rs6000_aix_iterate_over_regset_sections (struct gdbarch *gdbarch, + iterate_over_regset_sections_cb *cb, + void *cb_data, + const struct regcache *regcache) { if (gdbarch_tdep (gdbarch)->wordsize == 4) - { - if (strcmp (sect_name, ".reg") == 0 && sect_size >= 592) - return &rs6000_aix32_regset; - } + cb (".reg", 592, &rs6000_aix32_regset, NULL, cb_data); else - { - if (strcmp (sect_name, ".reg") == 0 && sect_size >= 576) - return &rs6000_aix64_regset; - } - - return NULL; + cb (".reg", 576, &rs6000_aix64_regset, NULL, cb_data); } @@ -1065,8 +1058,8 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) (gdbarch, rs6000_convert_from_func_ptr_addr); /* Core file support. */ - set_gdbarch_regset_from_core_section - (gdbarch, rs6000_aix_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, rs6000_aix_iterate_over_regset_sections); set_gdbarch_core_xfer_shared_libraries_aix (gdbarch, rs6000_aix_core_xfer_shared_libraries_aix);