41 int ignore_help_classes,
55 for (p = list; p != NULL; p = p->
next)
78 for (p = *list; p != NULL; p = p->
next)
95 int recurse,
struct ui_file *stream);
214 if (*list == NULL || strcmp ((*list)->name, name) >= 0)
277 if (replacement != NULL)
300 &prehook, &prehookee,
301 &posthook, &posthookee);
304 gdb_assert (!aliases && !prehook && !prehookee
305 && !posthook && ! posthookee);
309 c =
add_cmd (name, theclass, NULL, old->
doc, list);
314 c->
doc = xstrdup (old->
doc);
357 for (p = *prefixlist; p != NULL; p = p->
next)
437 const char *set_doc,
const char *show_doc,
438 const char *help_doc,
451 if (help_doc != NULL)
453 full_set_doc =
xstrprintf (
"%s\n%s", set_doc, help_doc);
454 full_show_doc =
xstrprintf (
"%s\n%s", show_doc, help_doc);
458 full_set_doc = xstrdup (set_doc);
459 full_show_doc = xstrdup (show_doc);
462 full_set_doc, set_list);
465 if (set_func != NULL)
471 full_show_doc, show_list);
475 if (set_result != NULL)
477 if (show_result != NULL)
489 const char *
const *enumlist,
492 const char *show_doc,
493 const char *help_doc,
502 set_doc, show_doc, help_doc,
519 const char *set_doc,
const char *show_doc,
520 const char *help_doc,
529 set_doc, show_doc, help_doc,
542 const char *set_doc,
const char *show_doc,
543 const char *help_doc,
549 static const char *boolean_enums[] = {
"on",
"off", NULL };
553 set_doc, show_doc, help_doc,
557 c->
enums = boolean_enums;
565 const char *set_doc,
const char *show_doc,
566 const char *help_doc,
575 set_doc, show_doc, help_doc,
587 const char *set_doc,
const char *show_doc,
588 const char *help_doc,
595 set_doc, show_doc, help_doc,
606 const char *set_doc,
const char *show_doc,
607 const char *help_doc,
616 set_doc, show_doc, help_doc,
628 const char *set_doc,
const char *show_doc,
629 const char *help_doc,
638 set_doc, show_doc, help_doc,
652 const char *text,
const char *word)
654 static const char *
const keywords[] =
660 return complete_on_enum (keywords, text, word);
671 const char *set_doc,
const char *show_doc,
672 const char *help_doc,
681 set_doc, show_doc, help_doc,
696 const char *set_doc,
const char *show_doc,
697 const char *help_doc,
706 set_doc, show_doc, help_doc,
721 const char *set_doc,
const char *show_doc,
722 const char *help_doc,
729 set_doc, show_doc, help_doc,
740 const char *show_doc,
741 const char *help_doc,
750 set_doc, show_doc, help_doc,
765 const char *set_doc,
const char *show_doc,
766 const char *help_doc,
773 set_doc, show_doc, help_doc,
801 previous_chain_ptr = list;
803 for (iter = *previous_chain_ptr; iter; iter = *previous_chain_ptr)
805 if (strcmp (iter->
name, name) == 0)
821 *previous_chain_ptr = iter->
next;
846 previous_chain_ptr = &iter->
next;
895 struct re_pattern_buffer *regex,
const char *
prefix)
901 for (c=commandlist;c;c=c->
next)
907 returnvalue = re_search (regex, c->
name, strlen(c->
name),
908 0, strlen (c->
name), NULL);
909 if (returnvalue >= 0)
915 if (c->
doc != NULL && returnvalue < 0)
918 if (re_search(regex,c->
doc,strlen(c->
doc),0,strlen(c->
doc),NULL) >=0)
958 if (strcmp (command,
"all") == 0)
998 "\nThis command has a hook (or hooks) defined:\n");
1002 "\tThis command is run after : %s (pre hook)\n",
1006 "\tThis command is run before : %s (post hook)\n",
1027 char *cmdtype1, *cmdtype2;
1031 len = strlen (cmdtype);
1032 cmdtype1 = (
char *) alloca (len + 1);
1034 cmdtype2 = (
char *) alloca (len + 4);
1039 strncpy (cmdtype1 + 1, cmdtype, len - 1);
1041 strncpy (cmdtype2, cmdtype, len - 1);
1042 strcpy (cmdtype2 + len - 1,
" sub");
1050 help_cmd_list (list, theclass, cmdtype, (
int) theclass >= 0, stream);
1055 Type \"help%s\" followed by a class name for a list of commands in ",
1061 Type \"help all\" for the list of all commands.");
1065 cmdtype1, cmdtype2);
1073 "for commands related to \"word\".\n", stream);
1074 fputs_filtered (
"Command name abbreviations are allowed if unambiguous.\n",
1082 int seen_unclassified = 0;
1091 if (c->
func == NULL)
1109 if (!seen_unclassified)
1112 seen_unclassified = 1;
1125 static int line_size;
1131 line_buffer = (
char *)
xmalloc (line_size);
1137 while (*p && *p !=
'\n'
1138 && ((*p !=
'.' && *p !=
',') || (p[1] && !isspace (p[1]))))
1140 if (p - str > line_size - 1)
1142 line_size = p - str + 1;
1143 xfree (line_buffer);
1144 line_buffer = (
char *)
xmalloc (line_size);
1146 strncpy (line_buffer, str, p - str);
1147 line_buffer[p - str] =
'\0';
1148 if (islower (line_buffer[0]))
1149 line_buffer[0] = toupper (line_buffer[0]);
1158 int recurse,
struct ui_file *stream)
1195 for (c = list; c; c = c->
next)
1219 int ignore_help_classes,
int *nfound)
1225 for (c = clist; c; c = c->
next)
1226 if (!strncmp (command, c->
name, len)
1227 && (!ignore_help_classes || c->
func))
1231 if (c->
name[len] ==
'\0')
1243 const char *p = text;
1259 while (isalnum (*p) || *p ==
'-' || *p ==
'_'
1261 || *p ==
'+' || *p ==
'<' || *p ==
'>' || *p ==
'$')
1282 for (p = name; *p !=
'\0'; ++p)
1336 int len, tmp, nfound;
1338 const char *
line = *text;
1340 while (**text ==
' ' || **text ==
'\t')
1354 command = (
char *) alloca (len + 1);
1355 memcpy (command, *text, len);
1356 command[
len] =
'\0';
1361 found =
find_cmd (command, len, clist, ignore_help_classes, &nfound);
1365 if (!found || nfound == 0)
1367 for (tmp = 0; tmp <
len; tmp++)
1369 char x = command[tmp];
1371 command[tmp] = isupper (x) ? tolower (x) : x;
1373 found =
find_cmd (command, len, clist, ignore_help_classes, &nfound);
1382 if (result_list != NULL)
1411 ignore_help_classes);
1415 if (result_list != NULL)
1416 *result_list = clist;
1424 if (result_list != NULL)
1430 *result_list = found;
1441 if (result_list != NULL)
1442 *result_list = clist;
1452 error (
_(
"Undefined %scommand: \"%s\". Try \"help%s%.*s\"."),
1455 *cmdtype ?
" " :
"",
1456 (
int) strlen (cmdtype) - 1,
1485 error (
_(
"Lack of needed %scommand"), cmdtype);
1487 c =
lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
1496 q = (
char *) alloca (len + 1);
1497 strncpy (q, *line, len);
1508 int local_allow_unknown = (last_list ? last_list->
allow_unknown :
1510 const char *local_cmdtype = last_list ? last_list->
prefixname : cmdtype;
1512 (last_list ? *(last_list->
prefixlist) : list);
1514 if (local_allow_unknown < 0)
1528 ((*line)[amb_len] && (*line)[amb_len] !=
' '
1529 && (*line)[amb_len] !=
'\t');
1534 for (c = local_list; c; c = c->
next)
1535 if (!strncmp (*line, c->
name, amb_len))
1537 if (strlen (ambbuf) + strlen (c->
name) + 6
1538 < (
int)
sizeof ambbuf)
1540 if (strlen (ambbuf))
1541 strcat (ambbuf,
", ");
1542 strcat (ambbuf, c->
name);
1546 strcat (ambbuf,
"..");
1550 error (
_(
"Ambiguous %scommand \"%s\": %s."), local_cmdtype,
1557 if (c->
type ==
set_cmd && **line !=
'\0' && !isspace (**line))
1558 error (
_(
"Argument must be preceded by space."));
1562 while (**line ==
' ' || **line ==
'\t')
1677 int len, tmp, nfound;
1694 while (*text ==
' ' || *text ==
'\t')
1707 command = (
char *) alloca (len + 1);
1708 memcpy (command, text, len);
1709 command[
len] =
'\0';
1714 *cmd =
find_cmd (command, len, cur_list, 1, &nfound);
1719 if (!*cmd || nfound == 0)
1721 for (tmp = 0; tmp <
len; tmp++)
1723 char x = command[tmp];
1725 command[tmp] = isupper (x) ? tolower (x) : x;
1727 *cmd =
find_cmd (command, len, cur_list, 1, &nfound);
1739 if ((*cmd)->cmd_pointer)
1746 *prefix_cmd = prev_cmd;
1748 if ((*cmd)->prefixlist)
1769 const char *text,
const char *word,
1770 int ignore_help_classes)
1774 int textlen = strlen (text);
1776 int saw_deprecated_match = 0;
1782 for (pass = 0; matchlist == 0 && pass < 2; ++pass)
1784 for (ptr = list; ptr; ptr = ptr->
next)
1785 if (!strncmp (ptr->
name, text, textlen)
1787 && (!ignore_help_classes || ptr->
func
1796 saw_deprecated_match = 1;
1801 match = (
char *)
xmalloc (strlen (word) + strlen (ptr->
name) + 1);
1803 strcpy (match, ptr->
name);
1804 else if (word > text)
1807 strcpy (match, ptr->
name + (word - text));
1812 strncpy (match, word, text - word);
1813 match[text -
word] =
'\0';
1814 strcat (match, ptr->
name);
1820 if (!saw_deprecated_match)
1838 complete_on_enum (
const char *
const *enumlist,
1839 const char *text,
const char *word)
1842 int textlen = strlen (text);
1846 for (i = 0; (name = enumlist[i]) != NULL; i++)
1847 if (strncmp (name, text, textlen) == 0)
1851 match = (
char *)
xmalloc (strlen (word) + strlen (name) + 1);
1853 strcpy (match, name);
1854 else if (word > text)
1857 strcpy (match, name + (word - text));
1862 strncpy (match, word, text - word);
1863 match[text -
word] =
'\0';
1864 strcat (match, name);
1877 return (cmd->
func != NULL);
1886 (*cmd->
func) (cmd, args, from_tty);
1888 error (
_(
"Invalid command"));
unsigned int doc_allocated
void set_cmd_context(struct cmd_list_element *cmd, void *context)
unsigned int deprecated_warn_user
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
struct cmd_list_element * next
static void empty_sfunc(char *, int, struct cmd_list_element *)
void * get_cmd_context(struct cmd_list_element *cmd)
void add_setshow_zinteger_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void apropos_cmd(struct ui_file *stream, struct cmd_list_element *commandlist, struct re_pattern_buffer *regex, const char *prefix)
unsigned int cmd_deprecated
static void print_help_for_command(struct cmd_list_element *c, const char *prefix, int recurse, struct ui_file *stream)
completer_ftype_void * completer_handle_brkchars
static struct cmd_list_element * lookup_cmd_for_prefixlist(struct cmd_list_element **key, struct cmd_list_element *list)
__extension__ enum cmd_types type
void add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * deprecate_cmd(struct cmd_list_element *cmd, const char *replacement)
struct cmd_list_element * hook_post
void cmd_cfunc_ftype(char *args, int from_tty)
void print_doc_line(struct ui_file *stream, const char *str)
const char *const * enums
void help_cmd_list(struct cmd_list_element *list, enum command_class theclass, const char *prefix, int recurse, struct ui_file *stream)
unsigned int allow_unknown
struct cmd_list_element * aliases
struct cmd_list_element * hookee_post
struct cmd_list_element * lookup_cmd_1(const char **text, struct cmd_list_element *clist, struct cmd_list_element **result_list, int ignore_help_classes)
#define VEC_safe_push(T, V, O)
void set_cmd_sfunc(struct cmd_list_element *cmd, cmd_sfunc_ftype *sfunc)
struct cmd_list_element * cmdlist
const char const char *typedef void completer_ftype_void(struct cmd_list_element *, const char *, const char *)
void deprecated_cmd_warning(const char *text)
struct cmd_list_element * lookup_cmd(const char **line, struct cmd_list_element *list, char *cmdtype, int allow_unknown, int ignore_help_classes)
static struct cmd_list_element * add_set_or_show_cmd(const char *name, enum cmd_types type, enum command_class theclass, var_types var_type, void *var, const char *doc, struct cmd_list_element **list)
struct cmd_list_element * prefix
int lookup_cmd_composition(const char *text, struct cmd_list_element **alias, struct cmd_list_element **prefix_cmd, struct cmd_list_element **cmd)
void printf_filtered(const char *format,...)
struct command_line * user_commands
struct cmd_list_element * add_setshow_string_noescape_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
int cmd_cfunc_eq(struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
union cmd_list_element::@37 function
struct cmd_list_element * cmd_pointer
void set_cmd_completer_handle_brkchars(struct cmd_list_element *cmd, completer_ftype_void *completer_handle_brkchars)
void cmd_func(struct cmd_list_element *cmd, char *args, int from_tty)
struct cmd_list_element * infolist
struct cmd_list_element * setlist
void add_setshow_auto_boolean_cmd(const char *name, enum command_class theclass, enum auto_boolean *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * hook_pre
void fprintf_filtered(struct ui_file *stream, const char *format,...)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
void add_setshow_uinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static void do_cfunc(struct cmd_list_element *c, char *args, int from_tty)
void(* destroyer)(struct cmd_list_element *self, void *context)
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
__extension__ enum var_types var_type
static void add_setshow_cmd_full(const char *name, enum command_class theclass, var_types var_type, void *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list, struct cmd_list_element **set_result, struct cmd_list_element **show_result)
void cmd_sfunc_ftype(char *args, int from_tty, struct cmd_list_element *c)
void set_cmd_cfunc(struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
void add_setshow_string_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info(const char *name, cmd_cfunc_ftype *fun, const char *doc)
static void set_cmd_prefix(struct cmd_list_element *c, struct cmd_list_element **list)
static struct cmd_list_element * delete_cmd(const char *name, struct cmd_list_element **list, struct cmd_list_element **prehook, struct cmd_list_element **prehookee, struct cmd_list_element **posthook, struct cmd_list_element **posthookee)
#define CMD_LIST_AMBIGUOUS
struct cmd_list_element * add_alias_cmd(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
char * xstrprintf(const char *format,...)
void wrap_here(char *indent)
void( show_value_ftype)(struct ui_file *file, int from_tty, struct cmd_list_element *cmd, const char *value)
void(* pre_show_hook)(struct cmd_list_element *c)
struct cmd_list_element * add_abbrev_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
static void undef_cmd_error(const char *, const char *)
static struct cmd_list_element * find_cmd(const char *command, int len, struct cmd_list_element *clist, int ignore_help_classes, int *nfound)
const char const char int
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
void add_setshow_zuinteger_unlimited_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void add_setshow_integer_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void not_just_help_class_command(char *args, int from_tty)
int valid_user_defined_cmd_name_p(const char *name)
void(* func)(struct cmd_list_element *c, char *args, int from_tty)
enum command_class theclass
void add_setshow_filename_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_info_alias(const char *name, const char *oldname, int abbrev_flag)
struct cmd_list_element * alias_chain
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
show_value_ftype * show_value_func
struct cmd_list_element ** prefixlist
static void help_all(struct ui_file *stream)
struct cmd_list_element * hookee_pre
void help_cmd(const char *command, struct ui_file *stream)
static void do_sfunc(struct cmd_list_element *c, char *args, int from_tty)
unsigned int malloced_replacement
completer_ftype * completer
int cli_user_command_p(struct cmd_list_element *cmd)
const char *const auto_boolean_enums[]
void error(const char *fmt,...)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
void add_setshow_optional_filename_cmd(const char *name, enum command_class theclass, char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static int find_command_name_length(const char *text)
int cmd_func_p(struct cmd_list_element *cmd)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
enum cmd_types cmd_type(struct cmd_list_element *cmd)
const ULONGEST const LONGEST len