aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-info.c29
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
-rw-r--r--gdb/mi/mi-main.c1
4 files changed, 32 insertions, 0 deletions
diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c
index aa4d210..0fce25a 100644
--- a/gdb/mi/mi-cmd-info.c
+++ b/gdb/mi/mi-cmd-info.c
@@ -71,6 +71,35 @@ mi_cmd_info_ada_exceptions (char *command, char **argv, int argc)
do_cleanups (old_chain);
}
+/* Implement the "-info-gdb-mi-command" GDB/MI command. */
+
+void
+mi_cmd_info_gdb_mi_command (char *command, char **argv, int argc)
+{
+ const char *cmd_name;
+ struct mi_cmd *cmd;
+ struct ui_out *uiout = current_uiout;
+ struct cleanup *old_chain;
+
+ /* This command takes exactly one argument. */
+ if (argc != 1)
+ error (_("Usage: -info-gdb-mi-command MI_COMMAND_NAME"));
+ cmd_name = argv[0];
+
+ /* Normally, the command name (aka the "operation" in the GDB/MI
+ grammar), does not include the leading '-' (dash). But for
+ the user's convenience, allow the user to specify the command
+ name to be with or without that leading dash. */
+ if (cmd_name[0] == '-')
+ cmd_name++;
+
+ cmd = mi_lookup (cmd_name);
+
+ old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "command");
+ ui_out_field_string (uiout, "exists", cmd != NULL ? "true" : "false");
+ do_cleanups (old_chain);
+}
+
void
mi_cmd_info_os (char *command, char **argv, int argc)
{
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index c536d8a..58a8b89 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -125,6 +125,7 @@ static struct mi_cmd mi_cmds[] =
DEF_MI_CMD_MI ("inferior-tty-set", mi_cmd_inferior_tty_set),
DEF_MI_CMD_MI ("inferior-tty-show", mi_cmd_inferior_tty_show),
DEF_MI_CMD_MI ("info-ada-exceptions", mi_cmd_info_ada_exceptions),
+ DEF_MI_CMD_MI ("info-gdb-mi-command", mi_cmd_info_gdb_mi_command),
DEF_MI_CMD_MI ("info-os", mi_cmd_info_os),
DEF_MI_CMD_MI ("interpreter-exec", mi_cmd_interpreter_exec),
DEF_MI_CMD_MI ("list-features", mi_cmd_list_features),
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index cb8aac1..4ea95fa 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -74,6 +74,7 @@ extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set;
extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show;
extern mi_cmd_argv_ftype mi_cmd_info_ada_exceptions;
+extern mi_cmd_argv_ftype mi_cmd_info_gdb_mi_command;
extern mi_cmd_argv_ftype mi_cmd_info_os;
extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
extern mi_cmd_argv_ftype mi_cmd_list_features;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 793204d..48c8d09 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1817,6 +1817,7 @@ mi_cmd_list_features (char *command, char **argv, int argc)
ui_out_field_string (uiout, NULL, "ada-task-info");
ui_out_field_string (uiout, NULL, "ada-exceptions");
ui_out_field_string (uiout, NULL, "language-option");
+ ui_out_field_string (uiout, NULL, "info-gdb-mi-command");
#if HAVE_PYTHON
if (gdb_python_initialized)