aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmds.c14
-rw-r--r--gdb/mi/mi-cmds.h7
2 files changed, 21 insertions, 0 deletions
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 60fec0a..0571469 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -128,6 +128,20 @@ remove_mi_cmd_entry (const std::string &name)
return true;
}
+/* See mi-cmds.h. */
+
+void
+remove_mi_cmd_entries (remove_mi_cmd_entries_ftype callback)
+{
+ for (auto it = mi_cmd_table.cbegin (); it != mi_cmd_table.cend (); )
+ {
+ if (callback (it->second.get ()))
+ it = mi_cmd_table.erase (it);
+ else
+ ++it;
+ }
+}
+
/* 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 05b702f..9ffb11b 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -22,6 +22,7 @@
#ifndef MI_MI_CMDS_H
#define MI_MI_CMDS_H
+#include "gdbsupport/function-view.h"
#include "gdbsupport/gdb_optional.h"
#include "mi/mi-main.h"
@@ -218,5 +219,11 @@ extern bool insert_mi_cmd_entry (mi_command_up command);
extern bool remove_mi_cmd_entry (const std::string &name);
+/* Call CALLBACK for each registered MI command. Remove commands for which
+ CALLBACK returns true. */
+
+using remove_mi_cmd_entries_ftype
+ = gdb::function_view<bool (mi_command *)>;
+extern void remove_mi_cmd_entries (remove_mi_cmd_entries_ftype callback);
#endif /* MI_MI_CMDS_H */