From patchwork Thu Jun 29 15:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 21332 Received: (qmail 101849 invoked by alias); 29 Jun 2017 15:23:49 -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 98145 invoked by uid 89); 29 Jun 2017 15:23:48 -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= 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; Thu, 29 Jun 2017 15:23:46 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C5A3128281; Thu, 29 Jun 2017 15:23:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7C5A3128281 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 7C5A3128281 Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEAA891E65; Thu, 29 Jun 2017 15:23:44 +0000 (UTC) Subject: Re: [PATCH 06/40] Expression completer should not match explicit location options To: Yao Qi References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-7-git-send-email-palves@redhat.com> <86h8yzdwng.fsf@gmail.com> <9bb22b33-5666-0aed-4ef5-de686983cab4@redhat.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <1f97ab44-2d0c-04a0-2421-576fdd2217c3@redhat.com> Date: Thu, 29 Jun 2017 16:23:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <9bb22b33-5666-0aed-4ef5-de686983cab4@redhat.com> On 06/29/2017 12:07 PM, Pedro Alves wrote: > On 06/29/2017 11:56 AM, Pedro Alves wrote: > >> The patch fixes this by having the expression_completer function >> bypass the function that completes explicit locations: >> >> /* Not ideal but it is what we used to do before... */ >> - return location_completer (ignore, p, word); >> + return linespec_location_completer (ignore, text, word); >> > > Hmm, reading this back made my realize that I'm dropping "p" > here, which is computed just above. That doesn't make a difference > to the test added by 37cd5d19fecc (2008), which was the commit > that added that code. Hmm, looks like that's a bit of dead code > we can remove. > I've split that to a separate preparatory patch and pushed it in, as below, after doing some archaeology. From 195bcdd5183f2c137399db23a68a26a4e4193f8f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 29 Jun 2017 15:52:37 +0100 Subject: [PATCH] Remove old stale expression_completer hack The code in question was introduced by: https://sourceware.com/ml/gdb-patches/2008-06/msg00143.html "The fix is to make sure that the entire expression is passed to expression_completer, then duplicate some logic there in the case where location_completer is called." The logic that was duplicated was much later on removed by the original explicit locations patch: commit 87f0e7204722a986f79f245eee716f0870832d47 Author: Keith Seitz AuthorDate: Tue Aug 11 17:09:36 2015 -0700 Commit: Keith Seitz CommitDate: Tue Aug 11 17:09:36 2015 -0700 Explicit locations: add UI features for CLI @@ -688,16 +880,6 @@ complete_line_internal (const char *text, rl_completer_word_break_characters = gdb_completer_file_name_break_characters; } - else if (c->completer == location_completer) - { - /* Commands which complete on locations want to - see the entire argument. */ - for (p = word; - p > tmp_command - && p[-1] != ' ' && p[-1] != '\t'; - p--) - ; - } However this case in expression_completer was left behind. I couldn't come up with a test where this currently makes any difference. gdb/ChangeLog: 2017-06-29 Pedro Alves * completer.c (expression_completer): Remove code that recomputes 'text' from 'word'. --- gdb/ChangeLog | 5 +++++ gdb/completer.c | 10 +--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9be08dd..c76158f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-06-29 Pedro Alves + + * completer.c (expression_completer): Remove code that recomputes + 'text' from 'word'. + 2017-06-29 Yao Qi * regformats/regdat.sh: Generate code with diff --git a/gdb/completer.c b/gdb/completer.c index 6acf115..f152dd5 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -587,7 +587,6 @@ expression_completer (struct cmd_list_element *ignore, { struct type *type = NULL; char *fieldname; - const char *p; enum type_code code = TYPE_CODE_UNDEF; /* Perform a tentative parse of the expression, to see whether a @@ -635,15 +634,8 @@ expression_completer (struct cmd_list_element *ignore, } xfree (fieldname); - /* Commands which complete on locations want to see the entire - argument. */ - for (p = word; - p > text && p[-1] != ' ' && p[-1] != '\t'; - p--) - ; - /* Not ideal but it is what we used to do before... */ - return location_completer (ignore, p, word); + return location_completer (ignore, text, word); } /* See definition in completer.h. */