From patchwork Thu May 15 15:49:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 941 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 4EE4D36006F for ; Thu, 15 May 2014 08:50:11 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id 1318641C8DAA2; Thu, 15 May 2014 08:50:11 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx20.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTPS id E161941B4386C for ; Thu, 15 May 2014 08:50:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=eQeav5ROUNwAKyRIPPhtOWkhlwzYkKU vPNdx5t4oF7KUbkY3LTCzydcT7t93La9cZtVfVkIAuacnxzSeggUe+oA8tnc0GFt TbdUlYCqbqagy/kSVde+2HjJRjllCZdim3i5eiLGPtaRAe6+d8k0CD8lX7rf+oYq 3G3Ck7cxW9co= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=MYy23eEAtBqJzaqCU+zECPlKQIg=; b=vf2cg mvLLJMzM3IrKTdExEJldANjVF13juac7do04v28w9eQT5WpnfROpGYzaSKWO2Rb2 9zUuyZmyylUH2BwythHknzWOgNZC3tOWvqpthylvgqZL0yvOFGZGVTGzV3VoUJ27 g7wsnDvxIw653bFO+RdbLSRFXxlbkC2Aws6llQ= Received: (qmail 31086 invoked by alias); 15 May 2014 15:49:45 -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 30779 invoked by uid 89); 15 May 2014 15:49:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp16.uk.ibm.com Received: from e06smtp16.uk.ibm.com (HELO e06smtp16.uk.ibm.com) (195.75.94.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 15 May 2014 15:49:41 +0000 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 May 2014 16:49:38 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp16.uk.ibm.com (192.168.101.146) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 15 May 2014 16:49:37 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 141C7219005C for ; Thu, 15 May 2014 16:49:28 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4FFnaAG524682 for ; Thu, 15 May 2014 15:49:36 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s4FFnawI017500 for ; Thu, 15 May 2014 09:49:36 -0600 Received: from br87z6lw.boeblingen.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s4FFnZVT017450 for ; Thu, 15 May 2014 09:49:36 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 06/11] MIPS: Replace regset_alloc() invocations by static regset structures. Date: Thu, 15 May 2014 17:49:30 +0200 Message-Id: <1400168975-3145-7-git-send-email-arnez@linux.vnet.ibm.com> In-Reply-To: <1400168975-3145-1-git-send-email-arnez@linux.vnet.ibm.com> References: <1400168975-3145-1-git-send-email-arnez@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14051515-3548-0000-0000-000009137E30 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in After removal of the regset_alloc invocations, the appropriate tdep fields become obsolete and are thus removed. gdb/ * mips-linux-tdep.c (mips_linux_gregset, mips64_linux_gregset) (mips_linux_fpregset, mips64_linux_fpregset): New static regset structures. (mips_linux_regset_from_core_section): Remove dynamic regset allocations. * mips-tdep.h (struct gdbarch_tdep): Remove fields 'gregset', 'gregset64', 'fpregset', and 'fpregset64'. * mips-tdep.c (mips_gdbarch_init): Remove initialization of deleted tdep fields. --- gdb/mips-linux-tdep.c | 53 +++++++++++++++++++++++---------------------------- gdb/mips-tdep.c | 4 ---- gdb/mips-tdep.h | 8 -------- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 61bea6c..a975db6 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -618,11 +618,30 @@ mips64_fill_fpregset_wrapper (const struct regset *regset, mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *)gregs, regnum); } +static const struct regset mips_linux_gregset = + { + NULL, mips_supply_gregset_wrapper, mips_fill_gregset_wrapper + }; + +static const struct regset mips64_linux_gregset = + { + NULL, mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper + }; + +static const struct regset mips_linux_fpregset = + { + NULL, mips_supply_fpregset_wrapper, mips_fill_fpregset_wrapper + }; + +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) { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); mips_elf_gregset_t gregset; mips_elf_fpregset_t fpregset; mips64_elf_gregset_t gregset64; @@ -631,21 +650,9 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch, if (strcmp (sect_name, ".reg") == 0) { if (sect_size == sizeof (gregset)) - { - if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, - mips_supply_gregset_wrapper, - mips_fill_gregset_wrapper); - return tdep->gregset; - } + return &mips_linux_gregset; else if (sect_size == sizeof (gregset64)) - { - if (tdep->gregset64 == NULL) - tdep->gregset64 = regset_alloc (gdbarch, - mips64_supply_gregset_wrapper, - mips64_fill_gregset_wrapper); - return tdep->gregset64; - } + return &mips64_linux_gregset; else { warning (_("wrong size gregset struct in core file")); @@ -654,21 +661,9 @@ mips_linux_regset_from_core_section (struct gdbarch *gdbarch, else if (strcmp (sect_name, ".reg2") == 0) { if (sect_size == sizeof (fpregset)) - { - if (tdep->fpregset == NULL) - tdep->fpregset = regset_alloc (gdbarch, - mips_supply_fpregset_wrapper, - mips_fill_fpregset_wrapper); - return tdep->fpregset; - } + return &mips_linux_fpregset; else if (sect_size == sizeof (fpregset64)) - { - if (tdep->fpregset64 == NULL) - tdep->fpregset64 = regset_alloc (gdbarch, - mips64_supply_fpregset_wrapper, - mips64_fill_fpregset_wrapper); - return tdep->fpregset64; - } + return &mips64_linux_fpregset; else { warning (_("wrong size fpregset struct in core file")); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 606b150..c3e8e77 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -8327,10 +8327,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->mips_fpu_type = fpu_type; tdep->register_size_valid_p = 0; tdep->register_size = 0; - tdep->gregset = NULL; - tdep->gregset64 = NULL; - tdep->fpregset = NULL; - tdep->fpregset64 = NULL; if (info.target_desc) { diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h index 31e9601..ba29952 100644 --- a/gdb/mips-tdep.h +++ b/gdb/mips-tdep.h @@ -109,14 +109,6 @@ struct gdbarch_tdep int register_size_valid_p; int register_size; - /* General-purpose registers. */ - struct regset *gregset; - struct regset *gregset64; - - /* Floating-point registers. */ - struct regset *fpregset; - struct regset *fpregset64; - /* Return the expected next PC if FRAME is stopped at a syscall instruction. */ CORE_ADDR (*syscall_next_pc) (struct frame_info *frame);