From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111049 invoked by alias); 6 Aug 2015 22:03:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111012 invoked by uid 89); 6 Aug 2015 22:03:33 -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 22:03:33 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id D9184FC0EE for ; Thu, 6 Aug 2015 22:03:31 +0000 (UTC) Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t76JItta011941 for ; Thu, 6 Aug 2015 15:18:55 -0400 Subject: [PATCH v3 11/19] Implement completion limiting for reg_or_group_completer. From: Keith Seitz To: gdb-patches@sourceware.org Date: Thu, 06 Aug 2015 22:03:00 -0000 Message-ID: <20150806191838.32159.15319.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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00180.txt.bz2 There are no revisions in this version. -- This patch converts reg_or_group_completer to use add_completion and adds tests for this new behavior. gdb/ChangeLog * completer.c (reg_or_group_completer): Use add_completion. gdb/testsuite/ChangeLog * gdb.base/completion.exp: Add tests for limit completing "info reigsters". --- gdb/completer.c | 12 ++++++++++-- gdb/testsuite/gdb.base/completion.exp | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gdb/completer.c b/gdb/completer.c index bf85efe..7ede0f9 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1092,7 +1092,11 @@ reg_or_group_completer_1 (struct completer_data *cdata, i++) { if (*name != '\0' && strncmp (word, name, len) == 0) - VEC_safe_push (char_ptr, result, xstrdup (name)); + { + if (add_completion (cdata, &result, name, NULL, NULL) + == ADD_COMPLETION_MAX_REACHED) + return result; + } } } @@ -1106,7 +1110,11 @@ reg_or_group_completer_1 (struct completer_data *cdata, { name = reggroup_name (group); if (strncmp (word, name, len) == 0) - VEC_safe_push (char_ptr, result, xstrdup (name)); + { + if (add_completion (cdata, &result, name, NULL, NULL) + == ADD_COMPLETION_MAX_REACHED) + return result; + } } } diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 41323d2..3f56a13 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -1038,6 +1038,10 @@ with_test_prefix "interpreter_completer reset" { gdb_test_no_output "set max-completions $max_completions" } +# Test reg_or_group_completer. +test_completion_limit "info registers " \ + "info registers \[a-zA-Z0-9\]+" $max_completions + # # Test TUI completions #