Allow re-assigning to convenience variables
authorTom Tromey <tromey@adacore.com>
Tue, 5 Nov 2019 17:12:27 +0000 (10:12 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 14 Nov 2019 18:58:50 +0000 (11:58 -0700)
commit55708e99aca33f2ee9036732d778cd5899d2a2b0
treee62533e80ec25aa545539f243bb34d82ec125821
parent6b92c0d3533b8b01970e6ba5aa92581e027a63c2
Allow re-assigning to convenience variables

A customer reported somewhat odd gdb behavior, where re-assigning an
array or string to a convenience variable would yield "Too many array
elements".  A test case is:

    (gdb) p $x = "x"
    (gdb) p $x = "xyz"

This patch fixes the problem by making a special case in the evaluator
for assignment to convenience variables, which seems like the correct
behavior.

Note that a previous patch implemented this for Ada, see commit
f411722cb ("Allow re-assigning to convenience variables").

gdb/ChangeLog
2019-11-14  Tom Tromey  <tromey@adacore.com>

* eval.c (evaluate_subexp_standard) <BINOP_ASSIGN>: Do not pass an
expected type for the RHS if the LHS is a convenience variable.

gdb/testsuite/ChangeLog
2019-11-14  Tom Tromey  <tromey@adacore.com>

* gdb.base/gdbvars.exp (test_convenience_variables): Add
regression tests.

Change-Id: I5e66a2d243931a5c43c7af4bc9f6717464c2477e
gdb/ChangeLog
gdb/eval.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gdbvars.exp
This page took 0.025545 seconds and 4 git commands to generate.