From patchwork Fri Sep 12 15:39:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 2803 Received: (qmail 32478 invoked by alias); 12 Sep 2014 15:40:15 -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 31763 invoked by uid 89); 12 Sep 2014 15:40:11 -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: e06smtp10.uk.ibm.com Received: from e06smtp10.uk.ibm.com (HELO e06smtp10.uk.ibm.com) (195.75.94.106) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 12 Sep 2014 15:40:09 +0000 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Sep 2014 16:40:05 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Sep 2014 16:40:02 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 70B2A219005E for ; Fri, 12 Sep 2014 16:39:42 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8CFe2qZ37486666 for ; Fri, 12 Sep 2014 15:40:02 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 s8CAcQfq015049 for ; Fri, 12 Sep 2014 06:38:27 -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 s8CAcL6w014757; Fri, 12 Sep 2014 06:38:26 -0400 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Mark Kettenis Subject: [PATCH 20/26] SPARC: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Date: Fri, 12 Sep 2014 17:39:50 +0200 Message-Id: <1410536396-25524-21-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-4966-0000-0000-000001515612 X-IsSubscribed: yes 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/configure.tgt | 2 +- gdb/sparc-tdep.c | 24 ++++++++++-------------- gdb/sparc64fbsd-nat.c | 1 - gdb/sparc64fbsd-tdep.c | 4 ++++ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 3111a2c..9aea728 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -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) diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index bcd4f6e..7eb3b18 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1645,22 +1645,18 @@ sparc_write_pc (struct regcache *regcache, CORE_ADDR pc) } -/* 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); } @@ -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); diff --git a/gdb/sparc64fbsd-nat.c b/gdb/sparc64fbsd-nat.c index 59a2004..67ed8f5 100644 --- a/gdb/sparc64fbsd-nat.c +++ b/gdb/sparc64fbsd-nat.c @@ -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; diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c index 568db72..0ba6c6d 100644 --- a/gdb/sparc64fbsd-tdep.c +++ b/gdb/sparc64fbsd-tdep.c @@ -28,6 +28,7 @@ #include "trad-frame.h" #include "sparc64-tdep.h" +#include "fbsd-tdep.h" #include "solib-svr4.h" /* From . */ @@ -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;