gdb: check result of gdb_fopen_cloexec in dump_binary_file
[binutils-gdb.git] / gdb / cli / cli-decode.h
index a9f9cbfb31e2983470863a6b08b5f2d192202869..e6907a95a844c56bc7859d0de0a0edf0ab0d0744 100644 (file)
@@ -1,6 +1,6 @@
 /* Header file for GDB command decoding library.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
+   Copyright (C) 2000-2021 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include "command.h"
 #include "gdb_regex.h"
 #include "cli-script.h"
+#include "completer.h"
 
-#if 0
-/* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum
-   cmd_types'' can be moved from "command.h" to "cli-decode.h".  */
 /* Not a set/show command.  Note that some commands which begin with
    "set" or "show" might be in this category, if their syntax does
    not fall into one of the following categories.  */
-typedef enum cmd_types
-  {
-    not_set_cmd,
-    set_cmd,
-    show_cmd
-  }
-cmd_types;
-#endif
+enum cmd_types
+{
+  not_set_cmd,
+  set_cmd,
+  show_cmd
+};
 
 /* This structure records one command'd definition.  */
 
@@ -54,6 +50,7 @@ struct cmd_list_element
        deprecated_warn_user (0),
        malloced_replacement (0),
        doc_allocated (0),
+       name_allocated (0),
        hook_in (0),
        allow_unknown (0),
        abbrev_flag (0),
@@ -68,6 +65,8 @@ struct cmd_list_element
     {
       if (doc && doc_allocated)
        xfree ((char *) doc);
+      if (name_allocated)
+       xfree ((char *) name);
     }
 
     DISABLE_COPY_AND_ASSIGN (cmd_list_element);
@@ -90,7 +89,7 @@ struct cmd_list_element
     /* The user needs to be warned that this is a deprecated command.
        The user should only be warned the first time a command is
        used.  */
-        
+       
     unsigned int deprecated_warn_user : 1;
 
     /* When functions are deprecated at compile time (this is the way
@@ -108,6 +107,10 @@ struct cmd_list_element
 
     unsigned int doc_allocated : 1;
 
+    /* Set if the name field should be xfree'd.  */
+
+    unsigned int name_allocated : 1;
+
     /* Flag that specifies if this command is already running its hook.  */
     /* Prevents the possibility of hook recursion.  */
     unsigned int hook_in : 1;
@@ -175,6 +178,10 @@ struct cmd_list_element
     /* Hook for another command to be executed after this command.  */
     struct cmd_list_element *hook_post = nullptr;
 
+    /* Default arguments to automatically prepend to the user
+       provided arguments when running this command or alias.  */
+    std::string default_args;
+
     /* Nonzero identifies a prefix command.  For them, the address
        of the variable containing the list of subcommands.  */
     struct cmd_list_element **prefixlist = nullptr;
@@ -241,9 +248,6 @@ struct cmd_list_element
     int *suppress_notification = nullptr;
   };
 
-extern void help_cmd_list (struct cmd_list_element *, enum command_class,
-                          const char *, int, struct ui_file *);
-
 /* Functions that implement commands about CLI commands.  */
 
 extern void help_cmd (const char *, struct ui_file *);
@@ -257,10 +261,19 @@ extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
 
 extern void not_just_help_class_command (const char *arg, int from_tty);
 
-/* Exported to cli/cli-setshow.c */
+/* Print only the first line of STR on STREAM.
+   FOR_VALUE_PREFIX true indicates that the first line is output
+   to be a prefix to show a value (see deprecated_show_value_hack):
+   the first character is printed in uppercase, and the trailing
+   dot character is not printed.  */
+
+extern void print_doc_line (struct ui_file *stream, const char *str,
+                           bool for_value_prefix);
 
-extern void print_doc_line (struct ui_file *, const char *);
+/* The enums of boolean commands.  */
+extern const char * const boolean_enums[];
 
+/* The enums of auto-boolean commands.  */
 extern const char * const auto_boolean_enums[];
 
 /* Verify whether a given cmd_list_element is a user-defined command.