diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-04-15 03:43:46 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-04-15 03:43:46 +0000 |
commit | 56a9aa1d10f5ddb8a1f77e0de0d3c5ef48cdb848 (patch) | |
tree | 2f44e50558e49317220f7632d11dabbf21f50815 /gdb/remote-sim.c | |
parent | d2cfa400a11c869dd79f945fca68d62fdb85dd32 (diff) | |
download | gdb-56a9aa1d10f5ddb8a1f77e0de0d3c5ef48cdb848.zip gdb-56a9aa1d10f5ddb8a1f77e0de0d3c5ef48cdb848.tar.gz gdb-56a9aa1d10f5ddb8a1f77e0de0d3c5ef48cdb848.tar.bz2 |
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.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index baaf439..bf4e0ee 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); |