From patchwork Thu May 15 15:49:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 947 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 056C536006F for ; Thu, 15 May 2014 08:59:59 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id A51A763D61ABB; Thu, 15 May 2014 08:59:59 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.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-mx23.g.dreamhost.com (Postfix) with ESMTPS id 7E1EA63D61AC3 for ; Thu, 15 May 2014 08:59:59 -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=v4zK8spjl/Ndql7MYlaOSaPBe+c6lSm lxUATPhuNuzo7FBXmCDa2HxJYTAtZjJmgLx5cZgSWfBFWaKhjejisHP0Stx2cjnl bCsRFUzUMW7bfzBsyiGDWFXX7AgK4HTw9bsj8PkbQZYvMKP33cq5/TXEBaifdnq3 /fUcRhtKV1is= 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=CWQAo+7cAdBgLbgX0Esfdz7045k=; b=b12EE QYLMIvwmDbwYhzbZOf66ghDvuoCi32zBppEpOzJ3muxk3DPUkWGjcCWfjp8kqu5n BauD3Q4OSsbWSXCdW5eB3Eer42dpn2mKafuYrkFpqc5qcc6OGG3IwNpB9eJRmEUQ jWY5RD1XXZ6mhg8hew2RCrEQK1Y5LHI6buHKkc= Received: (qmail 19979 invoked by alias); 15 May 2014 15:59:58 -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 19969 invoked by uid 89); 15 May 2014 15:59:57 -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:59:56 +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:40 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) 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 b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 67C0417D8047 for ; Thu, 15 May 2014 16:50:46 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4FFnb3e59441396 for ; Thu, 15 May 2014 15:49:37 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 s4FFnano017511 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 s4FFnZVU017450 for ; Thu, 15 May 2014 09:49:36 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Subject: [PATCH 07/11] MN10300: Replace regset_alloc() invocations by static regset structures. Date: Thu, 15 May 2014 17:49:31 +0200 Message-Id: <1400168975-3145-8-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-000009137E32 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On this architecture the change may fix a small memory leak. gdb/ * mn10300-linux-tdep.c (am33_gregset, am33_fpregset): New static regset structures. (am33_regset_from_core_section): Remove dynamic regset allocations. --- gdb/mn10300-linux-tdep.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c index 6acae56..4377463 100644 --- a/gdb/mn10300-linux-tdep.c +++ b/gdb/mn10300-linux-tdep.c @@ -451,6 +451,16 @@ am33_collect_fpregset_method (const struct regset *regset, return; } +static const struct regset am33_gregset = + { + NULL, am33_supply_gregset_method, am33_collect_gregset_method + }; + +static const struct regset am33_fpregset = + { + NULL, am33_supply_fpregset_method, am33_collect_fpregset_method + }; + /* Create a struct regset from a corefile register section. */ static const struct regset * @@ -458,17 +468,10 @@ am33_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size) { - /* We will call regset_alloc, and pass the names of the supply and - collect methods. */ - if (sect_size == sizeof (mn10300_elf_fpregset_t)) - return regset_alloc (gdbarch, - am33_supply_fpregset_method, - am33_collect_fpregset_method); + return &am33_fpregset; else - return regset_alloc (gdbarch, - am33_supply_gregset_method, - am33_collect_gregset_method); + return &am33_gregset; } static void