]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Allow value repeat operator on references
authorHannes Domani <ssbssa@yahoo.de>
Fri, 9 Feb 2024 19:25:29 +0000 (20:25 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 9 Feb 2024 19:26:15 +0000 (20:26 +0100)
commit6b991efe7b8c687ab0af64ca6124dbd4a69a6724
tree6a21889b78d108517e96d662985caaf2737e923b
parent4199cf1e152daab0460f08cc7dbd1f727ac3e4cc
Allow value repeat operator on references

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}
```

Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/testsuite/gdb.base/exprs.exp
gdb/valops.c