From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wlYrKJ7Q7WclkiQAWB0awg (envelope-from ) for ; Wed, 02 Apr 2025 20:04:46 -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=KZOASJZ8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8B9851E0C3; Wed, 2 Apr 2025 20:04:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, 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 B5D841E0C2 for ; Wed, 2 Apr 2025 20:04:45 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E6FE3856942 for ; Thu, 3 Apr 2025 00:04:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E6FE3856942 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=KZOASJZ8 Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id D7CE7385B536 for ; Wed, 2 Apr 2025 23:45:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7CE7385B536 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 D7CE7385B536 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637519; cv=none; b=k+4H1VETkGhWxXIKN78o589i8/NFM42cYSI1sNpwl4E9aCc3kWeTgbxXUvSYxtEehfQaloYUAb5iq2HrRsr8QubdsayQC1MFtaq7/ps67Br/zgS+gHRTA5Fy0COC5K/Dws5uQA9pITZ3gcw4hgSZOzA1XI2S5Gi4A0phq3ktcoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743637519; c=relaxed/simple; bh=UmquuIuoXjTAEDz9AElPhvf7ALMe7MOjVgyyQZSyZ5E=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=SSajaQfNZxXX6yTFX6j0tvapi5hYd97jqSpltXu1uxezu6qqbuenyGQpgaasYDJuziLsU8S4/YJ40xB1Jk0ure34lzruyUBAQt8CwnYKPQ/x5TzYhxqY1iNOv4Bf6GguPEJN4N0gDYoMBwOcWVR7xcjWqJfEgpJTDT8fkWmD4dA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7CE7385B536 Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id zm6MtY2PPf1UX07lmuFIlZ; Wed, 02 Apr 2025 23:45:18 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 07llupXkMJ4Pg07llu0eDR; Wed, 02 Apr 2025 23:45:17 +0000 X-Authority-Analysis: v=2.4 cv=ZaLWNdVA c=1 sm=1 tr=0 ts=67edcc0d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=XR8D0OoHHMoA:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=mgpZIuTHQj7Vb6XLtMwA: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=gD9XvvXKbKTH2DarnISaV4L/EPsVUpMwN7uKJMnxlUQ=; b=KZOASJZ8y5mR4h4pH/izgDGEsi X+t9U+DL/eioPZCS6quNGa0tqgN7mi2ziTLb34fY/Sk42L87Fzs6/RaG4nvcwvfy+9RgQv3JLYbE3 wVX13Xf6FBg5mLp5vQkqfC5Lo; 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 1u07lk-000000014hd-3NbD; Wed, 02 Apr 2025 17:45:16 -0600 From: Tom Tromey Date: Wed, 02 Apr 2025 17:45:13 -0600 Subject: [PATCH v2 14/28] Convert ada_add_global_exceptions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250402-search-in-psyms-v2-14-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: 1u07lk-000000014hd-3NbD 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: 15 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfB8+Mhg9tPdOsL+DYYj1Fq7X4bt2VapldOXufO8rj8O4wOP3p4hewe9E8XTN7n6Epw6gVg6h6fPSDxTYOFSTQ3JyI7x8B1pm30qYZG5sMTMi3z/6ndxC 3BrZUO3bosyqi2o2LPE2amJc+2n032gJcBiuYH88Kaxa9Ri7ddVVWxDUlas8D7k+A0kTzxpvMjK6TXePIDoJ15J28pn5ftFJZmQ= 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 ada_add_global_exceptions 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/ada-lang.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 4bb6a808fd8c1a7f8e4b2344fdf935f94c602ed1..0a20bfb8c68666326b92a6b9298df09dedcf845c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13098,32 +13098,12 @@ ada_add_global_exceptions (compiled_regex *preg, return preg == nullptr || preg->exec (name, 0, NULL, 0) == 0; }; - - /* In Ada, the symbol "search name" is a linkage name, whereas the - regular expression used to do the matching refers to the natural - name. So match against the decoded name. */ - expand_symtabs_matching (NULL, - lookup_name_info::match_any (), - [&] (const char *search_name) - { - std::string decoded = ada_decode (search_name); - return name_matches_regex (decoded.c_str ()); - }, - NULL, - SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, - SEARCH_VAR_DOMAIN, - [&] (enum language lang) - { - /* Try to skip non-Ada CUs. */ - return lang == language_ada; - }); - /* Iterate over all objfiles irrespective of scope or linker namespaces so we get all exceptions anywhere in the progspace. */ for (objfile *objfile : current_program_space->objfiles ()) { - for (compunit_symtab *s : objfile->compunits ()) - { + auto callback = [&] (compunit_symtab *s) + { const struct blockvector *bv = s->blockvector (); int i; @@ -13141,7 +13121,30 @@ ada_add_global_exceptions (compiled_regex *preg, exceptions->push_back (info); } } - } + + return true; + }; + + /* In Ada, the symbol "search name" is a linkage name, whereas + the regular expression used to do the matching refers to the + natural name. So match against the decoded name. */ + auto any = lookup_name_info::match_any (); + objfile->expand_symtabs_matching + (nullptr, + &any, + [&] (const char *search_name) + { + std::string decoded = ada_decode (search_name); + return name_matches_regex (decoded.c_str ()); + }, + callback, + SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, + SEARCH_VAR_DOMAIN, + [&] (enum language lang) + { + /* Try to skip non-Ada CUs. */ + return lang == language_ada; + }); } } -- 2.46.1