gdb: Fix build failure with GCC 7
[deliverable/binutils-gdb.git] / gdb / maint.c
index b43dbf9d9d0c1e1e130d2c78be18d06211b461f7..a0d43ec7c0edd02e2741676a3320437379f99ec5 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for GDB maintenance commands.
 
-   Copyright (C) 1992-2016 Free Software Foundation, Inc.
+   Copyright (C) 1992-2017 Free Software Foundation, Inc.
 
    Written by Fred Fish at Cygnus Support.
 
@@ -178,6 +178,19 @@ maintenance_info_command (char *arg, int from_tty)
             gdb_stdout);
 }
 
+/* The "maintenance check" command is defined as a prefix, with
+   allow_unknown 0.  Therefore, its own definition is called only for
+   "maintenance check" with no args.  */
+
+static void
+maintenance_check_command (char *arg, int from_tty)
+{
+  printf_unfiltered (_("\"maintenance check\" must be followed "
+                      "by the name of a check command.\n"));
+  help_list (maintenancechecklist, "maintenance check ", all_commands,
+            gdb_stdout);
+}
+
 /* Mini tokenizing lexer for 'maint info sections' command.  */
 
 static int
@@ -403,14 +416,11 @@ maintenance_print_architecture (char *args, int from_tty)
     gdbarch_dump (gdbarch, gdb_stdout);
   else
     {
-      struct cleanup *cleanups;
-      struct ui_file *file = gdb_fopen (args, "w");
+      stdio_file file;
 
-      if (file == NULL)
+      if (!file.open (args, "w"))
        perror_with_name (_("maintenance print architecture"));
-      cleanups = make_cleanup_ui_file_delete (file);
-      gdbarch_dump (gdbarch, file);
-      do_cleanups (cleanups);
+      gdbarch_dump (gdbarch, &file);
     }
 }
 
@@ -1107,6 +1117,11 @@ Print the internal architecture configuration.\n\
 Takes an optional file parameter."),
           &maintenanceprintlist);
 
+  add_prefix_cmd ("check", class_maintenance, maintenance_check_command, _("\
+Commands for checking internal gdb state."),
+                 &maintenancechecklist, "maintenance check ", 0,
+                 &maintenancelist);
+
   add_cmd ("translate-address", class_maintenance,
           maintenance_translate_address,
           _("Translate a section name and address to a symbol."),
This page took 0.027375 seconds and 4 git commands to generate.