From patchwork Tue Mar 11 14:12:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 107686 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 A14193858031 for ; Tue, 11 Mar 2025 14:21:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A14193858031 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=G4zYOUTY X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id A58843857BB9 for ; Tue, 11 Mar 2025 14:13:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A58843857BB9 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 A58843857BB9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741702402; cv=none; b=xXKS6n/x2sx08/U7XJTty0moYUma9pRpIgK0rfqLKWihXSk+RpqgOTr/DOX+ZvmTYSLOGLnCkrX/DdFbPWdX+JMSH9+7g3HajoTTipi3Vxq/gXTgPYVhY1YP2Sg8UJ30TWtNT8ENDCp7Z/1NeW+l3PZ6pn4A19HiYCQIA3xQCn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741702402; c=relaxed/simple; bh=O+njLp19OQqf6+u2L30n6/xULictR6FLtvgvHWelPUs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=juFvvp3iSv5TQn2gwx5iQcX4sIauCs7ATuF2dd6fTz+Lwcl783luXPK27smFY88CeMmwAd5wBiBHPP29dmShAslwjs40VXayyi0FfY0pWCtVXcMhAFfT/ymFwmoxh/6vJpMX5b/oT9uYZiTp+C1ipMHPPTlwEXqCQL6ynX6dHaE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id ryantryvozZPas0LktGGPO; Tue, 11 Mar 2025 14:12:52 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id s0Litar54HEACs0LitH8aC; Tue, 11 Mar 2025 14:12:50 +0000 X-Authority-Analysis: v=2.4 cv=HdLfTTE8 c=1 sm=1 tr=0 ts=67d044e3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA: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=V3wvFcdric7iNer4Oe53OFrmysH8lxo5siOlojC+cgs=; b=G4zYOUTYqMgNFvi1KyZqj3h9QV GV2vYviDENlVisnxDM0OrZMVTfPSEMW0SvSG3rinGFwHdIrNDv6KxF2OAYd1PHlbOoIYrgs1442vv P239pbElNRTYYvUR7OyMHPPmI; Received: from 97-118-51-80.hlrn.qwest.net ([97.118.51.80]:33770 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 1ts0Lh-000000003jP-2zon; Tue, 11 Mar 2025 08:12:49 -0600 From: Tom Tromey Date: Tue, 11 Mar 2025 08:12:48 -0600 Subject: [PATCH 12/28] Convert default_collect_symbol_completion_matches_break_on MIME-Version: 1.0 Message-Id: <20250311-search-in-psyms-v1-12-d73d9be20983@tromey.com> References: <20250311-search-in-psyms-v1-0-d73d9be20983@tromey.com> In-Reply-To: <20250311-search-in-psyms-v1-0-d73d9be20983@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.118.51.80 X-Source-L: No X-Exim-ID: 1ts0Lh-000000003jP-2zon X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-51-80.hlrn.qwest.net (prentzel.local) [97.118.51.80]:33770 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: MS4xfGfXvw5SbQQ0dwQKs8qIPF2Ey/tPJRY3Dp43ejzjR8M9nOHKmkQIZTEAfWjZM18+b/b0vhTPi7rSiSasaLZReSCiOJCiek6joGD5wFp8Iw++LcriLTSa a49ef7pRGOqQYuhQGtCUWRfeunAfGG8UTY4ATxeNEg3ceDnqZ7xp4mBkMVX+NASenbveERr2zHp+KkZPVUluyLpuRyJ3sy1/0x0= X-Spam-Status: No, score=-3015.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_BL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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 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 aa09706453c120c56195e994df053e81a577a2b1..a261e4bc3e5790e4b496553f7d0d4b8a8052c2b0 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