MN10300: Replace regset_alloc() invocations by static regset structures.
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Fri, 22 Nov 2013 18:43:00 +0000 (18:43 +0000)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Wed, 21 May 2014 15:49:17 +0000 (17:49 +0200)
On this architecture the change may fix a small memory leak.

gdb/ChangeLog
gdb/mn10300-linux-tdep.c

index 989aa3fb211f4a60e27e2a110f0feea916f63105..dbff8772ac9eca83d9f8e002c9a744a32a21f787 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-21  Andreas Arnez  <arnez@linux.vnet.ibm.com>
+
+       * mn10300-linux-tdep.c (am33_gregset, am33_fpregset): New static
+       regset structures.
+       (am33_regset_from_core_section): Remove dynamic regset
+       allocations.
+
 2014-05-21  Andreas Arnez  <arnez@linux.vnet.ibm.com>
 
        * mips-linux-tdep.c (mips_linux_gregset, mips64_linux_gregset)
index 6acae56dbb1b34679bbfcbdcd69391e97e244da2..4377463267cac5e6f8f44802247dbd5f20b8f9d3 100644 (file)
@@ -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
This page took 0.0301 seconds and 4 git commands to generate.