gdb: add cmd_list_element::is_prefix

Same idea as the previous patch, but for prefix instead of alias.

gdb/ChangeLog:

	* cli/cli-decode.h (cmd_list_element) <is_prefix>: New, use it.

Change-Id: I76a9d2e82fc8d7429904424674d99ce6f9880e2b
This commit is contained in:
Simon Marchi 2021-05-14 15:38:49 -04:00
parent 1be99b11f8
commit 3d0b356410
11 changed files with 37 additions and 31 deletions

View file

@ -1625,7 +1625,7 @@ show_user (const char *args, int from_tty)
{
for (c = cmdlist; c; c = c->next)
{
if (cli_user_command_p (c) || c->subcommands != NULL)
if (cli_user_command_p (c) || c->is_prefix ())
show_user_1 (c, "", c->name, gdb_stdout);
}
}
@ -1900,7 +1900,7 @@ alias_command (const char *args, int from_tty)
/* We've already tried to look up COMMAND. */
gdb_assert (c_command != NULL
&& c_command != (struct cmd_list_element *) -1);
gdb_assert (c_command->subcommands != NULL);
gdb_assert (c_command->is_prefix ());
c_alias = lookup_cmd_1 (& alias_prefix, cmdlist, NULL, NULL, 1);
if (c_alias != c_command)
error (_("ALIAS and COMMAND prefixes do not match."));