From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@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 15:59:00 -0000 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-SW-Source: 2014-05/txt/msg00246.txt.bz2 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 -- 1.8.4.2