Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove uses of "eval" from gdb testsuite
Date: Mon, 15 Sep 2025 11:44:09 -0700	[thread overview]
Message-ID: <20250915114409.07f7be81@f41-zbm-amd> (raw)
In-Reply-To: <87frcnmufe.fsf@tromey.com>

On Mon, 15 Sep 2025 12:39:49 -0600
Tom Tromey <tom@tromey.com> wrote:

> >> proc dap_match_values {name d args} {
> >> foreach {key value} $args {
> >> -	if {[eval dict get [list $d] $key] != $value} {
> >> +	if {[dict get $d {*}$key] != $value} {  
> 
> Kevin> Is the {*} expansion needed here?  I've looked at the callers of
> Kevin> dap_match_values and the key is always a plain string, so the splatted
> Kevin> version is equivalent to 'dict get $d $key'.  The splat would only
> Kevin> matter if 'key' could be a list for a nested dictionary lookup.  
> 
> Yeah, many invocations use this feature, e.g.:
> 
> dap_match_values "argc in function" [lindex $obj 0] \
>     "body result" 3
> 
> Here 'args' ends up as the list {"body result" 3} and then the first
> call to "dict get" is passed "body result" as the key -- but this is
> trying to fetch a sub-key.

Ah, okay.  I clearly didn't look closely enough.  Thanks for the
explanation.

Reviewed-by: Kevin Buettner <kevinb@redhat.com>

Kevin


      reply	other threads:[~2025-09-15 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 19:40 Tom Tromey
2025-09-14 15:28 ` Tom de Vries
2025-09-15 18:15 ` Kevin Buettner
2025-09-15 18:39   ` Tom Tromey
2025-09-15 18:44     ` Kevin Buettner [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=20250915114409.07f7be81@f41-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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