From patchwork Mon Apr 28 09:48:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 702 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 EA6CB36007C for ; Mon, 28 Apr 2014 02:48:17 -0700 (PDT) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14314964) id AE840414D8476; Mon, 28 Apr 2014 02:48:17 -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 8C5E3414D844F for ; Mon, 28 Apr 2014 02:48:17 -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:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=jp5G6 UoqF6i5HqbQ6FIIxozpVNNDoTrbRm9QaPxE9DojHcZDJj+XFlf3Y/Z7wREFdv8II 88kO9RhtaeKEOEyOk4zAWAKzjqvMk5wXj3730WHCVG6neRV9GGYfHBaeaqMWuRw8 gcGpp1HpBBfP3QlGFaEXTe6PAslJMb1HVtsepM= 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:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=MYy23eEAtBq JzaqCU+zECPlKQIg=; b=fTI1IhMA5MFu8UhtNKNv3yB6g0jPEISUca1ms52cNhN YbmPrjemFwqn5eq2YEb1QOWhBlExCQPbLAcSGfkYD1asEF2ELd8JfITrSnT7n9n5 GLatyBgq/SyL7kz6md6qeEWNv6/K1KlQrjB3h98CFCY3oD50HhXuM3ILMsj90NXU = Received: (qmail 30015 invoked by alias); 28 Apr 2014 09:48: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 30002 invoked by uid 89); 28 Apr 2014 09:48:15 -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: 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; Mon, 28 Apr 2014 09:48:14 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 28 Apr 2014 10:48:11 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 28 Apr 2014 10:48:08 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id C5DF91B08066 for ; Mon, 28 Apr 2014 10:48:15 +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.13.8/8.13.8/NCO v10.0) with ESMTP id s3S9m8XA57999512 for ; Mon, 28 Apr 2014 09:48:08 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 s3SAm7Qi005437 for ; Mon, 28 Apr 2014 04:48:08 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-188.boeblingen.de.ibm.com [9.152.212.188]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s3SAm7VC005395; Mon, 28 Apr 2014 04:48:07 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: "Maciej W. Rozycki" , Daniel Jacobowitz Subject: [RFC 06/23] MIPS: Replace regset_alloc() invocations by static regset structures References: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> Date: Mon, 28 Apr 2014 11:48:07 +0200 In-Reply-To: <87eh0h6bkq.fsf@br87z6lw.de.ibm.com> (Andreas Arnez's message of "Mon, 28 Apr 2014 11:35:33 +0200") Message-ID: <87lhup4wfc.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14042809-1948-0000-0000-0000089AFDAC 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);