aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-15 03:43:46 +0000
committerMike Frysinger <vapier@gentoo.org>2011-04-15 03:43:46 +0000
commit56a9aa1d10f5ddb8a1f77e0de0d3c5ef48cdb848 (patch)
tree2f44e50558e49317220f7632d11dabbf21f50815 /gdb
parentd2cfa400a11c869dd79f945fca68d62fdb85dd32 (diff)
downloadgdb-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')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote-sim.c19
2 files changed, 22 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5796795..5398e1c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-14 Mike Frysinger <vapier@gentoo.org>
+
+ * remote-sim.c (sim_command_completer): New function.
+ (_initialize_remote_sim): Set completer to sim_command_completer.
+
2011-04-13 Thiago Jung Bauermann <bauerman@br.ibm.com>
* breakpoint.c (print_exception_catchpoint): Rename to ...
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);