From: Keith Seitz <keiths@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 11/11] [gdb/testsuite] Refactor exception handling in with_stub_devices
Date: Tue, 1 Sep 2026 09:10:41 -0700 [thread overview]
Message-ID: <9da9e1c1-bf93-4bd0-9886-cc208962aca0@redhat.com> (raw)
In-Reply-To: <20260824135855.1195963-12-tdevries@suse.de>
Hi,
On 8/24/26 6:58 AM, Tom de Vries wrote:
> Use with_override and try/finally to simplify with_stub_devices.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34552
> ---
> gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp b/gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp
> index 8f04cca7981..7f90a112138 100644
> --- a/gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp
> +++ b/gdb/testsuite/gdb.rocm/hcc-amdgpu-targets.exp
> @@ -24,13 +24,16 @@ load_lib rocm.exp
> # Run BODY with find_amdgpu_devices stubbed to return DEVICES, then
> # restore the original proc.
> proc with_stub_devices {devices body} {
> - rename find_amdgpu_devices __saved_find_amdgpu_devices
> # tclint-disable-next-line command-args
> - proc find_amdgpu_devices {} [list return $devices]
> - set code [catch {uplevel 1 $body} result]
> - rename find_amdgpu_devices {}
> - rename __saved_find_amdgpu_devices find_amdgpu_devices
> - return -code $code $result
> + proc with_stub_devices_find_amdgpu_devices {} [list return $devices]
> + try {
> + # tclint-disable-next-line command-args
> + with_override \
> + find_amdgpu_devices with_stub_devices_find_amdgpu_devices \
> + $body
> + } finally {
> + rename with_stub_devices_find_amdgpu_devices {}
> + }
IIUC, this try block using with_override is effectively evaluating
"$body" in this context (with_stub_devices). Previously the
uplevel would cause this to run in the caller.
Is this missing a call to transparent_uplevel?
Keith
next prev parent reply other threads:[~2026-09-01 16:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 13:58 [PATCH 00/11] [gdb/testsuite] Refactor exception handling Tom de Vries
2026-08-24 13:58 ` [PATCH 01/11] [gdb/testsuite] Normalize indentation in with_test_prefix Tom de Vries
2026-09-02 19:41 ` Tom Tromey
2026-09-04 9:48 ` Tom de Vries
2026-08-24 13:58 ` [PATCH 02/11] [gdb/testsuite] Fix return -level 2 bug " Tom de Vries
2026-09-02 19:46 ` Tom Tromey
2026-08-24 13:58 ` [PATCH 03/11] [gdb/testsuite] Simplify foreach_with_prefix Tom de Vries
2026-08-24 13:58 ` [PATCH 04/11] [gdb/testsuite] Refactor exception handling in foreach_with_prefix Tom de Vries
2026-08-24 13:58 ` [PATCH 05/11] [gdb/testsuite] Add transparent_uplevel Tom de Vries
2026-09-01 16:16 ` Keith Seitz
2026-08-24 13:58 ` [PATCH 06/11] [gdb/testsuite] Refactor exception handling Tom de Vries
2026-08-24 13:58 ` [PATCH 07/11] [gdb/testsuite] Refactor exception handling in gdb_expect Tom de Vries
2026-08-24 13:58 ` [PATCH 08/11] [gdb/testsuite] Refactor exception handling in gdb_test_multiple Tom de Vries
2026-08-25 7:29 ` Tom de Vries
2026-09-01 16:13 ` Keith Seitz
2026-08-24 13:58 ` [PATCH 09/11] [gdb/testsuite] Refactor exception handling in lock_file_acquire/release Tom de Vries
2026-08-24 13:58 ` [PATCH 10/11] [gdb/testsuite] Refactor exception handling in tentative_rename Tom de Vries
2026-08-24 13:58 ` [PATCH 11/11] [gdb/testsuite] Refactor exception handling in with_stub_devices Tom de Vries
2026-09-01 16:10 ` Keith Seitz [this message]
2026-09-01 17:07 ` [PATCH 00/11] [gdb/testsuite] Refactor exception handling Keith Seitz
2026-09-02 19:57 ` Tom Tromey
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=9da9e1c1-bf93-4bd0-9886-cc208962aca0@redhat.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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