summaryrefslogtreecommitdiff
path: root/gdb/remote-sim.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-06-14 18:17:35 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-06-14 18:17:35 +0000
commitf5d7b8976dc3ffb1a9728227f2bde6fca1e73c29 (patch)
treebb21f4bcb8ab5b8d14ab4ee67bf4cd75e4da0ee2 /gdb/remote-sim.c
parent79fe88ccefb50bcafdedcdbee27b73344c3a5f85 (diff)
downloadgdb-f5d7b8976dc3ffb1a9728227f2bde6fca1e73c29.tar.gz
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/remote-sim.c')
-rw-r--r--gdb/remote-sim.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 0e7d84e04b6..11e1003b73d 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. */