Allow re-assigning to convenience variables
In Ada mode, re-assigning an array of a different size to a convenience variable will cause an error: (gdb) set lang ada (gdb) set $v := "abc" (gdb) set $v := "abcd" cannot assign arrays of different length However, this does not really make sense -- instead, it should always be possible to overwrite a convenience variable. This patch fixes this bug. This was reviewed off-list by Joel. I'm checking it in. gdb/ChangeLog 2019-06-14 Tom Tromey <tromey@adacore.com> * ada-lang.c (ada_evaluate_subexp) <case BINOP_ASSIGN>: Always allow assignment to an internalvar. gdb/testsuite/ChangeLog 2019-06-14 Tom Tromey <tromey@adacore.com> * gdb.ada/set_wstr.exp: Add reassignment test.
This commit is contained in:
parent
4268ec187d
commit
f411722cbc
@ -1,3 +1,8 @@
|
|||||||
|
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* ada-lang.c (ada_evaluate_subexp) <case BINOP_ASSIGN>: Always
|
||||||
|
allow assignment to an internalvar.
|
||||||
|
|
||||||
2019-06-14 Tom Tromey <tromey@adacore.com>
|
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* ada-lex.l: Allow "_" in attribute names.
|
* ada-lex.l: Allow "_" in attribute names.
|
||||||
|
@ -10486,7 +10486,11 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|
|||||||
arg2 = evaluate_subexp (type, exp, pos, noside);
|
arg2 = evaluate_subexp (type, exp, pos, noside);
|
||||||
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
return arg1;
|
return arg1;
|
||||||
if (ada_is_fixed_point_type (value_type (arg1)))
|
if (VALUE_LVAL (arg1) == lval_internalvar)
|
||||||
|
{
|
||||||
|
/* Nothing. */
|
||||||
|
}
|
||||||
|
else if (ada_is_fixed_point_type (value_type (arg1)))
|
||||||
arg2 = cast_to_fixed (value_type (arg1), arg2);
|
arg2 = cast_to_fixed (value_type (arg1), arg2);
|
||||||
else if (ada_is_fixed_point_type (value_type (arg2)))
|
else if (ada_is_fixed_point_type (value_type (arg2)))
|
||||||
error
|
error
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* gdb.ada/set_wstr.exp: Add reassignment test.
|
||||||
|
|
||||||
2019-06-14 Tom Tromey <tromey@adacore.com>
|
2019-06-14 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* gdb.ada/formatted_ref.exp (test_p_x_addr): Check
|
* gdb.ada/formatted_ref.exp (test_p_x_addr): Check
|
||||||
|
@ -72,3 +72,8 @@ gdb_test "print rws" \
|
|||||||
|
|
||||||
gdb_test "set variable www := \"1#2#3#4#5#\"" \
|
gdb_test "set variable www := \"1#2#3#4#5#\"" \
|
||||||
"cannot assign arrays of different length"
|
"cannot assign arrays of different length"
|
||||||
|
|
||||||
|
# However, reassigning an array of a different length should work when
|
||||||
|
# the LHS is a convenience variable.
|
||||||
|
gdb_test_no_output "set variable \$str := \"1234\""
|
||||||
|
gdb_test_no_output "set variable \$str := \"12345\""
|
||||||
|
Loading…
Reference in New Issue
Block a user