mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-02 19:46:09 +08:00
gdb: allow enumeration constants as second operand of BINOP_REPEAT
This patch adds support for TYPE_CODE_ENUM values to be supplied as right-hand side operand of the BINOP_REPEAT (@) operator. The following should now work: enum { sz = 17 }; int main () { int arr[sz + 1] = { 0 }; return 0; /* line 9 here */ } (gdb) b 9 (gdb) r (gdb) p arr@sz $1 = {0 <repeats 17 times>} (gdb) A couple of tests is also included in this patch to demonstrate that it is working as intended. gdb/Changelog: 2016-04-01 Artemiy Volkov <artemiyv@acm.org> PR gdb/19820 * eval.c (evaluate_subexp_standard): Allow TYPE_CODE_ENUM to be the type of BINOP_REPEAT's second operand. gdb/testsuite/Changelog: 2016-04-01 Artemiy Volkov <artemiyv@acm.org> PR gdb/19820 * gdb.base/printcmds.exp: Add artificial arrays tests.
This commit is contained in:
@ -2427,7 +2427,8 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
type = check_typedef (value_type (arg2));
|
||||
if (TYPE_CODE (type) != TYPE_CODE_INT)
|
||||
if (TYPE_CODE (type) != TYPE_CODE_INT
|
||||
&& TYPE_CODE (type) != TYPE_CODE_ENUM)
|
||||
error (_("Non-integral right operand for \"@\" operator."));
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user