testsuite: Fix false FAIL in gdb.cp/casts.exp
[deliverable/binutils-gdb.git] / gdb / maint.c
index 1adea2f9e933757de5d30285d694a8b1d7f2fc12..d2c9346b2ee43586f6e257c30d72573e2c79efd2 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for GDB maintenance commands.
 
-   Copyright (C) 1992-2015 Free Software Foundation, Inc.
+   Copyright (C) 1992-2016 Free Software Foundation, Inc.
 
    Written by Fred Fish at Cygnus Support.
 
@@ -24,7 +24,7 @@
 #include "arch-utils.h"
 #include <ctype.h>
 #include <signal.h>
-#include <sys/time.h>
+#include "gdb_sys_time.h"
 #include <time.h>
 #include "command.h"
 #include "gdbcmd.h"
@@ -41,6 +41,7 @@
 #include "top.h"
 #include "timeval-utils.h"
 #include "maint.h"
+#include "selftest.h"
 
 #include "cli/cli-decode.h"
 #include "cli/cli-utils.h"
@@ -303,7 +304,7 @@ print_bfd_section_info (bfd *abfd,
 {
   flagword flags = bfd_get_section_flags (abfd, asect);
   const char *name = bfd_section_name (abfd, asect);
-  const char *arg = datum;
+  const char *arg = (const char *) datum;
 
   if (arg == NULL || *arg == '\0'
       || match_substring (arg, name)
@@ -958,7 +959,6 @@ static void
 set_per_command_cmd (char *args, int from_tty)
 {
   struct cmd_list_element *list;
-  size_t length;
   int val;
 
   val = parse_cli_boolean_value (args);
@@ -981,6 +981,16 @@ show_per_command_cmd (char *args, int from_tty)
 {
   cmd_show_list (per_command_showlist, from_tty, "");
 }
+\f
+
+/* The "maintenance selftest" command.  */
+
+static void
+maintenance_selftest (char *args, int from_tty)
+{
+  run_self_tests ();
+}
+
 \f
 void
 _initialize_maint_cmds (void)
@@ -1154,6 +1164,13 @@ testsuite can check the command deprecator. You probably shouldn't use this,\n\
 If you decide you want to use it: maintenance undeprecate 'commandname'"),
           &maintenancelist);
 
+  add_cmd ("selftest", class_maintenance, maintenance_selftest, _("\
+Run gdb's unit tests.\n\
+Usage: maintenance selftest\n\
+This will run any unit tests that were built in to gdb.\n\
+gdb will abort if any test fails."),
+          &maintenancelist);
+
   add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _("\
 Set watchdog timer."), _("\
 Show watchdog timer."), _("\
This page took 0.024578 seconds and 4 git commands to generate.