From patchwork Tue Jun 4 22:34:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 32987 Received: (qmail 44878 invoked by alias); 4 Jun 2019 22:35:05 -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 44831 invoked by uid 89); 4 Jun 2019 22:35:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 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; Tue, 04 Jun 2019 22:35:04 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FC4C307D932 for ; Tue, 4 Jun 2019 22:35:03 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F33519C69 for ; Tue, 4 Jun 2019 22:35:02 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 01/24] Fix latent bug in custom word point completion handling Date: Tue, 4 Jun 2019 23:34:21 +0100 Message-Id: <20190604223444.26472-2-palves@redhat.com> In-Reply-To: <20190604223444.26472-1-palves@redhat.com> References: <20190604223444.26472-1-palves@redhat.com> Without this fix, if we switch the "print" completer to custom word point handling, we regress gdb.base/completion.exp like this: (gdb) p "break1.c FAIL: gdb.base/completion.exp: complete 'p "break1' (timeout) The problem is that completing an expression that starts with double quotes, and resolves to a filename, like this: (gdb) p "break1[TAB] would change from this, with current master: (gdb) p "break1.c"| ^^^^^^^^^^| \- cursor here to this: (gdb) p "break1.c | ^^^^^^^^^^| \- quote replaced by space The issue is that completer.c:advance_to_completion_word misses telling the completion tracker to emulate readline's handling of completing a string when rl_find_completion_word returns a delimiter. This commit fixes the latent bug. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * completer.c (advance_to_completion_word): Handle delimiters. --- gdb/completer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/completer.c b/gdb/completer.c index d4773f2a77b..03d0d0e5dbd 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -365,11 +365,18 @@ advance_to_expression_complete_word_point (completion_tracker &tracker, info.quote_characters = gdb_completer_quote_characters; info.basic_quote_characters = rl_basic_quote_characters; + int delimiter; const char *start - = gdb_rl_find_completion_word (&info, NULL, NULL, text); + = gdb_rl_find_completion_word (&info, NULL, &delimiter, text); tracker.advance_custom_word_point_by (start - text); + if (delimiter) + { + tracker.set_quote_char (delimiter); + tracker.set_suppress_append_ws (true); + } + return start; }