From patchwork Fri Jun 2 12:22:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 20701 Received: (qmail 129002 invoked by alias); 2 Jun 2017 12:22:45 -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 128815 invoked by uid 89); 2 Jun 2017 12:22:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=pc 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 ESMTP; Fri, 02 Jun 2017 12:22:42 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FBDA232058 for ; Fri, 2 Jun 2017 12:22:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9FBDA232058 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9FBDA232058 Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30AEC4DA33 for ; Fri, 2 Jun 2017 12:22:45 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 06/40] Expression completer should not match explicit location options Date: Fri, 2 Jun 2017 13:22:04 +0100 Message-Id: <1496406158-12663-7-git-send-email-palves@redhat.com> In-Reply-To: <1496406158-12663-1-git-send-email-palves@redhat.com> References: <1496406158-12663-1-git-send-email-palves@redhat.com> Currently, the expression completer matches explicit location options, which would only make sense for commands that work with linespecs, not expressions. I.e., currently, this: "p -functi" Completes to: "p -function " This patch fixes that, and adds regression tests. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * completer.c (expression_completer): Call linespec_location_completer instead of location_completer. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.base/printcmds.exp: Add tests. --- gdb/completer.c | 2 +- gdb/testsuite/gdb.base/printcmds.exp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/completer.c b/gdb/completer.c index 6acf115..ee587fb 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -643,7 +643,7 @@ expression_completer (struct cmd_list_element *ignore, ; /* Not ideal but it is what we used to do before... */ - return location_completer (ignore, p, word); + return linespec_location_completer (ignore, text, word); } /* See definition in completer.h. */ diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index d949b30..323ca73 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -931,6 +931,12 @@ gdb_test "ptype \"abc\"" " = char \\\[4\\\]" gdb_test "print \$cvar = \"abc\"" " = \"abc\"" gdb_test "print sizeof (\$cvar)" " = 4" +# GDB used to complete the explicit location options even when +# printing expressions. +gdb_test_no_output "complete p -function" +gdb_test_no_output "complete p -line" +gdb_test_no_output "complete p -source" + gdb_file_cmd ${binfile} gdb_test "print \$pc" "No registers\\." "print \$pc (with file)"