diff options
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmds.c | 23 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 18 |
2 files changed, 32 insertions, 9 deletions
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index cd7cabd..38fbe0d 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -26,10 +26,6 @@ #include <map> #include <string> -/* A command held in the MI_CMD_TABLE. */ - -using mi_command_up = std::unique_ptr<struct mi_command>; - /* MI command table (built at run time). */ static std::map<std::string, mi_command_up> mi_cmd_table; @@ -108,12 +104,9 @@ private: bool m_args_p; }; -/* Insert COMMAND into the global mi_cmd_table. Return false if - COMMAND->name already exists in mi_cmd_table, in which case COMMAND will - not have been added to mi_cmd_table. Otherwise, return true, and - COMMAND was added to mi_cmd_table. */ +/* See mi-cmds.h. */ -static bool +bool insert_mi_cmd_entry (mi_command_up command) { gdb_assert (command != nullptr); @@ -127,6 +120,18 @@ insert_mi_cmd_entry (mi_command_up command) return true; } +/* See mi-cmds.h. */ + +bool +remove_mi_cmd_entry (const std::string &name) +{ + if (mi_cmd_table.find (name) == mi_cmd_table.end ()) + return false; + + mi_cmd_table.erase (name); + return true; +} + /* Create and register a new MI command with an MI specific implementation. NAME must name an MI command that does not already exist, otherwise an assertion will trigger. */ diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 785652e..47b90a2 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -199,6 +199,10 @@ private: int *m_suppress_notification; }; +/* A command held in the global mi_cmd_table. */ + +using mi_command_up = std::unique_ptr<struct mi_command>; + /* Lookup a command in the MI command table, returns nullptr if COMMAND is not found. */ @@ -206,4 +210,18 @@ extern mi_command *mi_cmd_lookup (const char *command); extern void mi_execute_command (const char *cmd, int from_tty); +/* Insert COMMAND into the global mi_cmd_table. Return false if + COMMAND->name already exists in mi_cmd_table, in which case COMMAND will + not have been added to mi_cmd_table. Otherwise, return true, and + COMMAND was added to mi_cmd_table. */ + +extern bool insert_mi_cmd_entry (mi_command_up command); + +/* Remove the command called NAME from the global mi_cmd_table. Return + true if the removal was a success, otherwise return false, which + indicates no command called NAME was found in the mi_cmd_table. */ + +extern bool remove_mi_cmd_entry (const std::string &name); + + #endif /* MI_MI_CMDS_H */ |