From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lGkkNZf6lmrcUxsAWB0awg (envelope-from ) for ; Tue, 01 Sep 2026 12:17:27 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H3IN/nxc; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BEBE91E033; Tue, 01 Sep 2026 12:17:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 04A321E033 for ; Tue, 01 Sep 2026 12:17:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE2694BA7980 for ; Tue, 1 Sep 2026 16:17:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE2694BA7980 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H3IN/nxc Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id DB9B84BA23E2 for ; Tue, 1 Sep 2026 16:16:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB9B84BA23E2 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB9B84BA23E2 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788279420; cv=none; b=KwG+/P6UpSb59uRwTpV4bB0CjxFb7QX/qxBBtQpMBBT9wH1V5dgq6zb5Mefkf+JMPke7NNYz0lahIPhhE33XI0JGlP6MthLj6r4HcnbrSqsxZ9TzAjbgmZlO6TeDu/PiEvw10BeulfX/fyY7INsepGQMqjyP8FHVFjx8Exb0L/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788279420; c=relaxed/simple; bh=BJMA/668vTbpn7q4o+DwNf2YEZxuyjHm5MOoTQjdnFg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=PdtDFGaoH4LKLYv4lq3ZmBkiV01u8HYKTdnu8/7KleCKzGxxlp+jRtrW84bObbE9jPGetlkvYNd/qb+3kqzDn6yVW+S042Br6GsbRbafsnbmH7tdahgqXyjmj3NhmWtEMdfuO7GJJ+D1UNZyW0227d/RwfWwCOpyWiLnkxI5LeI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H3IN/nxc DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB9B84BA23E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788279419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w7ETmAJuGnwahCaWEAUUN4WtfNUCj+UmWWCdHfEYj7w=; b=H3IN/nxcYAw+34gxTdr/bQP04QyNThDMp/jeIHsRUjKNnCxKaG7k6Tjd6ghaXeIbctr/x+ OivgQXRJr/W1oBfzB5rKmCSHQ/JEPn57QpdPDoC5tW03w2Tg4TZkdtllrbPFxyahgS+WaK GGf6TEthWIeAaS1wU2Mv/nQnhmaCGtU= Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-112-o2CjRi3JMKylIkKv9RUETg-1; Tue, 01 Sept 2026 12:16:58 -0400 X-MC-Unique: o2CjRi3JMKylIkKv9RUETg-1 X-Mimecast-MFC-AGG-ID: o2CjRi3JMKylIkKv9RUETg_1788279418 Received: by mail-ua1-f71.google.com with SMTP id a1e0cc1a2514c-97cb0a317c4so94124241.1 for ; Tue, 01 Sep 2026 09:16:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788279418; x=1788884218; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=w7ETmAJuGnwahCaWEAUUN4WtfNUCj+UmWWCdHfEYj7w=; b=k7ScZCOO1aZ9xIU4TCWY36LR1h1SdtcMeg53Dym70OLEFY4mKcFUagpkLbiIuYGiU4 fa4p9eLR6s2W7fBPfg7bXTwWa5Iu9ZeL7xiFhkGu87DndwBZXP1KJEtj+VS/r04V+Mdf 5AHg3yfQbZA+TuVxDQ/CdTTjNaRgnKBjuPvtPjEDKSTKDxf9o9glv0gNunp37nsL6c9K V73p6U3XSpiCCv7u0IbC6O+AkIkKUpA807SHZ8dBli58m7q5FpW0zjt8E9tI18EljlcZ EHMQWk1C4Nnta60AdRgIhnbha1dOE886ta5MEre2vSD1Ux0VV0mnls3XA6dj/NX8Q4Jy vcTQ== X-Forwarded-Encrypted: i=1; AHgh+Rp5mZHNI1cqOGXyPYIYdUktmQlWNuLIBvD/XjXyYLklE+BsrJIXlu/OHKD0oxVC4TaVModNBLSJwOi9mw==@sourceware.org X-Gm-Message-State: AFuF++lj1tBruK3BZhZ9OQG6SluDpIoHWw/qqLGnuT2RwDPz+vyISaWr WtzicfyTeqHpdt2+wnZJQ1j8cwUlQOhYHsN9wnUIcraui8PtYNLuQI/DbMRdDzMDZ3fTHxgIoq2 S3vyn2RbCCsdi4tyehEbIu7LbU+Uwjwjn5Xd7o2P8FduTlK70jlLJeyLq+HQLiYg= X-Gm-Gg: AR+sD11B+VF6EH9AYuxmNQ+7LbTOx1+cWS3zYa0TlI+D1w1IkvO9GGJeg8IvT3gQAXY u1qCvc/K63BUxHpTIOJ0JpVULjIdES4AHGahlQqwlMcp2cZEj4WUMEBg5DuNEMqQCOKLTy6VnaO H+I8vOaHOURqm9TKNldnXpONSJzAIwnsZAw66omsFGMsfs7V/wRLqfdDGrsGmp5UillYOjzoh5b /NurXPOpQNAWOIfBf3L/BxTyB1QI1I9V8cHy3LN+yBDnjJBHmLKCUZvbQtG9S/kTn6yoPWL7dae QhhbMc3o6ENUMRr3usWCEo94BnM1yy+INvcZdFr4LqHIHs3ws1ngxz/IG3z18qLu8cvqwK0+saW WPqX40A== X-Received: by 2002:a05:6102:3e85:b0:785:eb33:87a8 with SMTP id ada2fe7eead31-785eb33c5c5mr11250696137.4.1788279417620; Tue, 01 Sep 2026 09:16:57 -0700 (PDT) X-Received: by 2002:a05:6102:3e85:b0:785:eb33:87a8 with SMTP id ada2fe7eead31-785eb33c5c5mr11250385137.4.1788279412211; Tue, 01 Sep 2026 09:16:52 -0700 (PDT) Received: from [150.1.200.157] ([172.56.108.54]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-98067404077sm222832241.13.2026.09.01.09.16.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Sep 2026 09:16:51 -0700 (PDT) Message-ID: Date: Tue, 1 Sep 2026 09:16:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 05/11] [gdb/testsuite] Add transparent_uplevel To: Tom de Vries , gdb-patches@sourceware.org References: <20260824135855.1195963-1-tdevries@suse.de> <20260824135855.1195963-6-tdevries@suse.de> From: Keith Seitz In-Reply-To: <20260824135855.1195963-6-tdevries@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Cx_hIwxUdJ7j7sPAe2KE3lsNhaRoItTRxWEtG2o1QtA_1788279418 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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 Hi, On 8/24/26 6:58 AM, Tom de Vries wrote: > Having learned the trick of increasing -level, factor out a new proc > transparent_uplevel: > ... > proc transparent_uplevel { body } { > catch {uplevel 2 $body} result opts > return -options [dict incr opts -level 2] $result > ... > to be used in conjunction with try/finally to apply this pattern: > ... > proc foo { body } { > > try { > transparent_uplevel $body > } finally { > > } > } > ... > such that "foo body" has the same effect as "body", apart from the > / parts. > > This proc has the fix for PR34553 designed into it, so (correctly) applying it > in a proc will fix the PR there. > > Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34553 > --- > gdb/testsuite/lib/gdb.exp | 47 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 88a42aff4ac..853b45f4a53 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -3218,6 +3218,53 @@ gdb_caching_proc allow_tui_tests {} { > return [expr {[string first "--enable-tui" $output] != -1}] > } > > +# Run BODY in the context of the callers caller. Typo: "caller's caller". > +# > +# To be used in a proc foo: > +# proc foo {body} { > +# transparent_uplevel body > +# } I think "body" here is missing a '$'? Keith > +# to make "foo body" have the same effect as "body". > +# > +# It ensures this by doing two things: > +# - evaluating the body in the context of the caller of foo > +# - propagating any return, exceptional or not to the caller of foo. > +# > +# Typically used in conjunction with try/finally, to ensure something > +# happens before and after body. For instance, this: > +# proc foo {body} { > +# try { > +# puts "foo: enter" > +# transparent_uplevel $body > +# } finally { > +# puts "foo: exit" > +# } > +# } > +# > +# for {set i 0} {$i < 5} {incr i} { > +# puts $i > +# foo { > +# if {$i == 2} { > +# break > +# } > +# } > +# } > +# produces: > +# 0 > +# foo: enter > +# foo: exit > +# 1 > +# foo: enter > +# foo: exit > +# 2 > +# foo: enter > +# foo: exit > + > +proc transparent_uplevel { body } { > + catch {uplevel 2 $body} result opts > + return -options [dict incr opts -level 2] $result > +} > + > # Test files shall make sure all the test result lines in gdb.sum are > # unique in a test run, so that comparing the gdb.sum files of two > # test runs gives correct results. Test files that exercise