This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 07/23] MN10300: Replace regset_alloc() invocations by static regset structures
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: Kevin Buettner <kevinb at redhat dot com>
- Date: Mon, 28 Apr 2014 11:49:01 +0200
- Subject: [RFC 07/23] MN10300: Replace regset_alloc() invocations by static regset structures
- Authentication-results: sourceware.org; auth=none
- References: <87eh0h6bkq dot fsf at br87z6lw dot de dot ibm dot 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;
}
static void
--
1.8.4.2