From patchwork Fri Sep 12 15:39:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 2807 Received: (qmail 1481 invoked by alias); 12 Sep 2014 15:40:26 -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 32762 invoked by uid 89); 12 Sep 2014 15:40:17 -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: e06smtp14.uk.ibm.com Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Sep 2014 15:40:16 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Sep 2014 16:40:12 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Sep 2014 16:40:10 +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 198B417D8024 for ; Fri, 12 Sep 2014 16:42:12 +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 s8CFe2gC44957808 for ; Fri, 12 Sep 2014 15:40:10 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 s8CAcQBD015037 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 s8CAcL6v014757 for ; Fri, 12 Sep 2014 06:38:26 -0400 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 19/26] SH: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Date: Fri, 12 Sep 2014 17:39:49 +0200 Message-Id: <1410536396-25524-20-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-1948-0000-0000-00000118F070 X-IsSubscribed: yes 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/sh-linux-tdep.c | 4 ++++ gdb/sh-tdep.c | 21 +++++++++++---------- gdb/sh-tdep.h | 2 ++ gdb/shnbsd-tdep.c | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c index 19cba41..2cc9fb8 100644 --- a/gdb/sh-linux-tdep.c +++ b/gdb/sh-linux-tdep.c @@ -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); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index c8c36db..d91a292 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -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) { diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h index 5d64c74..da96a84 100644 --- a/gdb/sh-tdep.h +++ b/gdb/sh-tdep.h @@ -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; diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c index 2936661..a81c2a1 100644 --- a/gdb/shnbsd-tdep.c +++ b/gdb/shnbsd-tdep.c @@ -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);