Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix nested gdb_caching_proc with args; Fix gdb.rocm/ tests
Date: Mon, 15 Sep 2025 22:54:49 +0100	[thread overview]
Message-ID: <3e29d575-22c4-42b7-a8e9-2d57b7367a49@palves.net> (raw)
In-Reply-To: <20250915212841.4161603-1-pedro@palves.net>

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.

Pedro Alves


  reply	other threads:[~2025-09-15 21:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 21:28 Pedro Alves
2025-09-15 21:54 ` Pedro Alves [this message]
2025-09-15 23:57   ` [PATCH] Make gdb_caching_proc support namespaces Pedro Alves
2025-09-16  3:55     ` Simon Marchi
2025-09-16  9:31   ` [PATCH v2] Fix nested gdb_caching_proc with args; Fix gdb.rocm/ tests Pedro Alves
2025-09-16 10:56     ` Pedro Alves

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=3e29d575-22c4-42b7-a8e9-2d57b7367a49@palves.net \
    --to=pedro@palves.net \
    --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