From patchwork Fri Sep 12 15:39:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 2799 Received: (qmail 31834 invoked by alias); 12 Sep 2014 15:40:11 -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 31574 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: e06smtp11.uk.ibm.com Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) 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 e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Sep 2014 16:40:04 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 12 Sep 2014 16:40:01 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4F2C017D805A 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 b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8CFe1Y521692570 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 s8CAcQTW014971 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 s8CAcL6q014757; Fri, 12 Sep 2014 06:38:25 -0400 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: "Maciej W . Rozycki" , Daniel Jacobowitz Subject: [PATCH 14/26] MIPS: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Date: Fri, 12 Sep 2014 17:39:44 +0200 Message-Id: <1410536396-25524-15-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-5024-0000-0000-00000145DC0F X-IsSubscribed: yes For MIPS targets, no longer define the gdbarch method 'regset_from_core_section', but the iterator method instead. gdb/ChangeLog: * mips-linux-tdep.c (mips_linux_regset_from_core_section): Remove. (mips_linux_iterate_over_regset_sections): New. (mips_linux_init_abi): Adjust gdbarch initialization. * mips64obsd-tdep.c (mips64obsd_regset_from_core_section): Remove. (mips64obsd_iterate_over_regset_sections): New. (mips64obsd_init_abi): Adjust. * mipsnbsd-tdep.c (mipsnbsd_regset_from_core_section): Remove. (mipsnbsd_iterate_over_regset_sections): New. (mipsnbsd_init_abi): Adjust. --- gdb/mips-linux-tdep.c | 47 +++++++++++++++++------------------------------ gdb/mips64obsd-tdep.c | 20 +++++++++----------- gdb/mipsnbsd-tdep.c | 28 ++++++++++++---------------- 3 files changed, 38 insertions(+), 57 deletions(-) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 5639870..c2cec3d 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -636,39 +636,26 @@ static const struct regset mips64_linux_fpregset = NULL, mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper }; -static const struct regset * -mips_linux_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +mips_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, + iterate_over_regset_sections_cb *cb, + void *cb_data, + const struct regcache *regcache) { - mips_elf_gregset_t gregset; - mips_elf_fpregset_t fpregset; - mips64_elf_gregset_t gregset64; - mips64_elf_fpregset_t fpregset64; - - if (strcmp (sect_name, ".reg") == 0) + if (register_size (gdbarch, MIPS_ZERO_REGNUM) == 4) { - if (sect_size == sizeof (gregset)) - return &mips_linux_gregset; - else if (sect_size == sizeof (gregset64)) - return &mips64_linux_gregset; - else - { - warning (_("wrong size gregset struct in core file")); - } + cb (".reg", sizeof (mips_elf_gregset_t), &mips_linux_gregset, + NULL, cb_data); + cb (".reg2", sizeof (mips_elf_fpregset_t), &mips_linux_fpregset, + NULL, cb_data); } - else if (strcmp (sect_name, ".reg2") == 0) + else { - if (sect_size == sizeof (fpregset)) - return &mips_linux_fpregset; - else if (sect_size == sizeof (fpregset64)) - return &mips64_linux_fpregset; - else - { - warning (_("wrong size fpregset struct in core file")); - } + cb (".reg", sizeof (mips64_elf_gregset_t), &mips64_linux_gregset, + NULL, cb_data); + cb (".reg2", sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset, + NULL, cb_data); } - - return NULL; } static const struct target_desc * @@ -1628,8 +1615,8 @@ mips_linux_init_abi (struct gdbarch_info info, set_gdbarch_core_read_description (gdbarch, mips_linux_core_read_description); - set_gdbarch_regset_from_core_section (gdbarch, - mips_linux_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, mips_linux_iterate_over_regset_sections); set_gdbarch_gdb_signal_from_target (gdbarch, mips_gdb_signal_from_target); diff --git a/gdb/mips64obsd-tdep.c b/gdb/mips64obsd-tdep.c index e312e51..11ff357 100644 --- a/gdb/mips64obsd-tdep.c +++ b/gdb/mips64obsd-tdep.c @@ -64,17 +64,15 @@ static const struct regset mips64obsd_gregset = mips64obsd_supply_gregset }; -/* 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 * -mips64obsd_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +mips64obsd_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 >= MIPS64OBSD_NUM_REGS * 8) - return &mips64obsd_gregset; - - return NULL; + cb (".reg", MIPS64OBSD_NUM_REGS * 8, &mips64obsd_gregset, NULL, cb_data); } @@ -145,8 +143,8 @@ mips64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* OpenBSD/mips64 only supports the n64 ABI, but the braindamaged way GDB works, forces us to pretend we can handle them all. */ - set_gdbarch_regset_from_core_section - (gdbarch, mips64obsd_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, mips64obsd_iterate_over_regset_sections); tramp_frame_prepend_unwinder (gdbarch, &mips64obsd_sigframe); diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index f8aa210..926e7d9 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -112,24 +112,20 @@ static const struct regset mipsnbsd_fpregset = mipsnbsd_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 * -mipsnbsd_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) +static void +mipsnbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, + iterate_over_regset_sections_cb *cb, + void *cb_data, + const struct regcache *regcache) { size_t regsize = mips_isa_regsize (gdbarch); - - if (strcmp (sect_name, ".reg") == 0 - && sect_size >= MIPSNBSD_NUM_GREGS * regsize) - return &mipsnbsd_gregset; - - if (strcmp (sect_name, ".reg2") == 0 - && sect_size >= MIPSNBSD_NUM_FPREGS * regsize) - return &mipsnbsd_fpregset; - return NULL; + cb (".reg", MIPSNBSD_NUM_GREGS * regsize, &mipsnbsd_gregset, + NULL, cb_data); + cb (".reg2", MIPSNBSD_NUM_FPREGS * regsize, &mipsnbsd_fpregset, + NULL, cb_data); } @@ -358,8 +354,8 @@ static void mipsnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { - set_gdbarch_regset_from_core_section - (gdbarch, mipsnbsd_regset_from_core_section); + set_gdbarch_iterate_over_regset_sections + (gdbarch, mipsnbsd_iterate_over_regset_sections); set_gdbarch_get_longjmp_target (gdbarch, mipsnbsd_get_longjmp_target);