1 1.1 christos /* Header file for command creation. 2 1.1 christos 3 1.11 christos Copyright (C) 1986-2024 Free Software Foundation, Inc. 4 1.1 christos 5 1.1 christos This program is free software; you can redistribute it and/or modify 6 1.1 christos it under the terms of the GNU General Public License as published by 7 1.1 christos the Free Software Foundation; either version 3 of the License, or 8 1.1 christos (at your option) any later version. 9 1.1 christos 10 1.1 christos This program is distributed in the hope that it will be useful, 11 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 12 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 1.1 christos GNU General Public License for more details. 14 1.1 christos 15 1.1 christos You should have received a copy of the GNU General Public License 16 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 1.1 christos 18 1.1 christos #if !defined (COMMAND_H) 19 1.1 christos #define COMMAND_H 1 20 1.1 christos 21 1.9 christos #include "gdbsupport/gdb_vecs.h" 22 1.9 christos #include "gdbsupport/scoped_restore.h" 23 1.8 christos 24 1.8 christos struct completion_tracker; 25 1.1 christos 26 1.1 christos /* This file defines the public interface for any code wanting to 27 1.1 christos create commands. */ 28 1.1 christos 29 1.1 christos /* Command classes are top-level categories into which commands are 30 1.1 christos broken down for "help" purposes. 31 1.1 christos 32 1.9 christos The class_alias is used for the user-defined aliases, defined 33 1.9 christos using the "alias" command. 34 1.9 christos 35 1.9 christos Aliases pre-defined by GDB (e.g. the alias "bt" of the "backtrace" command) 36 1.9 christos are not using the class_alias. 37 1.9 christos Different pre-defined aliases of the same command do not necessarily 38 1.9 christos have the same classes. For example, class_stack is used for the 39 1.9 christos "backtrace" and its "bt" alias", while "info stack" (also an alias 40 1.9 christos of "backtrace" uses class_info. */ 41 1.1 christos 42 1.1 christos enum command_class 43 1.1 christos { 44 1.9 christos /* Classes of commands followed by a comment giving the name 45 1.9 christos to use in "help <classname>". 46 1.9 christos Note that help accepts unambiguous abbreviated class names. */ 47 1.9 christos 48 1.9 christos /* Special classes to help_list */ 49 1.9 christos all_classes = -2, /* help without <classname> */ 50 1.9 christos all_commands = -1, /* all */ 51 1.9 christos 52 1.1 christos /* Classes of commands */ 53 1.9 christos no_class = -1, 54 1.9 christos class_run = 0, /* running */ 55 1.9 christos class_vars, /* data */ 56 1.9 christos class_stack, /* stack */ 57 1.9 christos class_files, /* files */ 58 1.9 christos class_support, /* support */ 59 1.9 christos class_info, /* status */ 60 1.9 christos class_breakpoint, /* breakpoints */ 61 1.9 christos class_trace, /* tracepoints */ 62 1.9 christos class_alias, /* aliases */ 63 1.9 christos class_bookmark, 64 1.9 christos class_obscure, /* obscure */ 65 1.9 christos class_maintenance, /* internals */ 66 1.9 christos class_tui, /* text-user-interface */ 67 1.9 christos class_user, /* user-defined */ 68 1.9 christos 69 1.9 christos /* Used for "show" commands that have no corresponding "set" command. */ 70 1.9 christos no_set_class 71 1.1 christos }; 72 1.1 christos 73 1.1 christos /* Types of "set" or "show" command. */ 74 1.10 christos enum var_types 75 1.1 christos { 76 1.9 christos /* "on" or "off". *VAR is a bool which is true for on, 77 1.9 christos false for off. */ 78 1.1 christos var_boolean, 79 1.1 christos 80 1.1 christos /* "on" / "true" / "enable" or "off" / "false" / "disable" or 81 1.1 christos "auto. *VAR is an ``enum auto_boolean''. NOTE: In general a 82 1.1 christos custom show command will need to be implemented - one that for 83 1.1 christos "auto" prints both the "auto" and the current auto-selected 84 1.1 christos value. */ 85 1.1 christos var_auto_boolean, 86 1.1 christos 87 1.11 christos /* Unsigned Integer. *VAR is an unsigned int. In the Guile and Python 88 1.11 christos APIs 0 means unlimited, which is stored in *VAR as UINT_MAX. */ 89 1.1 christos var_uinteger, 90 1.1 christos 91 1.11 christos /* Like var_uinteger but signed. *VAR is an int. In the Guile and 92 1.11 christos Python APIs 0 means unlimited, which is stored in *VAR as INT_MAX. */ 93 1.1 christos var_integer, 94 1.1 christos 95 1.11 christos /* Like var_integer but negative numbers are not allowed, 96 1.11 christos except for special values. *VAR is an int. */ 97 1.11 christos var_pinteger, 98 1.11 christos 99 1.1 christos /* String which the user enters with escapes (e.g. the user types 100 1.1 christos \n and it is a real newline in the stored string). 101 1.10 christos *VAR is a std::string, "" if the string is empty. */ 102 1.1 christos var_string, 103 1.1 christos /* String which stores what the user types verbatim. 104 1.10 christos *VAR is std::string, "" if the string is empty. */ 105 1.1 christos var_string_noescape, 106 1.10 christos /* String which stores a filename. (*VAR) is a std::string, 107 1.10 christos "" if the string was empty. */ 108 1.1 christos var_optional_filename, 109 1.10 christos /* String which stores a filename. (*VAR) is a std::string. */ 110 1.1 christos var_filename, 111 1.1 christos /* Enumerated type. Can only have one of the specified values. 112 1.1 christos *VAR is a char pointer to the name of the element that we 113 1.1 christos find. */ 114 1.1 christos var_enum 115 1.10 christos }; 116 1.10 christos 117 1.11 christos /* A structure describing an extra literal accepted and shown in place 118 1.11 christos of a number. */ 119 1.11 christos struct literal_def 120 1.11 christos { 121 1.11 christos /* The literal to define, e.g. "unlimited". */ 122 1.11 christos const char *literal; 123 1.11 christos 124 1.11 christos /* The number to substitute internally for LITERAL or VAL; 125 1.11 christos the use of this number is not allowed (unless the same as VAL). */ 126 1.11 christos LONGEST use; 127 1.11 christos 128 1.11 christos /* An optional number accepted that stands for the literal. */ 129 1.11 christos std::optional<LONGEST> val; 130 1.11 christos }; 131 1.11 christos 132 1.10 christos /* Return true if a setting of type VAR_TYPE is backed with type T. 133 1.10 christos 134 1.10 christos This function is left without definition intentionally. This template is 135 1.10 christos specialized for all valid types that are used to back var_types. Therefore 136 1.10 christos if one tries to instantiate this un-specialized template it means the T 137 1.10 christos parameter is not a type used to back a var_type and it is most likely a 138 1.10 christos programming error. */ 139 1.10 christos template<typename T> 140 1.10 christos bool var_type_uses (var_types var_type) = delete; 141 1.10 christos 142 1.10 christos /* Return true if a setting of type T is backed by a bool variable. */ 143 1.10 christos template<> 144 1.10 christos inline bool var_type_uses<bool> (var_types t) 145 1.10 christos { 146 1.10 christos return t == var_boolean; 147 1.10 christos }; 148 1.10 christos 149 1.10 christos /* Return true if a setting of type T is backed by a auto_boolean variable. 150 1.10 christos */ 151 1.10 christos template<> 152 1.10 christos inline bool var_type_uses<enum auto_boolean> (var_types t) 153 1.10 christos { 154 1.10 christos return t == var_auto_boolean; 155 1.10 christos } 156 1.10 christos 157 1.10 christos /* Return true if a setting of type T is backed by an unsigned int variable. 158 1.10 christos */ 159 1.10 christos template<> 160 1.10 christos inline bool var_type_uses<unsigned int> (var_types t) 161 1.10 christos { 162 1.11 christos return t == var_uinteger; 163 1.10 christos } 164 1.10 christos 165 1.10 christos /* Return true if a setting of type T is backed by an int variable. */ 166 1.10 christos template<> 167 1.10 christos inline bool var_type_uses<int> (var_types t) 168 1.10 christos { 169 1.11 christos return t == var_integer || t == var_pinteger; 170 1.10 christos } 171 1.10 christos 172 1.10 christos /* Return true if a setting of type T is backed by a std::string variable. */ 173 1.10 christos template<> 174 1.10 christos inline bool var_type_uses<std::string> (var_types t) 175 1.10 christos { 176 1.10 christos return (t == var_string || t == var_string_noescape 177 1.10 christos || t == var_optional_filename || t == var_filename); 178 1.10 christos } 179 1.10 christos 180 1.10 christos /* Return true if a setting of type T is backed by a const char * variable. 181 1.10 christos */ 182 1.10 christos template<> 183 1.10 christos inline bool var_type_uses<const char *> (var_types t) 184 1.10 christos { 185 1.10 christos return t == var_enum; 186 1.10 christos } 187 1.10 christos 188 1.10 christos template<bool is_scalar, typename T> struct setting_func_types_1; 189 1.10 christos 190 1.10 christos template<typename T> 191 1.10 christos struct setting_func_types_1<true, T> 192 1.10 christos { 193 1.10 christos using type = T; 194 1.10 christos using set = void (*) (type); 195 1.10 christos using get = type (*) (); 196 1.10 christos }; 197 1.10 christos 198 1.10 christos template<typename T> 199 1.10 christos struct setting_func_types_1<false, T> 200 1.10 christos { 201 1.10 christos using type = const T &; 202 1.10 christos using set = void (*) (type); 203 1.10 christos using get = type (*) (); 204 1.10 christos }; 205 1.10 christos 206 1.10 christos template<typename T> 207 1.10 christos struct setting_func_types 208 1.10 christos { 209 1.10 christos using type = typename setting_func_types_1<std::is_scalar<T>::value, T>::type; 210 1.10 christos using set = typename setting_func_types_1<std::is_scalar<T>::value, T>::set; 211 1.10 christos using get = typename setting_func_types_1<std::is_scalar<T>::value, T>::get; 212 1.10 christos }; 213 1.10 christos 214 1.10 christos /* Generic/type-erased function pointer. */ 215 1.10 christos 216 1.10 christos using erased_func = void (*) (); 217 1.10 christos 218 1.10 christos /* Interface for getting and setting a setting's value. 219 1.10 christos 220 1.10 christos The underlying data can be of any VAR_TYPES type. */ 221 1.10 christos struct setting 222 1.10 christos { 223 1.10 christos /* Create a setting backed by a variable of type T. 224 1.10 christos 225 1.10 christos Type T must match the var type VAR_TYPE (see VAR_TYPE_USES). */ 226 1.10 christos template<typename T> 227 1.11 christos setting (var_types var_type, T *var, 228 1.11 christos const literal_def *extra_literals = nullptr) 229 1.11 christos : m_var_type (var_type), m_var (var), m_extra_literals (extra_literals) 230 1.10 christos { 231 1.10 christos gdb_assert (var != nullptr); 232 1.10 christos gdb_assert (var_type_uses<T> (var_type)); 233 1.10 christos } 234 1.10 christos 235 1.10 christos /* A setting can also be constructed with a pre-validated 236 1.10 christos type-erased variable. Use the following function to 237 1.10 christos validate & type-erase said variable/function pointers. */ 238 1.10 christos 239 1.10 christos struct erased_args 240 1.10 christos { 241 1.10 christos void *var; 242 1.10 christos erased_func setter; 243 1.10 christos erased_func getter; 244 1.10 christos }; 245 1.10 christos 246 1.10 christos template<typename T> 247 1.10 christos static erased_args erase_args (var_types var_type, 248 1.10 christos T *var, 249 1.10 christos typename setting_func_types<T>::set set_setting_func, 250 1.10 christos typename setting_func_types<T>::get get_setting_func) 251 1.10 christos { 252 1.10 christos gdb_assert (var_type_uses<T> (var_type)); 253 1.10 christos /* The getter and the setter must be both provided or both omitted. */ 254 1.10 christos gdb_assert 255 1.10 christos ((set_setting_func == nullptr) == (get_setting_func == nullptr)); 256 1.10 christos 257 1.10 christos /* The caller must provide a pointer to a variable or get/set functions, but 258 1.10 christos not both. */ 259 1.10 christos gdb_assert ((set_setting_func == nullptr) != (var == nullptr)); 260 1.10 christos 261 1.10 christos return { 262 1.10 christos var, 263 1.10 christos reinterpret_cast<erased_func> (set_setting_func), 264 1.10 christos reinterpret_cast<erased_func> (get_setting_func) 265 1.10 christos }; 266 1.1 christos } 267 1.10 christos 268 1.11 christos /* Create a setting backed by pre-validated type-erased args and using 269 1.11 christos EXTRA_LITERALS. ERASED_VAR's fields' real types must match the var 270 1.11 christos type VAR_TYPE (see VAR_TYPE_USES). */ 271 1.11 christos setting (var_types var_type, const literal_def *extra_literals, 272 1.11 christos const erased_args &args) 273 1.10 christos : m_var_type (var_type), 274 1.10 christos m_var (args.var), 275 1.11 christos m_extra_literals (extra_literals), 276 1.10 christos m_getter (args.getter), 277 1.10 christos m_setter (args.setter) 278 1.10 christos { 279 1.10 christos } 280 1.10 christos 281 1.10 christos /* Create a setting backed by setter and getter functions. 282 1.10 christos 283 1.10 christos Type T must match the var type VAR_TYPE (see VAR_TYPE_USES). */ 284 1.10 christos template<typename T> 285 1.10 christos setting (var_types var_type, 286 1.10 christos typename setting_func_types<T>::set setter, 287 1.10 christos typename setting_func_types<T>::get getter) 288 1.10 christos : m_var_type (var_type) 289 1.10 christos { 290 1.10 christos gdb_assert (var_type_uses<T> (var_type)); 291 1.10 christos 292 1.10 christos /* Getters and setters are cast to and from the arbitrary `void (*) ()` 293 1.10 christos function pointer type. Make sure that the two types are really of the 294 1.10 christos same size. */ 295 1.11 christos static_assert (sizeof (m_getter) == sizeof (getter)); 296 1.11 christos static_assert (sizeof (m_setter) == sizeof (setter)); 297 1.10 christos 298 1.10 christos m_getter = reinterpret_cast<erased_func> (getter); 299 1.10 christos m_setter = reinterpret_cast<erased_func> (setter); 300 1.10 christos } 301 1.10 christos 302 1.10 christos /* Access the type of the current setting. */ 303 1.10 christos var_types type () const 304 1.10 christos { return m_var_type; } 305 1.10 christos 306 1.11 christos /* Access any extra literals accepted. */ 307 1.11 christos const literal_def *extra_literals () const 308 1.11 christos { return m_extra_literals; } 309 1.11 christos 310 1.10 christos /* Return the current value. 311 1.10 christos 312 1.10 christos The template parameter T is the type of the variable used to store the 313 1.10 christos setting. */ 314 1.10 christos template<typename T> 315 1.10 christos typename setting_func_types<T>::type get () const 316 1.10 christos { 317 1.10 christos gdb_assert (var_type_uses<T> (m_var_type)); 318 1.10 christos 319 1.10 christos if (m_var == nullptr) 320 1.10 christos { 321 1.10 christos gdb_assert (m_getter != nullptr); 322 1.10 christos auto getter = reinterpret_cast<typename setting_func_types<T>::get> (m_getter); 323 1.10 christos return getter (); 324 1.10 christos } 325 1.10 christos else 326 1.10 christos return *static_cast<const T *> (m_var); 327 1.10 christos } 328 1.10 christos 329 1.10 christos /* Sets the value of the setting to V. Returns true if the setting was 330 1.10 christos effectively changed, false if the update failed and the setting is left 331 1.10 christos unchanged. 332 1.10 christos 333 1.10 christos If we have a user-provided setter, use it to set the setting. Otherwise 334 1.10 christos copy the value V to the internally referenced buffer. 335 1.10 christos 336 1.10 christos The template parameter T indicates the type of the variable used to store 337 1.10 christos the setting. 338 1.10 christos 339 1.10 christos The var_type of the setting must match T. */ 340 1.10 christos template<typename T> 341 1.10 christos bool set (const T &v) 342 1.10 christos { 343 1.10 christos /* Check that the current instance is of one of the supported types for 344 1.10 christos this instantiation. */ 345 1.10 christos gdb_assert (var_type_uses<T> (m_var_type)); 346 1.10 christos 347 1.10 christos const T old_value = this->get<T> (); 348 1.10 christos 349 1.10 christos if (m_var == nullptr) 350 1.10 christos { 351 1.10 christos gdb_assert (m_setter != nullptr); 352 1.10 christos auto setter = reinterpret_cast<typename setting_func_types<T>::set> (m_setter); 353 1.10 christos setter (v); 354 1.10 christos } 355 1.10 christos else 356 1.10 christos *static_cast<T *> (m_var) = v; 357 1.10 christos 358 1.10 christos return old_value != this->get<T> (); 359 1.10 christos } 360 1.10 christos 361 1.10 christos private: 362 1.10 christos /* The type of the variable M_VAR is pointing to, or that M_GETTER / M_SETTER 363 1.10 christos get or set. */ 364 1.10 christos var_types m_var_type; 365 1.10 christos 366 1.10 christos /* Pointer to the enclosed variable 367 1.10 christos 368 1.10 christos Either M_VAR is non-nullptr, or both M_GETTER and M_SETTER are 369 1.10 christos non-nullptr. */ 370 1.10 christos void *m_var = nullptr; 371 1.10 christos 372 1.11 christos /* Any extra literals accepted. */ 373 1.11 christos const literal_def *m_extra_literals = nullptr; 374 1.11 christos 375 1.10 christos /* Pointer to a user provided getter. */ 376 1.10 christos erased_func m_getter = nullptr; 377 1.10 christos 378 1.10 christos /* Pointer to a user provided setter. */ 379 1.10 christos erased_func m_setter = nullptr; 380 1.10 christos }; 381 1.1 christos 382 1.1 christos /* This structure records one command'd definition. */ 383 1.1 christos struct cmd_list_element; 384 1.1 christos 385 1.10 christos /* The "simple" signature of command callbacks, which doesn't include a 386 1.10 christos cmd_list_element parameter. */ 387 1.10 christos 388 1.10 christos typedef void cmd_simple_func_ftype (const char *args, int from_tty); 389 1.3 christos 390 1.6 christos /* This structure specifies notifications to be suppressed by a cli 391 1.6 christos command interpreter. */ 392 1.6 christos 393 1.6 christos struct cli_suppress_notification 394 1.6 christos { 395 1.6 christos /* Inferior, thread, frame selected notification suppressed? */ 396 1.10 christos bool user_selected_context = false; 397 1.10 christos 398 1.10 christos /* Normal stop event suppressed? */ 399 1.10 christos bool normal_stop = false; 400 1.6 christos }; 401 1.6 christos 402 1.6 christos extern struct cli_suppress_notification cli_suppress_notification; 403 1.6 christos 404 1.1 christos /* Forward-declarations of the entry-points of cli/cli-decode.c. */ 405 1.1 christos 406 1.1 christos /* API to the manipulation of command lists. */ 407 1.1 christos 408 1.9 christos /* Return TRUE if NAME is a valid user-defined command name. 409 1.9 christos This is a stricter subset of all gdb commands, 410 1.9 christos see find_command_name_length. */ 411 1.9 christos 412 1.9 christos extern bool valid_user_defined_cmd_name_p (const char *name); 413 1.9 christos 414 1.9 christos /* Return TRUE if C is a valid command character. */ 415 1.9 christos 416 1.9 christos extern bool valid_cmd_char_p (int c); 417 1.1 christos 418 1.10 christos /* Return value type for the add_setshow_* functions. */ 419 1.10 christos 420 1.10 christos struct set_show_commands 421 1.10 christos { 422 1.10 christos cmd_list_element *set, *show; 423 1.10 christos }; 424 1.10 christos 425 1.8 christos /* Const-correct variant of the above. */ 426 1.8 christos 427 1.8 christos extern struct cmd_list_element *add_cmd (const char *, enum command_class, 428 1.10 christos cmd_simple_func_ftype *fun, 429 1.8 christos const char *, 430 1.8 christos struct cmd_list_element **); 431 1.8 christos 432 1.8 christos /* Like add_cmd, but no command function is specified. */ 433 1.8 christos 434 1.1 christos extern struct cmd_list_element *add_cmd (const char *, enum command_class, 435 1.3 christos const char *, 436 1.1 christos struct cmd_list_element **); 437 1.1 christos 438 1.8 christos extern struct cmd_list_element *add_cmd_suppress_notification 439 1.8 christos (const char *name, enum command_class theclass, 440 1.10 christos cmd_simple_func_ftype *fun, const char *doc, 441 1.8 christos struct cmd_list_element **list, 442 1.10 christos bool *suppress_notification); 443 1.1 christos 444 1.7 christos extern struct cmd_list_element *add_alias_cmd (const char *, 445 1.7 christos cmd_list_element *, 446 1.7 christos enum command_class, int, 447 1.7 christos struct cmd_list_element **); 448 1.7 christos 449 1.7 christos 450 1.1 christos extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class, 451 1.10 christos cmd_simple_func_ftype *fun, 452 1.3 christos const char *, 453 1.1 christos struct cmd_list_element **, 454 1.10 christos int, 455 1.1 christos struct cmd_list_element **); 456 1.1 christos 457 1.9 christos /* Like add_prefix_cmd, but sets the callback to a function that 458 1.9 christos simply calls help_list. */ 459 1.9 christos 460 1.9 christos extern struct cmd_list_element *add_basic_prefix_cmd 461 1.9 christos (const char *, enum command_class, const char *, struct cmd_list_element **, 462 1.10 christos int, struct cmd_list_element **); 463 1.9 christos 464 1.9 christos /* Like add_prefix_cmd, but useful for "show" prefixes. This sets the 465 1.9 christos callback to a function that simply calls cmd_show_list. */ 466 1.9 christos 467 1.9 christos extern struct cmd_list_element *add_show_prefix_cmd 468 1.9 christos (const char *, enum command_class, const char *, struct cmd_list_element **, 469 1.10 christos int, struct cmd_list_element **); 470 1.10 christos 471 1.10 christos /* Add matching set and show commands using add_basic_prefix_cmd and 472 1.10 christos add_show_prefix_cmd. */ 473 1.10 christos 474 1.10 christos extern set_show_commands add_setshow_prefix_cmd 475 1.10 christos (const char *name, command_class theclass, const char *set_doc, 476 1.10 christos const char *show_doc, 477 1.10 christos cmd_list_element **set_subcommands_list, 478 1.10 christos cmd_list_element **show_subcommands_list, 479 1.10 christos cmd_list_element **set_list, 480 1.10 christos cmd_list_element **show_list); 481 1.9 christos 482 1.8 christos extern struct cmd_list_element *add_prefix_cmd_suppress_notification 483 1.8 christos (const char *name, enum command_class theclass, 484 1.10 christos cmd_simple_func_ftype *fun, 485 1.10 christos const char *doc, struct cmd_list_element **subcommands, 486 1.10 christos int allow_unknown, 487 1.8 christos struct cmd_list_element **list, 488 1.10 christos bool *suppress_notification); 489 1.8 christos 490 1.1 christos extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *, 491 1.1 christos enum command_class, 492 1.10 christos cmd_simple_func_ftype *fun, 493 1.3 christos const char *, 494 1.1 christos struct cmd_list_element 495 1.10 christos **, int, 496 1.1 christos struct cmd_list_element 497 1.1 christos **); 498 1.1 christos 499 1.10 christos typedef void cmd_func_ftype (const char *args, int from_tty, 500 1.10 christos cmd_list_element *c); 501 1.1 christos 502 1.8 christos /* A completion routine. Add possible completions to tracker. 503 1.1 christos 504 1.8 christos TEXT is the text beyond what was matched for the command itself 505 1.8 christos (leading whitespace is skipped). It stops where we are supposed to 506 1.8 christos stop completing (rl_point) and is '\0' terminated. WORD points in 507 1.8 christos the same buffer as TEXT, and completions should be returned 508 1.8 christos relative to this position. For example, suppose TEXT is "foo" and 509 1.8 christos we want to complete to "foobar". If WORD is "oo", return "oobar"; 510 1.8 christos if WORD is "baz/foo", return "baz/foobar". */ 511 1.8 christos typedef void completer_ftype (struct cmd_list_element *, 512 1.8 christos completion_tracker &tracker, 513 1.8 christos const char *text, const char *word); 514 1.8 christos 515 1.8 christos /* Same, but for set_cmd_completer_handle_brkchars. */ 516 1.8 christos typedef void completer_handle_brkchars_ftype (struct cmd_list_element *, 517 1.8 christos completion_tracker &tracker, 518 1.8 christos const char *text, const char *word); 519 1.3 christos 520 1.1 christos extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *); 521 1.1 christos 522 1.3 christos /* Set the completer_handle_brkchars callback. */ 523 1.3 christos 524 1.3 christos extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *, 525 1.8 christos completer_handle_brkchars_ftype *); 526 1.3 christos 527 1.1 christos /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs 528 1.1 christos around in cmd objects to test the value of the commands sfunc(). */ 529 1.10 christos extern int cmd_simple_func_eq (struct cmd_list_element *cmd, 530 1.10 christos cmd_simple_func_ftype *cfun); 531 1.1 christos 532 1.1 christos /* Execute CMD's pre/post hook. Throw an error if the command fails. 533 1.1 christos If already executing this pre/post hook, or there is no pre/post 534 1.1 christos hook, the call is silently ignored. */ 535 1.1 christos extern void execute_cmd_pre_hook (struct cmd_list_element *cmd); 536 1.1 christos extern void execute_cmd_post_hook (struct cmd_list_element *cmd); 537 1.1 christos 538 1.1 christos /* Flag for an ambiguous cmd_list result. */ 539 1.1 christos #define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1) 540 1.1 christos 541 1.1 christos extern struct cmd_list_element *lookup_cmd (const char **, 542 1.7 christos struct cmd_list_element *, 543 1.7 christos const char *, 544 1.9 christos std::string *, 545 1.1 christos int, int); 546 1.1 christos 547 1.10 christos /* This routine takes a line of TEXT and a CLIST in which to start the 548 1.10 christos lookup. When it returns it will have incremented the text pointer past 549 1.10 christos the section of text it matched, set *RESULT_LIST to point to the list in 550 1.10 christos which the last word was matched, and will return a pointer to the cmd 551 1.10 christos list element which the text matches. It will return NULL if no match at 552 1.10 christos all was possible. It will return -1 (cast appropriately, ick) if ambigous 553 1.10 christos matches are possible; in this case *RESULT_LIST will be set to point to 554 1.10 christos the list in which there are ambiguous choices (and *TEXT will be set to 555 1.10 christos the ambiguous text string). 556 1.10 christos 557 1.10 christos if DEFAULT_ARGS is not null, *DEFAULT_ARGS is set to the found command 558 1.10 christos default args (possibly empty). 559 1.10 christos 560 1.10 christos If the located command was an abbreviation, this routine returns the base 561 1.10 christos command of the abbreviation. Note that *DEFAULT_ARGS will contain the 562 1.10 christos default args defined for the alias. 563 1.10 christos 564 1.10 christos It does no error reporting whatsoever; control will always return 565 1.10 christos to the superior routine. 566 1.10 christos 567 1.10 christos In the case of an ambiguous return (-1), *RESULT_LIST will be set to point 568 1.10 christos at the prefix_command (ie. the best match) *or* (special case) will be NULL 569 1.10 christos if no prefix command was ever found. For example, in the case of "info a", 570 1.10 christos "info" matches without ambiguity, but "a" could be "args" or "address", so 571 1.10 christos *RESULT_LIST is set to the cmd_list_element for "info". So in this case 572 1.10 christos RESULT_LIST should not be interpreted as a pointer to the beginning of a 573 1.10 christos list; it simply points to a specific command. In the case of an ambiguous 574 1.10 christos return *TEXT is advanced past the last non-ambiguous prefix (e.g. 575 1.10 christos "info t" can be "info types" or "info target"; upon return *TEXT has been 576 1.10 christos advanced past "info "). 577 1.10 christos 578 1.10 christos If RESULT_LIST is NULL, don't set *RESULT_LIST (but don't otherwise 579 1.10 christos affect the operation). 580 1.10 christos 581 1.10 christos This routine does *not* modify the text pointed to by TEXT. 582 1.10 christos 583 1.10 christos If IGNORE_HELP_CLASSES is nonzero, ignore any command list elements which 584 1.10 christos are actually help classes rather than commands (i.e. the function field of 585 1.10 christos the struct cmd_list_element is NULL). 586 1.10 christos 587 1.10 christos When LOOKUP_FOR_COMPLETION_P is true the completion is being requested 588 1.10 christos for the completion engine, no warnings should be printed. */ 589 1.10 christos 590 1.10 christos extern struct cmd_list_element *lookup_cmd_1 591 1.10 christos (const char **text, struct cmd_list_element *clist, 592 1.10 christos struct cmd_list_element **result_list, std::string *default_args, 593 1.10 christos int ignore_help_classes, bool lookup_for_completion_p = false); 594 1.10 christos 595 1.10 christos /* Look up the command called NAME in the command list LIST. 596 1.10 christos 597 1.10 christos Unlike LOOKUP_CMD, partial matches are ignored and only exact matches 598 1.10 christos on NAME are considered. 599 1.10 christos 600 1.10 christos LIST is a chain of struct cmd_list_element's. 601 1.10 christos 602 1.10 christos If IGNORE_HELP_CLASSES is true (the default), ignore any command list 603 1.10 christos elements which are actually help classes rather than commands (i.e. 604 1.10 christos the function field of the struct cmd_list_element is null). 605 1.10 christos 606 1.10 christos If found, return the struct cmd_list_element for that command, 607 1.10 christos otherwise return NULLPTR. */ 608 1.10 christos 609 1.10 christos extern struct cmd_list_element *lookup_cmd_exact 610 1.10 christos (const char *name, 611 1.10 christos struct cmd_list_element *list, 612 1.10 christos bool ignore_help_classes = true); 613 1.1 christos 614 1.1 christos extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *, 615 1.3 christos const char * ); 616 1.1 christos 617 1.10 christos extern void deprecated_cmd_warning (const char *, struct cmd_list_element *); 618 1.1 christos 619 1.1 christos extern int lookup_cmd_composition (const char *text, 620 1.1 christos struct cmd_list_element **alias, 621 1.1 christos struct cmd_list_element **prefix_cmd, 622 1.1 christos struct cmd_list_element **cmd); 623 1.1 christos 624 1.1 christos extern struct cmd_list_element *add_com (const char *, enum command_class, 625 1.10 christos cmd_simple_func_ftype *fun, 626 1.3 christos const char *); 627 1.1 christos 628 1.10 christos extern cmd_list_element *add_com_alias (const char *name, 629 1.10 christos cmd_list_element *target, 630 1.10 christos command_class theclass, 631 1.10 christos int abbrev_flag); 632 1.1 christos 633 1.6 christos extern struct cmd_list_element *add_com_suppress_notification 634 1.6 christos (const char *name, enum command_class theclass, 635 1.10 christos cmd_simple_func_ftype *fun, const char *doc, 636 1.11 christos bool *suppress_notification); 637 1.6 christos 638 1.1 christos extern struct cmd_list_element *add_info (const char *, 639 1.10 christos cmd_simple_func_ftype *fun, 640 1.3 christos const char *); 641 1.1 christos 642 1.10 christos extern cmd_list_element *add_info_alias (const char *name, 643 1.10 christos cmd_list_element *target, 644 1.10 christos int abbrev_flag); 645 1.1 christos 646 1.8 christos extern void complete_on_cmdlist (struct cmd_list_element *, 647 1.8 christos completion_tracker &tracker, 648 1.8 christos const char *, const char *, int); 649 1.8 christos 650 1.8 christos extern void complete_on_enum (completion_tracker &tracker, 651 1.8 christos const char *const *enumlist, 652 1.8 christos const char *, const char *); 653 1.1 christos 654 1.1 christos /* Functions that implement commands about CLI commands. */ 655 1.1 christos 656 1.3 christos extern void help_list (struct cmd_list_element *, const char *, 657 1.1 christos enum command_class, struct ui_file *); 658 1.1 christos 659 1.11 christos /* Method for show a set/show variable's VALUE on FILE. */ 660 1.1 christos typedef void (show_value_ftype) (struct ui_file *file, 661 1.1 christos int from_tty, 662 1.1 christos struct cmd_list_element *cmd, 663 1.1 christos const char *value); 664 1.11 christos 665 1.11 christos /* Various sets of extra literals accepted. */ 666 1.11 christos extern const literal_def integer_unlimited_literals[]; 667 1.11 christos extern const literal_def uinteger_unlimited_literals[]; 668 1.11 christos extern const literal_def pinteger_unlimited_literals[]; 669 1.1 christos 670 1.10 christos extern set_show_commands add_setshow_enum_cmd 671 1.10 christos (const char *name, command_class theclass, const char *const *enumlist, 672 1.10 christos const char **var, const char *set_doc, const char *show_doc, 673 1.10 christos const char *help_doc, cmd_func_ftype *set_func, 674 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 675 1.10 christos cmd_list_element **show_list); 676 1.10 christos 677 1.10 christos extern set_show_commands add_setshow_enum_cmd 678 1.10 christos (const char *name, command_class theclass, const char *const *enumlist, 679 1.10 christos const char *set_doc, const char *show_doc, 680 1.10 christos const char *help_doc, setting_func_types<const char *>::set set_func, 681 1.10 christos setting_func_types<const char *>::get get_func, show_value_ftype *show_func, 682 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 683 1.10 christos 684 1.10 christos extern set_show_commands add_setshow_auto_boolean_cmd 685 1.10 christos (const char *name, command_class theclass, auto_boolean *var, 686 1.10 christos const char *set_doc, const char *show_doc, const char *help_doc, 687 1.10 christos cmd_func_ftype *set_func, show_value_ftype *show_func, 688 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 689 1.10 christos 690 1.10 christos extern set_show_commands add_setshow_auto_boolean_cmd 691 1.10 christos (const char *name, command_class theclass, const char *set_doc, 692 1.10 christos const char *show_doc, const char *help_doc, 693 1.10 christos setting_func_types<enum auto_boolean>::set set_func, 694 1.10 christos setting_func_types<enum auto_boolean>::get get_func, 695 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 696 1.10 christos cmd_list_element **show_list); 697 1.10 christos 698 1.10 christos extern set_show_commands add_setshow_boolean_cmd 699 1.10 christos (const char *name, command_class theclass, bool *var, const char *set_doc, 700 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 701 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 702 1.10 christos cmd_list_element **show_list); 703 1.10 christos 704 1.10 christos extern set_show_commands add_setshow_boolean_cmd 705 1.10 christos (const char *name, command_class theclass, const char *set_doc, 706 1.10 christos const char *show_doc, const char *help_doc, 707 1.10 christos setting_func_types<bool>::set set_func, 708 1.10 christos setting_func_types<bool>::get get_func, show_value_ftype *show_func, 709 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 710 1.10 christos 711 1.10 christos extern set_show_commands add_setshow_filename_cmd 712 1.10 christos (const char *name, command_class theclass, std::string *var, const char *set_doc, 713 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 714 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 715 1.10 christos cmd_list_element **show_list); 716 1.10 christos 717 1.10 christos extern set_show_commands add_setshow_filename_cmd 718 1.10 christos (const char *name, command_class theclass, const char *set_doc, 719 1.10 christos const char *show_doc, const char *help_doc, 720 1.10 christos setting_func_types<std::string>::set set_func, 721 1.10 christos setting_func_types<std::string>::get get_func, show_value_ftype *show_func, 722 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 723 1.10 christos 724 1.10 christos extern set_show_commands add_setshow_string_cmd 725 1.10 christos (const char *name, command_class theclass, std::string *var, const char *set_doc, 726 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 727 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 728 1.10 christos cmd_list_element **show_list); 729 1.10 christos 730 1.10 christos extern set_show_commands add_setshow_string_cmd 731 1.10 christos (const char *name, command_class theclass, const char *set_doc, 732 1.10 christos const char *show_doc, const char *help_doc, 733 1.10 christos setting_func_types<std::string>::set set_func, 734 1.10 christos setting_func_types<std::string>::get get_func, 735 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 736 1.10 christos cmd_list_element **show_list); 737 1.10 christos 738 1.10 christos extern set_show_commands add_setshow_string_noescape_cmd 739 1.10 christos (const char *name, command_class theclass, std::string *var, const char *set_doc, 740 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 741 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 742 1.10 christos cmd_list_element **show_list); 743 1.10 christos 744 1.10 christos extern set_show_commands add_setshow_string_noescape_cmd 745 1.10 christos (const char *name, command_class theclass, const char *set_doc, 746 1.10 christos const char *show_doc, const char *help_doc, 747 1.10 christos setting_func_types<std::string>::set set_func, 748 1.10 christos setting_func_types<std::string>::get get_func, show_value_ftype *show_func, 749 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 750 1.10 christos 751 1.10 christos extern set_show_commands add_setshow_optional_filename_cmd 752 1.10 christos (const char *name, command_class theclass, std::string *var, const char *set_doc, 753 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 754 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 755 1.10 christos cmd_list_element **show_list); 756 1.10 christos 757 1.10 christos extern set_show_commands add_setshow_optional_filename_cmd 758 1.10 christos (const char *name, command_class theclass, const char *set_doc, 759 1.10 christos const char *show_doc, const char *help_doc, 760 1.10 christos setting_func_types<std::string>::set set_func, 761 1.10 christos setting_func_types<std::string>::get get_func, 762 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 763 1.10 christos cmd_list_element **show_list); 764 1.10 christos 765 1.10 christos extern set_show_commands add_setshow_integer_cmd 766 1.11 christos (const char *name, command_class theclass, int *var, 767 1.11 christos const literal_def *extra_literals, const char *set_doc, 768 1.11 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 769 1.11 christos show_value_ftype *show_func, cmd_list_element **set_list, 770 1.11 christos cmd_list_element **show_list); 771 1.11 christos 772 1.11 christos extern set_show_commands add_setshow_integer_cmd 773 1.11 christos (const char *name, command_class theclass, const literal_def *extra_literals, 774 1.11 christos const char *set_doc, const char *show_doc, const char *help_doc, 775 1.11 christos setting_func_types<int>::set set_func, 776 1.11 christos setting_func_types<int>::get get_func, show_value_ftype *show_func, 777 1.11 christos cmd_list_element **set_list, cmd_list_element **show_list); 778 1.11 christos 779 1.11 christos extern set_show_commands add_setshow_integer_cmd 780 1.10 christos (const char *name, command_class theclass, int *var, const char *set_doc, 781 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 782 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 783 1.10 christos cmd_list_element **show_list); 784 1.10 christos 785 1.10 christos extern set_show_commands add_setshow_integer_cmd 786 1.10 christos (const char *name, command_class theclass, const char *set_doc, 787 1.10 christos const char *show_doc, const char *help_doc, 788 1.10 christos setting_func_types<int>::set set_func, 789 1.10 christos setting_func_types<int>::get get_func, show_value_ftype *show_func, 790 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 791 1.10 christos 792 1.11 christos extern set_show_commands add_setshow_pinteger_cmd 793 1.11 christos (const char *name, command_class theclass, int *var, 794 1.11 christos const literal_def *extra_literals, const char *set_doc, 795 1.11 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 796 1.11 christos show_value_ftype *show_func, cmd_list_element **set_list, 797 1.11 christos cmd_list_element **show_list); 798 1.11 christos 799 1.11 christos extern set_show_commands add_setshow_pinteger_cmd 800 1.11 christos (const char *name, command_class theclass, const literal_def *extra_literals, 801 1.11 christos const char *set_doc, const char *show_doc, const char *help_doc, 802 1.11 christos setting_func_types<int>::set set_func, 803 1.11 christos setting_func_types<int>::get get_func, show_value_ftype *show_func, 804 1.11 christos cmd_list_element **set_list, cmd_list_element **show_list); 805 1.11 christos 806 1.11 christos extern set_show_commands add_setshow_uinteger_cmd 807 1.11 christos (const char *name, command_class theclass, unsigned int *var, 808 1.11 christos const literal_def *extra_literals, 809 1.11 christos const char *set_doc, const char *show_doc, const char *help_doc, 810 1.11 christos cmd_func_ftype *set_func, show_value_ftype *show_func, 811 1.11 christos cmd_list_element **set_list, cmd_list_element **show_list); 812 1.11 christos 813 1.11 christos extern set_show_commands add_setshow_uinteger_cmd 814 1.11 christos (const char *name, command_class theclass, const literal_def *extra_literals, 815 1.11 christos const char *set_doc, const char *show_doc, const char *help_doc, 816 1.11 christos setting_func_types<unsigned int>::set set_func, 817 1.11 christos setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func, 818 1.11 christos cmd_list_element **set_list, cmd_list_element **show_list); 819 1.11 christos 820 1.10 christos extern set_show_commands add_setshow_uinteger_cmd 821 1.10 christos (const char *name, command_class theclass, unsigned int *var, 822 1.10 christos const char *set_doc, const char *show_doc, const char *help_doc, 823 1.10 christos cmd_func_ftype *set_func, show_value_ftype *show_func, 824 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 825 1.10 christos 826 1.10 christos extern set_show_commands add_setshow_uinteger_cmd 827 1.10 christos (const char *name, command_class theclass, const char *set_doc, 828 1.10 christos const char *show_doc, const char *help_doc, 829 1.10 christos setting_func_types<unsigned int>::set set_func, 830 1.10 christos setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func, 831 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 832 1.10 christos 833 1.10 christos extern set_show_commands add_setshow_zinteger_cmd 834 1.10 christos (const char *name, command_class theclass, int *var, const char *set_doc, 835 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 836 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 837 1.10 christos cmd_list_element **show_list); 838 1.10 christos 839 1.10 christos extern set_show_commands add_setshow_zinteger_cmd 840 1.10 christos (const char *name, command_class theclass, const char *set_doc, 841 1.10 christos const char *show_doc, const char *help_doc, 842 1.10 christos setting_func_types<int>::set set_func, 843 1.10 christos setting_func_types<int>::get get_func, show_value_ftype *show_func, 844 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 845 1.10 christos 846 1.10 christos extern set_show_commands add_setshow_zuinteger_cmd 847 1.10 christos (const char *name, command_class theclass, unsigned int *var, 848 1.10 christos const char *set_doc, const char *show_doc, const char *help_doc, 849 1.10 christos cmd_func_ftype *set_func, show_value_ftype *show_func, 850 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 851 1.10 christos 852 1.10 christos extern set_show_commands add_setshow_zuinteger_cmd 853 1.10 christos (const char *name, command_class theclass, const char *set_doc, 854 1.10 christos const char *show_doc, const char *help_doc, 855 1.10 christos setting_func_types<unsigned int>::set set_func, 856 1.10 christos setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func, 857 1.10 christos cmd_list_element **set_list, cmd_list_element **show_list); 858 1.10 christos 859 1.10 christos extern set_show_commands add_setshow_zuinteger_unlimited_cmd 860 1.10 christos (const char *name, command_class theclass, int *var, const char *set_doc, 861 1.10 christos const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, 862 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 863 1.10 christos cmd_list_element **show_list); 864 1.10 christos 865 1.10 christos extern set_show_commands add_setshow_zuinteger_unlimited_cmd 866 1.10 christos (const char *name, command_class theclass, const char *set_doc, 867 1.10 christos const char *show_doc, const char *help_doc, 868 1.10 christos setting_func_types<int>::set set_func, setting_func_types<int>::get get_func, 869 1.10 christos show_value_ftype *show_func, cmd_list_element **set_list, 870 1.10 christos cmd_list_element **show_list); 871 1.1 christos 872 1.1 christos /* Do a "show" command for each thing on a command list. */ 873 1.1 christos 874 1.9 christos extern void cmd_show_list (struct cmd_list_element *, int); 875 1.1 christos 876 1.1 christos /* Used everywhere whenever at least one parameter is required and 877 1.1 christos none is specified. */ 878 1.1 christos 879 1.3 christos extern void error_no_arg (const char *) ATTRIBUTE_NORETURN; 880 1.1 christos 881 1.9 christos 882 1.9 christos /* Command line saving and repetition. 883 1.9 christos Each input line executed is saved to possibly be repeated either 884 1.9 christos when the user types an empty line, or be repeated by a command 885 1.9 christos that wants to repeat the previously executed command. The below 886 1.9 christos functions control command repetition. */ 887 1.9 christos 888 1.9 christos /* Commands call dont_repeat if they do not want to be repeated by null 889 1.9 christos lines or by repeat_previous (). */ 890 1.9 christos 891 1.9 christos extern void dont_repeat (); 892 1.9 christos 893 1.9 christos /* Commands call repeat_previous if they want to repeat the previous 894 1.9 christos command. Such commands that repeat the previous command must 895 1.9 christos indicate to not repeat themselves, to avoid recursive repeat. 896 1.9 christos repeat_previous marks the current command as not repeating, and 897 1.9 christos ensures get_saved_command_line returns the previous command, so 898 1.9 christos that the currently executing command can repeat it. If there's no 899 1.9 christos previous command, throws an error. Otherwise, returns the result 900 1.9 christos of get_saved_command_line, which now points at the command to 901 1.9 christos repeat. */ 902 1.9 christos 903 1.9 christos extern const char *repeat_previous (); 904 1.9 christos 905 1.9 christos /* Prevent dont_repeat from working, and return a cleanup that 906 1.9 christos restores the previous state. */ 907 1.1 christos 908 1.7 christos extern scoped_restore_tmpl<int> prevent_dont_repeat (void); 909 1.1 christos 910 1.8 christos /* Set the arguments that will be passed if the current command is 911 1.8 christos repeated. Note that the passed-in string must be a constant. */ 912 1.8 christos 913 1.8 christos extern void set_repeat_arguments (const char *args); 914 1.8 christos 915 1.9 christos /* Returns the saved command line to repeat. 916 1.9 christos When a command is being executed, this is the currently executing 917 1.9 christos command line, unless the currently executing command has called 918 1.9 christos repeat_previous (): in this case, get_saved_command_line returns 919 1.9 christos the previously saved command line. */ 920 1.9 christos 921 1.9 christos extern char *get_saved_command_line (); 922 1.9 christos 923 1.9 christos /* Takes a copy of CMD, for possible repetition. */ 924 1.9 christos 925 1.9 christos extern void save_command_line (const char *cmd); 926 1.9 christos 927 1.1 christos /* Used to mark commands that don't do anything. If we just leave the 928 1.1 christos function field NULL, the command is interpreted as a help topic, or 929 1.1 christos as a class of commands. */ 930 1.1 christos 931 1.8 christos extern void not_just_help_class_command (const char *, int); 932 1.1 christos 933 1.1 christos /* Call the command function. */ 934 1.1 christos extern void cmd_func (struct cmd_list_element *cmd, 935 1.8 christos const char *args, int from_tty); 936 1.1 christos 937 1.1 christos #endif /* !defined (COMMAND_H) */ 938