summaryrefslogtreecommitdiff
path: root/gdb/remote-sim.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-15 03:43:44 +0000
committerMike Frysinger <vapier@gentoo.org>2011-04-15 03:43:44 +0000
commit3d507852fa6fa9de029669efdd2c2a9ce17370bd (patch)
tree36bb62b198982aa60b17b5a3cd467ec721eed2dc /gdb/remote-sim.c
parent24dae6cda822f56855ce0b149424d583d585d4be (diff)
downloadgdb-3d507852fa6fa9de029669efdd2c2a9ce17370bd.tar.gz
gdb: sim: add command line completion
For now, only the sub-command name is completed. No support yet for completing options to that command. But even this is a huge step as currently, nothing is completed, and the basic "help sim" is fairly obtuse as to what exactly the "sim" command accepts. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gdb/remote-sim.c')
-rw-r--r--gdb/remote-sim.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index baaf4397a42..bf4e0ee715e 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1193,6 +1193,18 @@ simulator_command (char *args, int from_tty)
registers_changed ();
}
+static char **
+sim_command_completer (struct cmd_list_element *ignore, char *text, char *word)
+{
+ struct sim_inferior_data *sim_data;
+
+ sim_data = inferior_data (current_inferior (), sim_inferior_data_key);
+ if (sim_data == NULL || sim_data->gdbsim_desc == NULL)
+ return NULL;
+
+ return sim_complete_command (sim_data->gdbsim_desc, text, word);
+}
+
/* Check to see if a thread is still alive. */
static int
@@ -1287,11 +1299,14 @@ init_gdbsim_ops (void)
void
_initialize_remote_sim (void)
{
+ struct cmd_list_element *c;
+
init_gdbsim_ops ();
add_target (&gdbsim_ops);
- add_com ("sim", class_obscure, simulator_command,
- _("Send a command to the simulator."));
+ c = add_com ("sim", class_obscure, simulator_command,
+ _("Send a command to the simulator."));
+ set_cmd_completer (c, sim_command_completer);
sim_inferior_data_key
= register_inferior_data_with_cleanup (sim_inferior_data_cleanup);