gdb/mi: rename mi_cmd to mi_command

Just give this class a new name, more inline with the name of the
sub-classes.  I've also updated mi_cmd_up to mi_command_up in
mi-cmds.c inline with this new naming scheme.

There should be no user visible changes after this commit.
This commit is contained in:
Jan Vrany
2021-11-08 14:00:13 +00:00
committed by Andrew Burgess
parent 1f6c8c3317
commit 788ec57f0a
4 changed files with 23 additions and 23 deletions

View File

@ -67,7 +67,7 @@ void
mi_cmd_info_gdb_mi_command (const char *command, char **argv, int argc) mi_cmd_info_gdb_mi_command (const char *command, char **argv, int argc)
{ {
const char *cmd_name; const char *cmd_name;
struct mi_cmd *cmd; mi_command *cmd;
struct ui_out *uiout = current_uiout; struct ui_out *uiout = current_uiout;
/* This command takes exactly one argument. */ /* This command takes exactly one argument. */

View File

@ -28,22 +28,22 @@
/* A command held in the MI_CMD_TABLE. */ /* A command held in the MI_CMD_TABLE. */
using mi_cmd_up = std::unique_ptr<struct mi_cmd>; using mi_command_up = std::unique_ptr<struct mi_command>;
/* MI command table (built at run time). */ /* MI command table (built at run time). */
static std::map<std::string, mi_cmd_up> mi_cmd_table; static std::map<std::string, mi_command_up> mi_cmd_table;
/* MI command with a pure MI implementation. */ /* MI command with a pure MI implementation. */
struct mi_command_mi : public mi_cmd struct mi_command_mi : public mi_command
{ {
/* Constructor. For NAME and SUPPRESS_NOTIFICATION see mi_cmd /* Constructor. For NAME and SUPPRESS_NOTIFICATION see mi_command
constructor, FUNC is the function called from do_invoke, which constructor, FUNC is the function called from do_invoke, which
implements this MI command. */ implements this MI command. */
mi_command_mi (const char *name, mi_cmd_argv_ftype func, mi_command_mi (const char *name, mi_cmd_argv_ftype func,
int *suppress_notification) int *suppress_notification)
: mi_cmd (name, suppress_notification), : mi_command (name, suppress_notification),
m_argv_function (func) m_argv_function (func)
{ {
gdb_assert (func != nullptr); gdb_assert (func != nullptr);
@ -72,9 +72,9 @@ private:
/* MI command implemented on top of a CLI command. */ /* MI command implemented on top of a CLI command. */
struct mi_command_cli : public mi_cmd struct mi_command_cli : public mi_command
{ {
/* Constructor. For NAME and SUPPRESS_NOTIFICATION see mi_cmd /* Constructor. For NAME and SUPPRESS_NOTIFICATION see mi_command
constructor, CLI_NAME is the name of a CLI command that should be constructor, CLI_NAME is the name of a CLI command that should be
invoked to implement this MI command. If ARGS_P is true then any invoked to implement this MI command. If ARGS_P is true then any
arguments from entered by the user as part of the MI command line are arguments from entered by the user as part of the MI command line are
@ -82,7 +82,7 @@ struct mi_command_cli : public mi_cmd
false, nullptr is send to CLI_NAME as its argument string. */ false, nullptr is send to CLI_NAME as its argument string. */
mi_command_cli (const char *name, const char *cli_name, bool args_p, mi_command_cli (const char *name, const char *cli_name, bool args_p,
int *suppress_notification) int *suppress_notification)
: mi_cmd (name, suppress_notification), : mi_command (name, suppress_notification),
m_cli_name (cli_name), m_cli_name (cli_name),
m_args_p (args_p) m_args_p (args_p)
{ /* Nothing. */ } { /* Nothing. */ }
@ -114,7 +114,7 @@ private:
COMMAND was added to mi_cmd_table. */ COMMAND was added to mi_cmd_table. */
static bool static bool
insert_mi_cmd_entry (mi_cmd_up command) insert_mi_cmd_entry (mi_command_up command)
{ {
gdb_assert (command != nullptr); gdb_assert (command != nullptr);
@ -135,8 +135,8 @@ static void
add_mi_cmd_mi (const char *name, mi_cmd_argv_ftype function, add_mi_cmd_mi (const char *name, mi_cmd_argv_ftype function,
int *suppress_notification = nullptr) int *suppress_notification = nullptr)
{ {
mi_cmd_up command (new mi_command_mi (name, function, mi_command_up command (new mi_command_mi (name, function,
suppress_notification)); suppress_notification));
bool success = insert_mi_cmd_entry (std::move (command)); bool success = insert_mi_cmd_entry (std::move (command));
gdb_assert (success); gdb_assert (success);
@ -150,8 +150,8 @@ static void
add_mi_cmd_cli (const char *name, const char *cli_name, int args_p, add_mi_cmd_cli (const char *name, const char *cli_name, int args_p,
int *suppress_notification = nullptr) int *suppress_notification = nullptr)
{ {
mi_cmd_up command (new mi_command_cli (name, cli_name, args_p != 0, mi_command_up command (new mi_command_cli (name, cli_name, args_p != 0,
suppress_notification)); suppress_notification));
bool success = insert_mi_cmd_entry (std::move (command)); bool success = insert_mi_cmd_entry (std::move (command));
gdb_assert (success); gdb_assert (success);
@ -159,7 +159,7 @@ add_mi_cmd_cli (const char *name, const char *cli_name, int args_p,
/* See mi-cmds.h. */ /* See mi-cmds.h. */
mi_cmd::mi_cmd (const char *name, int *suppress_notification) mi_command::mi_command (const char *name, int *suppress_notification)
: m_name (name), : m_name (name),
m_suppress_notification (suppress_notification) m_suppress_notification (suppress_notification)
{ {
@ -169,7 +169,7 @@ mi_cmd::mi_cmd (const char *name, int *suppress_notification)
/* See mi-cmds.h. */ /* See mi-cmds.h. */
void void
mi_cmd::invoke (struct mi_parse *parse) const mi_command::invoke (struct mi_parse *parse) const
{ {
gdb::optional<scoped_restore_tmpl<int>> restore gdb::optional<scoped_restore_tmpl<int>> restore
= do_suppress_notification (); = do_suppress_notification ();
@ -179,7 +179,7 @@ mi_cmd::invoke (struct mi_parse *parse) const
/* See mi-cmds.h. */ /* See mi-cmds.h. */
gdb::optional<scoped_restore_tmpl<int>> gdb::optional<scoped_restore_tmpl<int>>
mi_cmd::do_suppress_notification () const mi_command::do_suppress_notification () const
{ {
if (m_suppress_notification != nullptr) if (m_suppress_notification != nullptr)
return scoped_restore_tmpl<int> (m_suppress_notification, 1); return scoped_restore_tmpl<int> (m_suppress_notification, 1);
@ -353,7 +353,7 @@ build_table ()
/* See mi-cmds.h. */ /* See mi-cmds.h. */
struct mi_cmd * mi_command *
mi_cmd_lookup (const char *command) mi_cmd_lookup (const char *command)
{ {
gdb_assert (command != nullptr); gdb_assert (command != nullptr);

View File

@ -141,17 +141,17 @@ extern mi_cmd_argv_ftype mi_cmd_complete;
/* The abstract base class for all MI command types. */ /* The abstract base class for all MI command types. */
struct mi_cmd struct mi_command
{ {
/* Constructor. NAME is the name of this MI command, excluding any /* Constructor. NAME is the name of this MI command, excluding any
leading dash, that is the initial string the user will enter to run leading dash, that is the initial string the user will enter to run
this command. The SUPPRESS_NOTIFICATION pointer is a flag which will this command. The SUPPRESS_NOTIFICATION pointer is a flag which will
be set to 1 when this command is invoked, and reset to its previous be set to 1 when this command is invoked, and reset to its previous
value once the command invocation has completed. */ value once the command invocation has completed. */
mi_cmd (const char *name, int *suppress_notification); mi_command (const char *name, int *suppress_notification);
/* Destructor. */ /* Destructor. */
virtual ~mi_cmd () = default; virtual ~mi_command () = default;
/* Return the name of this command. This is the command that the user /* Return the name of this command. This is the command that the user
will actually type in, without any arguments, and without the leading will actually type in, without any arguments, and without the leading
@ -190,7 +190,7 @@ private:
/* Lookup a command in the MI command table, returns nullptr if COMMAND is /* Lookup a command in the MI command table, returns nullptr if COMMAND is
not found. */ not found. */
extern mi_cmd *mi_cmd_lookup (const char *command); extern mi_command *mi_cmd_lookup (const char *command);
/* Debug flag */ /* Debug flag */
extern int mi_debug_p; extern int mi_debug_p;

View File

@ -49,7 +49,7 @@ struct mi_parse
enum mi_command_type op; enum mi_command_type op;
char *command; char *command;
char *token; char *token;
const struct mi_cmd *cmd; const struct mi_command *cmd;
struct mi_timestamp *cmd_start; struct mi_timestamp *cmd_start;
char *args; char *args;
char **argv; char **argv;