From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id W0evIRw3vWqzMx8AWB0awg (envelope-from ) for ; Wed, 30 Sep 2026 12:21:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1790785308; bh=jBnSyOapbogHfLzk1cV9NnKnmNzYRFgdVTWgizARpXk=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EcspncuE4uKweiuayW/03pYeeFIpGU83sxgI+kD8tkhPbjeGa4kKO5RZJDgC+clDn wmoRL8HvZJZaRYesFArxXdrxpgRCM5XWDIB7HVwuODMYwdSW6NyXONsirR4BFTk517 HNTr7pqLbq8hnIAy0nAPTI5Y2vF3gbIZzghN6B+E= Received: by simark.ca (Postfix, from userid 112) id 47FE71E051; Wed, 30 Sep 2026 12:21:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=mLb340cE; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 8CE791E01F for ; Wed, 30 Sep 2026 12:21:47 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 146F04BB58C9 for ; Wed, 30 Sep 2026 16:21:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 146F04BB58C9 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=mLb340cE Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id D68574BB24E4 for ; Wed, 30 Sep 2026 16:21:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D68574BB24E4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D68574BB24E4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790785283; cv=none; b=Pbwry03roeON6+bjj+2YkF9Y4F+fvtZzuUH0jS5FPrFVkDpxncF1fqZI9lDTp5lduuHWQcGRx3Xio01/7pkljhxBQ0Fsd3xdfUcpvE9iWNecTeTeBWCUvRxAyQG7JD0CRaA0H9q4Sh8JhJLmvWyqdfLsA+m9BUfM0xB80gqIycA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790785283; c=relaxed/simple; bh=jBnSyOapbogHfLzk1cV9NnKnmNzYRFgdVTWgizARpXk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=q9nV03mt584Lb/oB8LmCFBCo4N+EdfXRW/WaMpRN5I3biYV2UbfL22Zjuz/pA7kiqyRBtb1iPld+FuYczXJydRHZuxgUBDYvNHUNOlpGGZaLhZnVHNrBoisvCP/ky7kaFaKXfq6kmV6pGBzkS17gBMXIFnpI8CpZSY+9LhJQLLc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=mLb340cE DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D68574BB24E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1790785280; bh=jBnSyOapbogHfLzk1cV9NnKnmNzYRFgdVTWgizARpXk=; h=Date:Subject:To:References:From:In-Reply-To:From; b=mLb340cEY6XF2gAisf7wOVkx1bGm5nQDEWGnceMh/bCzg4AjcpV0nppcbQFlyP6uo RrVl8GkSKeK5cr89MAXJ3X27YNR8aQ8CIwTHHQ7Nw7vJH8zd27MMXgB3MeNTv8XaiV d7QPqDOiO/lJPmIsm0sCbRW1T/wllRwB40XyN86U= Received: by simark.ca (Postfix) id CE4681E01F; Wed, 30 Sep 2026 12:21:20 -0400 (EDT) Message-ID: <3e0443f7-0d1d-4406-8015-266f96ae700d@simark.ca> Date: Wed, 30 Sep 2026 12:21:20 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/9] gdb: factor out regexp compilation from global_symbol_searcher::search To: "Rohr, Stephan" , Simon Marchi , "gdb-patches@sourceware.org" References: <20260929194119.155169-1-simon.marchi@efficios.com> <20260929194119.155169-3-simon.marchi@efficios.com> Content-Language: en-US From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 2026-09-30 08:10, Rohr, Stephan wrote: >> @@ -4854,14 +4855,15 @@ >> global_symbol_searcher::add_matching_symbols >> if (!sym->matches (domain)) >> continue; >> >> - if (preg.has_value () && preg->exec (sym->natural_name (), 0, >> - nullptr, 0) != 0) >> + if (name_regex.has_value () >> + && name_regex->exec (sym->natural_name (), 0, >> + nullptr, 0) != 0) >> continue; >> >> if (((sym->domain () == VAR_DOMAIN >> || sym->domain () == FUNCTION_DOMAIN) >> - && treg.has_value () >> - && !treg_matches_sym_type_name (*treg, sym))) >> + && type_regex.has_value () >> + && !treg_matches_sym_type_name (*type_regex, sym))) > > Should we also rename " treg_matches_sym_type_name" as part of this > refactoring? Also, the debug prints from " treg_matches_sym_type_name". You're right, I'll rename to regex_matches_sym_type_name. We can remove the function name from the debug print, since the debug print macro already includes the function name. Since I found more preg/treg to rename in stack.c, I'll move the renaming part of this change to its own patch. This patch will focus on factoring out the regex compilation code. >> diff --git a/gdb/symtab.h b/gdb/symtab.h >> index a35449fbeeda..1675b126b19d 100644 >> --- a/gdb/symtab.h >> +++ b/gdb/symtab.h >> @@ -2669,31 +2669,38 @@ class global_symbol_searcher >> of SIZE_MAX, there is no "unlimited". */ >> size_t m_max_search_results = SIZE_MAX; >> >> - /* Expand symtabs in OBJFILE that match PREG, are of type M_KIND. Return >> - true if any msymbols were seen that we should later consider adding to >> - the results list. */ >> - bool expand_symtabs (objfile *objfile, >> - const std::optional &preg) const; >> + /* Compile M_SYMBOL_NAME_REGEXP, if set. */ > > The "compile_name_regex" method also corrects spaces for the parser. > I think we could mention this in the comment. Ok, will use: /* Compile M_SYMBOL_NAME_REGEXP, if set. This function normalizes the spacing when it detects a C++ operator in the regexp. */ std::optional compile_name_regex () const; Simon