This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2 12/18] Implement completion limiting for sim_command_completer.


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(-)

diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 2bcb19e..c52cda3 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -39,6 +39,7 @@
 #include "arch-utils.h"
 #include "readline/readline.h"
 #include "gdbthread.h"
+#include "completer.h"
 
 /* Prototypes */
 
@@ -1236,7 +1237,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])
+	  == ADD_COMPLETION_MAX_REACHED)
+	break;
+    }
   xfree (tmp);
 
   return result;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]