diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-06-14 18:17:37 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-06-14 18:17:37 +0000 |
commit | 34370865978b45c298ec3a9cee665b76660e5948 (patch) | |
tree | d7ee3d969017eae371aeb49b22931aa04e0170b9 /gdb | |
parent | 1d1702fcaad8f492c149e925b1b82e244ec7e270 (diff) | |
download | gdb-34370865978b45c298ec3a9cee665b76660e5948.zip gdb-34370865978b45c298ec3a9cee665b76660e5948.tar.gz gdb-34370865978b45c298ec3a9cee665b76660e5948.tar.bz2 |
Fix invalid profile for command-completer in remote-sim.c
The profile of command completers has been change to returna VEC
of char_ptr. Most completers were updated, except the one in
remote-sim.c.
Unfortunately, to make things a little more difficult, the meat of
the completer is actually implemented in the sim, were VECs are not
available. This patch thus translates the returned array into a VEC,
and then returns that VEC.
gdb/ChangeLog:
* remote-sim.c (sim_command_completer): Change type of return
value to "VEC (char_ptr) *". Adjust implementation accordingly.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/remote-sim.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cdf6a01..c16049c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-06-13 Joel Brobecker <brobecker@adacore.com> + + * remote-sim.c (sim_command_completer): Change type of return + value to "VEC (char_ptr) *". Adjust implementation accordingly. + 2012-06-13 Mark Kettenis <kettenis@gnu.org> Jan Kratochvil <jan.kratochvil@redhat.com> diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 0e7d84e..11e1003 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -1198,16 +1198,28 @@ simulator_command (char *args, int from_tty) registers_changed (); } -static char ** +static VEC (char_ptr) * sim_command_completer (struct cmd_list_element *ignore, char *text, char *word) { struct sim_inferior_data *sim_data; + char **tmp; + int i; + VEC (char_ptr) *result; 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); + tmp = sim_complete_command (sim_data->gdbsim_desc, text, word); + if (tmp == NULL) + return NULL; + + /* Transform the array into a VEC, and then free the array. */ + for (i = 0; tmp[i] != NULL; i++) + VEC_safe_push (char_ptr, result, tmp[i]); + xfree (tmp); + + return result; } /* Check to see if a thread is still alive. */ |