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

@ -111,7 +111,7 @@ cmdpy_function (struct cmd_list_element *command,
error (_("Invalid invocation of Python command object."));
if (! PyObject_HasAttr ((PyObject *) obj, invoke_cst))
{
if (obj->command->subcommands != nullptr)
if (obj->command->is_prefix ())
{
/* A prefix command does not need an invoke method. */
return;
@ -393,7 +393,7 @@ gdbpy_parse_command_name (const char *name,
return NULL;
}
if (elt->subcommands)
if (elt->is_prefix ())
{
*base_list = elt->subcommands;
return result;