Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 3/3] [gdb/testsuite] Simplify foreach_mi_ui_mode
Date: Thu, 24 Sep 2026 16:06:04 +0200	[thread overview]
Message-ID: <20260924140605.1009056-3-tdevries@suse.de> (raw)
In-Reply-To: <20260924140605.1009056-1-tdevries@suse.de>

Simplify foreach_mi_ui_mode using transparent_uplevel and foreach_with_prefix.
---
 gdb/testsuite/lib/mi-support.exp | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 240bc844350..cd7e0a61189 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -2922,8 +2922,6 @@ proc mi_get_valueof { fmt exp default {test ""} } {
 # BODY will be run just once with MODE set to 'main'.
 
 proc foreach_mi_ui_mode { var_name body } {
-    upvar 1 $var_name var
-
     if {[gdb_debug_enabled]} {
        # gdb debug doesn't work for separate-mi-tty.
        set modes {"main"}
@@ -2931,14 +2929,11 @@ proc foreach_mi_ui_mode { var_name body } {
        set modes {"main" "separate"}
     }
 
-    catch {
-	foreach var $modes {
-	    with_test_prefix "$var_name=$var" {
-		uplevel 1 $body
-	    }
+    transparent_uplevel [subst_vars {
+	foreach_with_prefix $var_name {$modes} {
+	    $body
 	}
-    } result opts
-    return -options [dict incr opts -level] $result
+    }]
 }
 
 # Check if GDB has information about the stderr symbol.
-- 
2.51.0


      parent reply	other threads:[~2026-09-24 14:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 14:06 [pushed 1/3] [gdb/testsuite] Use transparent_uplevel in foreach_with_prefix Tom de Vries
2026-09-24 14:06 ` [pushed 2/3] [gdb/testsuite] Add gdb.testsuite/foreach_with_prefix-2.exp Tom de Vries
2026-09-24 14:06 ` Tom de Vries [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260924140605.1009056-3-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox