From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4EfaFhLP7WcgkCQAWB0awg (envelope-from ) for ; Wed, 02 Apr 2025 19:58:10 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=cG1NYU/9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 57B411E0C3; Wed, 2 Apr 2025 19:58:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id DAD411E0C0 for ; Wed, 2 Apr 2025 19:58:09 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D00D385B500 for ; Wed, 2 Apr 2025 23:58:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D00D385B500 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=cG1NYU/9 Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id C10BD385AC2E for ; Wed, 2 Apr 2025 23:45:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C10BD385AC2E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C10BD385AC2E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637516; cv=none; b=KZK3XuV2pcEmZ3btWoFzJZ45upguXnKtt2eEP0CXN+8z6/UB3TkubExPfphKu84q/1LrnBiG1WNF7u9PeaY8ZAc5jCZrTJyB+UoG2OBgJdr5GrFz8pynA6giyAnCw2YT2QxCXP9ufpIUOLeut6tTJT5uaxHYtoXE7nQ3pYA5KMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637516; c=relaxed/simple; bh=lazVxg0RNRQ5D/5yPYTEyz+h3KH5/O+WO32yRY7XPOo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=VX3h6Mv6wRReEeABtDA8qnOvergdqMGaVfME/ecFb+UXOdB6AZ2VA7tkfFqBacr+/QtSnrALFL92R3LoR1MkQXpsrhDrpL175PweTn7Qw05UVk55rYSeId4IJ5QCzmHfWb48gPTiqhJWjLqBwDHws/OD8FzyYIJu8vXgS5BgAK0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C10BD385AC2E Received: from eig-obgw-6007a.ext.cloudfilter.net ([10.0.30.247]) by cmsmtp with ESMTPS id 01RcuuPzTiuzS07lkunDoQ; Wed, 02 Apr 2025 23:45:16 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 07ljuqtBm1bCf07lkuMxqn; Wed, 02 Apr 2025 23:45:16 +0000 X-Authority-Analysis: v=2.4 cv=GJ4OEPNK c=1 sm=1 tr=0 ts=67edcc0c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=Abyi--6nAHpmxoY4-OoA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=6Ogn3jAGHLSNbaov7Orx:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=p1dAzyv8TgSZE3PIumYN22JiE2YSEJ/L0t9+B+IL1L0=; b=cG1NYU/9ZiXX68/UdIaNDkFWE1 buvPmeha+0l/UCbkrNOVHEIwKvgaWT2YVCwFs8OGG54BjWFTH7HPihhyHcJ6WM51IJ2MuKoMgFqNi VSkUSPIm0M3BCGg4QmbzqI++B; Received: from 97-122-123-18.hlrn.qwest.net ([97.122.123.18]:56394 helo=prentzel.local) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1u07lj-000000014hd-1URS; Wed, 02 Apr 2025 17:45:15 -0600 From: Tom Tromey Date: Wed, 02 Apr 2025 17:45:11 -0600 Subject: [PATCH v2 12/28] Convert default_collect_symbol_completion_matches_break_on MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250402-search-in-psyms-v2-12-ea91704487cb@tromey.com> References: <20250402-search-in-psyms-v2-0-ea91704487cb@tromey.com> In-Reply-To: <20250402-search-in-psyms-v2-0-ea91704487cb@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.123.18 X-Source-L: No X-Exim-ID: 1u07lj-000000014hd-1URS X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-123-18.hlrn.qwest.net (prentzel.local) [97.122.123.18]:56394 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHPpHCnXHtBuxRnflvCFE66PXFc+bFEZEbckfaqMlLyXWXA68BIvMJEMKDPreSkH6clyXWKD2vdcVk7uWW4xN1J9VIt1KEwUkL4FgNjgpODKSJgJ5NKJ o4bg1qr5B+R1383beEKBMohBDNNBYuhOFjhDkr1AFlyFeyP1L4O7Ju45eJD3Hc74NqJM2p4bCar28UiSbR8nzMo8q+WzPt0TNE4= 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~public-inbox=simark.ca@sourceware.org This converts default_collect_symbol_completion_matches_break_on to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 --- gdb/symtab.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index 06e2cd5b87756a2d53c6a4c427cec1e44cdeddb0..b52fa07da8737c39d39d5c86bb380beb8c81ea62 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -6130,25 +6130,20 @@ default_collect_symbol_completion_matches_break_on /* Add completions for all currently loaded symbol tables. */ for (objfile *objfile : current_program_space->objfiles ()) { - for (compunit_symtab *cust : objfile->compunits ()) - add_symtab_completions (cust, tracker, mode, lookup_name, - sym_text, word, code); - } - - /* Look through the partial symtabs for all symbols which begin by - matching SYM_TEXT. Expand all CUs that you find to the list. */ - expand_symtabs_matching (NULL, - lookup_name, - NULL, - [&] (compunit_symtab *symtab) /* expansion notify */ - { - add_symtab_completions (symtab, - tracker, mode, lookup_name, - sym_text, word, code); - return true; - }, - SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, - SEARCH_ALL_DOMAINS); + /* Look through the partial symtabs for all symbols which begin by + matching SYM_TEXT. Expand all CUs that you find to the list. */ + objfile->expand_symtabs_matching + (nullptr, &lookup_name, nullptr, + [&] (compunit_symtab *symtab) + { + add_symtab_completions (symtab, + tracker, mode, lookup_name, + sym_text, word, code); + return true; + }, + SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, + SEARCH_ALL_DOMAINS); + } /* Search upwards from currently selected frame (so that we can complete on local vars). Also catch fields of types defined in -- 2.46.1