2011-03-01 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / reggroups.c
index 63954f683e0c06b945ac4ae95a8b2c5d601a460e..846b1baf9bfc9f0f8a9b5cc33b069dac915873be 100644 (file)
@@ -1,6 +1,7 @@
 /* Register groupings for GDB, the GNU debugger.
 
-   Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    Contributed by Red Hat.
 
@@ -20,6 +21,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "arch-utils.h"
 #include "reggroups.h"
 #include "gdbtypes.h"
 #include "gdb_assert.h"
@@ -39,6 +41,7 @@ struct reggroup *
 reggroup_new (const char *name, enum reggroup_type type)
 {
   struct reggroup *group = XMALLOC (struct reggroup);
+
   group->name = name;
   group->type = type;
   return group;
@@ -79,6 +82,7 @@ reggroups_init (struct gdbarch *gdbarch)
 {
   struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch,
                                                     struct reggroups);
+
   groups->last = &groups->first;
   return groups;
 }
@@ -188,6 +192,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
       /* Group name.  */
       {
        const char *name;
+
        if (group == NULL)
          name = "Group";
        else
@@ -198,6 +203,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
       /* Group type.  */
       {
        const char *type;
+
        if (group == NULL)
          type = "Type";
        else
@@ -230,15 +236,20 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
 static void
 maintenance_print_reggroups (char *args, int from_tty)
 {
+  struct gdbarch *gdbarch = get_current_arch ();
+
   if (args == NULL)
-    reggroups_dump (current_gdbarch, gdb_stdout);
+    reggroups_dump (gdbarch, gdb_stdout);
   else
     {
+      struct cleanup *cleanups;
       struct ui_file *file = gdb_fopen (args, "w");
+
       if (file == NULL)
        perror_with_name (_("maintenance print reggroups"));
-      reggroups_dump (current_gdbarch, file);    
-      ui_file_delete (file);
+      cleanups = make_cleanup_ui_file_delete (file);
+      reggroups_dump (gdbarch, file);
+      do_cleanups (cleanups);
     }
 }
 
This page took 0.113669 seconds and 4 git commands to generate.