From patchwork Mon May 4 19:18:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 6557 Received: (qmail 91963 invoked by alias); 4 May 2015 19:18:41 -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 91774 invoked by uid 89); 4 May 2015 19:18:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham 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; Mon, 04 May 2015 19:18:39 +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 (8.14.4/8.14.4) with ESMTP id t44JIbwk014543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 4 May 2015 15:18:38 -0400 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 t44JIaNW032422 for ; Mon, 4 May 2015 15:18:37 -0400 Subject: [PATCH v2 12/18] Implement completion limiting for sim_command_completer. From: Keith Seitz To: gdb-patches@sourceware.org Date: Mon, 04 May 2015 12:18:36 -0700 Message-ID: <20150504191836.20434.91029.stgit@valrhona.uglyboxes.com> In-Reply-To: <20150504191734.20434.68053.stgit@valrhona.uglyboxes.com> References: <20150504191734.20434.68053.stgit@valrhona.uglyboxes.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes 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;