[v3,12/19] Implement completion limiting for sim_command_completer.
Commit Message
There are no revisions in this version.
--
This patch converts sim_command_completer to use add_completion.
It does not add any tests, since the `sim' command is highly
target-dependent and unimplemented for the majority of simulators.
gdb/ChangeLog
* remote-sim.c: Include completer.h.
(sim_command_completer): Use add_completion.
---
gdb/remote-sim.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
Keith Seitz <keiths@redhat.com> writes:
> There are no revisions in this version.
>
> --
>
> This patch converts sim_command_completer to use add_completion.
> It does not add any tests, since the `sim' command is highly
> target-dependent and unimplemented for the majority of simulators.
>
> gdb/ChangeLog
>
> * remote-sim.c: Include completer.h.
> (sim_command_completer): Use add_completion.
LGTM
@@ -40,6 +40,7 @@
#include "arch-utils.h"
#include "readline/readline.h"
#include "gdbthread.h"
+#include "completer.h"
/* Prototypes */
@@ -1242,7 +1243,11 @@ sim_command_completer (struct completer_data *cdata,
/* 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]);
+ {
+ if (add_completion (cdata, &result, tmp[i], NULL, NULL)
+ == ADD_COMPLETION_MAX_REACHED)
+ break;
+ }
xfree (tmp);
return result;