From patchwork Wed Aug 28 01:50:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Rische X-Patchwork-Id: 96579 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 610CC3860750 for ; Wed, 28 Aug 2024 01:50:53 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-4325.protonmail.ch (mail-4325.protonmail.ch [185.70.43.25]) by sourceware.org (Postfix) with ESMTPS id BA152385ED72 for ; Wed, 28 Aug 2024 01:50:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA152385ED72 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=protonmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA152385ED72 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.70.43.25 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724809810; cv=none; b=XIjMNPeGPFvgs8CKWqzmdgmam277i1WerNlz7212bfbaEBy40WwN2mlkuqWekH0YNiW5L8LlYzHKilqllr9fAv0AGfwn+jJU4dy9E9R5hTcqGk7VJda87i3u+uU/UTKWwA68cvZp08aNx5zin50TB9JFcYLkfQzGH43lCzepXAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724809810; c=relaxed/simple; bh=fAw408ueybQZnWq4w2cW9ovN3Apnp5DOKK9kG1CI5+8=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=bquyUIjM0d8C2y92vmBngi8e2l/+Pd6SNZtVUxUuHna8Ot9EOo02J4vxCD2AfQe0ojUWZ/0nCSl+0TxUL4r7nZn+b9DWxl1GW/T1PYOAuTl6pOwob7USuicmSjeTJrsfOR5EB6A0YF9o3U9MaiyZesYdpOAwurqTNvG5F9Z3l6A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1724809805; x=1725069005; bh=qOSoCTylqpLK9Q0eUwmh2RJw+GyJn5ccB+ztTrJahqs=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=NZxFE0gB2n5q+4M4rfevmFgs0EPvsk6e6n6vpzkuwNsYCfhvGbWA+0YBzgFpNbMpK WuEJ+dvSQ1pQCLJ6b2zlbYwcerIgtMG7NeIun/4eRly57SiIVg5n7C1KO7HxU9maw0 krFgtDXFsiDe78JINjoyY4Kndl58J87HGUw97pDNokSjarqOTThfmLWopoCN9DcnZY qL61H3y8BB8V5vFSD+ROa2mRf55EZDKQd80OUmYd3Bkrxn7NvUydvBM1ct9RUSG4U6 xgsxvHXoj0mNgIeE3T6Og9np3RCI0ZudiOd6Te5ikFOIUS0g+uGC4adP8l46427YUl 8cLsnN7+X8IQw== Date: Wed, 28 Aug 2024 01:50:01 +0000 To: gdb-patches@sourceware.org From: Antonio Rische Cc: Antonio Rische Subject: [PATCH v2 2/5] gdb: Tab complete internalvars in expressions Message-ID: <20240828014916.162446-3-nt8r@protonmail.com> In-Reply-To: <20240828014916.162446-1-nt8r@protonmail.com> References: <20240828014916.162446-1-nt8r@protonmail.com> Feedback-ID: 21706885:user:proton X-Pm-Message-ID: d20bf01e9cd1d791892234c66812069e9d5be7fa MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org For example, 'print $f' or 'print $fo+$foo' after running 'set $foo=0' now tab completes. 'print $_siginf' also now tab completes. --- gdb/completer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gdb/completer.c b/gdb/completer.c index 1008ec23b..3c9f01c84 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1099,6 +1099,17 @@ complete_expression (completion_tracker &tracker, && expr_completer->complete (exp.get (), tracker)) return; + /* If the text is non-empty, see if the word is preceded by '$'. */ + if (text[0] != '\0' && text[strlen(text)-strlen(word)-1] == '$') + { + tracker.advance_custom_word_point_by (1); + /* We don't support completion of history indices. */ + if (!isdigit (word[0])) + complete_internalvar (tracker, word); + tracker.advance_custom_word_point_by (-1); + return; + } + complete_files_symbols (tracker, text, word); }