From: Jan Vrany Date: Mon, 8 Nov 2021 14:00:13 +0000 (+0000) Subject: gdb/mi: rename mi_cmd to mi_command X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=788ec57f0a43261ced1f63dda68c224824d1f16d;p=binutils-gdb.git 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. --- diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c index c2858519a4c..3bfd5918ce9 100644 --- a/gdb/mi/mi-cmd-info.c +++ b/gdb/mi/mi-cmd-info.c @@ -67,7 +67,7 @@ void mi_cmd_info_gdb_mi_command (const char *command, char **argv, int argc) { const char *cmd_name; - struct mi_cmd *cmd; + mi_command *cmd; struct ui_out *uiout = current_uiout; /* This command takes exactly one argument. */ diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 58892fe58ff..9c11db00b3a 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -28,22 +28,22 @@ /* A command held in the MI_CMD_TABLE. */ -using mi_cmd_up = std::unique_ptr; +using mi_command_up = std::unique_ptr; /* MI command table (built at run time). */ -static std::map mi_cmd_table; +static std::map mi_cmd_table; /* 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 implements this MI command. */ mi_command_mi (const char *name, mi_cmd_argv_ftype func, int *suppress_notification) - : mi_cmd (name, suppress_notification), + : mi_command (name, suppress_notification), m_argv_function (func) { gdb_assert (func != nullptr); @@ -72,9 +72,9 @@ private: /* 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 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 @@ -82,7 +82,7 @@ struct mi_command_cli : public mi_cmd false, nullptr is send to CLI_NAME as its argument string. */ mi_command_cli (const char *name, const char *cli_name, bool args_p, int *suppress_notification) - : mi_cmd (name, suppress_notification), + : mi_command (name, suppress_notification), m_cli_name (cli_name), m_args_p (args_p) { /* Nothing. */ } @@ -114,7 +114,7 @@ private: COMMAND was added to mi_cmd_table. */ static bool -insert_mi_cmd_entry (mi_cmd_up command) +insert_mi_cmd_entry (mi_command_up command) { gdb_assert (command != nullptr); @@ -135,8 +135,8 @@ static void add_mi_cmd_mi (const char *name, mi_cmd_argv_ftype function, int *suppress_notification = nullptr) { - mi_cmd_up command (new mi_command_mi (name, function, - suppress_notification)); + mi_command_up command (new mi_command_mi (name, function, + suppress_notification)); bool success = insert_mi_cmd_entry (std::move (command)); gdb_assert (success); @@ -150,8 +150,8 @@ static void add_mi_cmd_cli (const char *name, const char *cli_name, int args_p, int *suppress_notification = nullptr) { - mi_cmd_up command (new mi_command_cli (name, cli_name, args_p != 0, - suppress_notification)); + mi_command_up command (new mi_command_cli (name, cli_name, args_p != 0, + suppress_notification)); bool success = insert_mi_cmd_entry (std::move (command)); 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. */ -mi_cmd::mi_cmd (const char *name, int *suppress_notification) +mi_command::mi_command (const char *name, int *suppress_notification) : m_name (name), m_suppress_notification (suppress_notification) { @@ -169,7 +169,7 @@ mi_cmd::mi_cmd (const char *name, int *suppress_notification) /* See mi-cmds.h. */ void -mi_cmd::invoke (struct mi_parse *parse) const +mi_command::invoke (struct mi_parse *parse) const { gdb::optional> restore = do_suppress_notification (); @@ -179,7 +179,7 @@ mi_cmd::invoke (struct mi_parse *parse) const /* See mi-cmds.h. */ gdb::optional> -mi_cmd::do_suppress_notification () const +mi_command::do_suppress_notification () const { if (m_suppress_notification != nullptr) return scoped_restore_tmpl (m_suppress_notification, 1); @@ -353,7 +353,7 @@ build_table () /* See mi-cmds.h. */ -struct mi_cmd * +mi_command * mi_cmd_lookup (const char *command) { gdb_assert (command != nullptr); diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index d405f877e1d..5945f03e5d3 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -141,17 +141,17 @@ extern mi_cmd_argv_ftype mi_cmd_complete; /* 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 leading dash, that is the initial string the user will enter to run 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 value once the command invocation has completed. */ - mi_cmd (const char *name, int *suppress_notification); + mi_command (const char *name, int *suppress_notification); /* Destructor. */ - virtual ~mi_cmd () = default; + virtual ~mi_command () = default; /* Return the name of this command. This is the command that the user 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 not found. */ -extern mi_cmd *mi_cmd_lookup (const char *command); +extern mi_command *mi_cmd_lookup (const char *command); /* Debug flag */ extern int mi_debug_p; diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h index ceaac72e867..44c3a49b1c0 100644 --- a/gdb/mi/mi-parse.h +++ b/gdb/mi/mi-parse.h @@ -49,7 +49,7 @@ struct mi_parse enum mi_command_type op; char *command; char *token; - const struct mi_cmd *cmd; + const struct mi_command *cmd; struct mi_timestamp *cmd_start; char *args; char **argv;