public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Hannes Domani <ssbssa@yahoo.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Allow value repeat operator on references
Date: Fri, 9 Feb 2024 12:14:36 -0700	[thread overview]
Message-ID: <20240209121436.79da5ec9@f39-zbm-amd> (raw)
In-Reply-To: <20240209130451.31442-1-ssbssa@yahoo.de>

On Fri,  9 Feb 2024 14:04:51 +0100
Hannes Domani <ssbssa@yahoo.de> wrote:

> Currently it's not possible to use the value repeat operator on references:
> ```
> print ((int &) v_int_array_init[0])@2
> Only values in memory can be extended with '@'.
> ```
> 
> This seems like an unnecessary restriction, since it also prevents
> its use on iterators (which was the original reported problem):
> ```
> (gdb) p *it@2
> Only values in memory can be extended with '@'.
> ```
> 
> So this converts any references to the referenced value in value_repeat,
> making this possible:
> ```
> print ((int &) v_int_array_init[0])@2
> $1 = {10, 20}
> (gdb) p *it@2
> $2 = {1, 2}
> ```
> ---
>  gdb/testsuite/gdb.base/exprs.exp | 1 +
>  gdb/valops.c                     | 2 ++
>  2 files changed, 3 insertions(+)

LGTM.

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


  reply	other threads:[~2024-02-09 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240209130451.31442-1-ssbssa.ref@yahoo.de>
2024-02-09 13:04 ` Hannes Domani
2024-02-09 19:14   ` Kevin Buettner [this message]
2024-02-09 19:27     ` Hannes Domani

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=20240209121436.79da5ec9@f39-zbm-amd \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).