public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
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	[thread overview]
Message-ID: <1400168975-3145-8-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1400168975-3145-1-git-send-email-arnez@linux.vnet.ibm.com>

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;
 }
 \f
 static void
-- 
1.8.4.2

  parent reply	other threads:[~2014-05-15 15:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15 15:49 [PATCH 00/11] Regset rework preparations part 1 Andreas Arnez
2014-05-15 15:49 ` [PATCH 10/11] SPARC: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-05-15 15:49 ` [PATCH 11/11] Drop regset_alloc() Andreas Arnez
2014-05-15 15:49 ` [PATCH 05/11] X86: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-05-15 15:49 ` [PATCH 08/11] SCORE: Replace regset_alloc() invocation by a static regset structure Andreas Arnez
2014-05-15 15:49 ` [PATCH 04/11] ARM: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-05-15 15:49 ` [PATCH 06/11] MIPS: " Andreas Arnez
2014-05-15 15:49 ` [PATCH 09/11] SPARC: Rename register maps from "*regset" to "*regmap" Andreas Arnez
2014-05-15 15:49 ` [PATCH 03/11] AARCH64: Replace regset_alloc() invocations by static regset structures Andreas Arnez
2014-05-15 15:49 ` [PATCH 02/11] Remove 'arch' field from regset structure Andreas Arnez
2014-05-15 15:50 ` [PATCH 01/11] Constify regset structures Andreas Arnez
2014-05-15 15:59 ` Andreas Arnez [this message]
2014-05-19  7:32 ` [PING] [PATCH 00/11] Regset rework preparations part 1 Andreas Arnez
2014-05-20 20:41   ` Maciej W. Rozycki
2014-05-21 10:39   ` Pedro Alves
2014-05-22  7:28     ` Andreas Krebbel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400168975-3145-8-git-send-email-arnez@linux.vnet.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).