From patchwork Thu Aug 6 19:19:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 8054 Received: (qmail 36364 invoked by alias); 6 Aug 2015 19:20:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 36342 invoked by uid 89); 6 Aug 2015 19:20:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 06 Aug 2015 19:20:36 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id B5AEF365073 for ; Thu, 6 Aug 2015 19:20:34 +0000 (UTC) Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t76JJHmJ011323 for ; Thu, 6 Aug 2015 15:19:17 -0400 Subject: [PATCH v3 12/19] Implement completion limiting for sim_command_completer. From: Keith Seitz To: gdb-patches@sourceware.org Date: Thu, 06 Aug 2015 12:19:17 -0700 Message-ID: <20150806191857.32159.87692.stgit@valrhona.uglyboxes.com> In-Reply-To: <20150806191404.32159.50755.stgit@valrhona.uglyboxes.com> References: <20150806191404.32159.50755.stgit@valrhona.uglyboxes.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes 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(-) diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 0a8997a..c29d3c5 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -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;