From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CK0rF9DfyGgjKwYAWB0awg (envelope-from ) for ; Mon, 15 Sep 2025 23:56:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1757994960; bh=UqHZZxL3k63HeWkoBnwFFewO6UIMJ6SzRd9SGXsoZJ8=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=k6KUGgJBBpd0FwEsll0G2irbQCuvJz1pDjBJtbexZ/h2UlDRtqwo/9A4U0RKel/Is 1bwwO3atR1190i4TLhAoXfP0IPA57uppqPOQo3dA8XX5KNJvcj8uvKr95FbcknffpJ cLVR11NjVxFmmAD3o6Xzvrj92pYWd0L1I3PUrnOk= Received: by simark.ca (Postfix, from userid 112) id 4E8041E047; Mon, 15 Sep 2025 23:56:00 -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=Klfaoh94; dkim-atps=neutral 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 885131E047 for ; Mon, 15 Sep 2025 23:55:57 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16ECC385743A for ; Tue, 16 Sep 2025 03:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16ECC385743A 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=Klfaoh94 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 607853857706 for ; Tue, 16 Sep 2025 03:55:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 607853857706 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 607853857706 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757994920; cv=none; b=qhS4ARoOM4cKA4BgxHjruhYudkoNnXoBfc5wAMIyC1wvKkEXj2DNjQajLP4AMcCJYw98VjysqfGQK+ArDRjS6iIn5Mwi34QdJWxaCrtk/s+FcgzkyEGOKFuCyl0kwMB+SZP5ukjEcl1OUKbwjKdTjIYK2NJ1mxLr442YzeziIuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757994920; c=relaxed/simple; bh=UqHZZxL3k63HeWkoBnwFFewO6UIMJ6SzRd9SGXsoZJ8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=N8Q0UY97t9tV80OV6Dci5/52nL/r565DR1j1PmAOeBKeqCZ9TCju3d2BjS3zgFErbTrgWkbbvmpxW1xjH5wcOnmK93VB01NkyuNb3Y1ypRywh2FT27RUZCjdHt8jhRXqFX4BTdLE6rQwkP/f6XAfz5ggjRomioIouo5rQJ9f53g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 607853857706 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1757994919; bh=UqHZZxL3k63HeWkoBnwFFewO6UIMJ6SzRd9SGXsoZJ8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=Klfaoh94HUJH5SaEnZJIKQUEbCXjt8FlXDBRn1X7WQfzVYQmEIB+7h9iNINOIKcCc QNasmR1hKTbWTq71zhhdtk24Hr7Wf7PmKdYwAQ9xg6azaCfF2mMboZBoRNponXj5R0 ITyxfj78srvwxEuGr40Y24/YTBOAmwSNcWfZnNQw= Received: by simark.ca (Postfix) id 501091E047; Mon, 15 Sep 2025 23:55:19 -0400 (EDT) Message-ID: Date: Mon, 15 Sep 2025 23:55:18 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Make gdb_caching_proc support namespaces To: Pedro Alves , gdb-patches@sourceware.org References: <20250915212841.4161603-1-pedro@palves.net> <3e29d575-22c4-42b7-a8e9-2d57b7367a49@palves.net> 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 2025-09-15 19:57, Pedro Alves wrote: > On 2025-09-15 22:54, Pedro Alves wrote: >> I should have mentioned something here: >> >> On 2025-09-15 22:28, Pedro Alves wrote: >> >>> --- a/gdb/testsuite/lib/cache.exp >>> +++ b/gdb/testsuite/lib/cache.exp >>> @@ -24,26 +24,9 @@ proc ignore_pass { msg } { >>> >>> # Call proc real_name and return the result, while ignoring calls to pass. >>> proc gdb_do_cache_wrap {real_name args} { >>> - if { [info procs save_pass] != "" } { >>> - return [uplevel 2 $real_name] >>> + with_override pass ignore_pass { >>> + return [$real_name {*}$args] >>> } >> >> The previous code was using "uplevel 2" here. But I'm struggling to see why that is the >> right level. >> >> When gdb_do_cache_wrap is called via gdb_caching_proc => gdb_do_cache, that takes us to the scope of >> the caller of the gdb_caching_proc, which off hand would seem right. >> >> However, when gdb_do_cache_wrap is called directly by gdb.testsuite/gdb-caching-proc-consistency.exp, it >> takes us to ... the caller of test_proc? >> >> So I'm wondering, what could we possibly want to reference from a higher level in gdb_do_cache_wrap >> that not having the uplevel in gdb_do_cache_wrap would get wrong? A caching proc IMO shouldn't be doing >> something like taking the name of a variable as argument instead of a value, as then the procedure wouldn't >> be guaranteed to be idempotent? So I dropped the uplevel, and found that that doesn't cause any >> testsuite regression. But maybe I'm missing something. If I am, it'd be nice to add a testcase for it. > > Trying to find a testcase for the above, I thought to try a gdb_caching_proc defined in a namespace, > and have that proc access a namespace variable, in its own namespace. > > That ran into the fact that gdb_caching_proc doesn't support namespaces today. So I fixed that, with > the patch below (on top of the previous one), which includes tests. That still didn't require any > uplevel in gdb_do_cache_wrap. > > I don't have a current use for this, but I figure that eventually we will find a use, and since > I wrote it... I haven't looked at the code, but it fixes the problem for me. Tested-By: Simon Marchi Simon