* [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
@ 2016-03-20 19:27 Artemiy Volkov
2016-03-23 16:21 ` Yao Qi
2016-03-23 21:04 ` [PATCH v2] " Artemiy Volkov
0 siblings, 2 replies; 8+ messages in thread
From: Artemiy Volkov @ 2016-03-20 19:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Artemiy Volkov
This patch adds support for TYPE_CODE_ENUM values to be supplied
as right-hand side operands 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-03-20 Artemiy Volkov <artemiyv@acm.org>
* eval.c (evaluate_subexp_standard): Allow TYPE_CODE_ENUM to be
the type of BINOP_REPEAT's second operand.
gdb/testsuite/Changelog:
2016-03-20 Artemiy Volkov <artemiyv@acm.org>
* gdb.base/printcmds.exp: Add artificial arrays tests.
---
gdb/eval.c | 3 ++-
gdb/testsuite/gdb.base/printcmds.exp | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index 78ad946..5d32a3c 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -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)
{
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 3c78a53..d599a70 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -643,6 +643,11 @@ proc test_artificial_arrays {} {
gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2${ctrlv}@3" \
"({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
{p int1dim[0]@2@3}
+ gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO" " = {0, 1}" \
+ {p int1dim[0]@TWO}
+ gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO${ctrlv}@three" \
+ "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
+ {p int1dim[0]@TWO@three}
gdb_test_escape_braces {p/x (short [])0x12345678} \
" = ({0x1234, 0x5678}|{0x5678, 0x1234})"
}
--
2.7.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-03-20 19:27 [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT Artemiy Volkov
@ 2016-03-23 16:21 ` Yao Qi
2016-03-23 19:00 ` Artemiy Volkov
2016-03-23 21:04 ` [PATCH v2] " Artemiy Volkov
1 sibling, 1 reply; 8+ messages in thread
From: Yao Qi @ 2016-03-23 16:21 UTC (permalink / raw)
To: Artemiy Volkov; +Cc: gdb-patches
Artemiy Volkov <artemiyv@acm.org> writes:
> A couple of tests is also included in this patch to demonstrate that it is
> working as intended.
>
> gdb/Changelog:
>
> 2016-03-20 Artemiy Volkov <artemiyv@acm.org>
>
Add "PR gdb/19820" here...
> * eval.c (evaluate_subexp_standard): Allow TYPE_CODE_ENUM to be
> the type of BINOP_REPEAT's second operand.
>
> gdb/testsuite/Changelog:
>
> 2016-03-20 Artemiy Volkov <artemiyv@acm.org>
>
and here...
> * gdb.base/printcmds.exp: Add artificial arrays tests.
You can reference existing ChangeLog entries.
Did you run regression tests? If the test is regression free, the patch
is OK to me with the ChangeLog entry fix I point out above.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-03-23 16:21 ` Yao Qi
@ 2016-03-23 19:00 ` Artemiy Volkov
0 siblings, 0 replies; 8+ messages in thread
From: Artemiy Volkov @ 2016-03-23 19:00 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Wed, Mar 23, 2016 at 04:20:46PM +0000, Yao Qi wrote:
> Artemiy Volkov <artemiyv@acm.org> writes:
>
> > A couple of tests is also included in this patch to demonstrate that it is
> > working as intended.
> >
> > gdb/Changelog:
> >
> > 2016-03-20 Artemiy Volkov <artemiyv@acm.org>
> >
>
> Add "PR gdb/19820" here...
>
> > * eval.c (evaluate_subexp_standard): Allow TYPE_CODE_ENUM to be
> > the type of BINOP_REPEAT's second operand.
> >
> > gdb/testsuite/Changelog:
> >
> > 2016-03-20 Artemiy Volkov <artemiyv@acm.org>
> >
>
> and here...
>
> > * gdb.base/printcmds.exp: Add artificial arrays tests.
>
> You can reference existing ChangeLog entries.
OK, will do and resend as v2.
>
> Did you run regression tests? If the test is regression free, the patch
> is OK to me with the ChangeLog entry fix I point out above.
Yes, I've made sure that there are no regressions.
Thank you for the review,
Artemiy
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-03-20 19:27 [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT Artemiy Volkov
2016-03-23 16:21 ` Yao Qi
@ 2016-03-23 21:04 ` Artemiy Volkov
2016-04-01 12:15 ` Artemiy Volkov
1 sibling, 1 reply; 8+ messages in thread
From: Artemiy Volkov @ 2016-03-23 21:04 UTC (permalink / raw)
To: gdb-patches; +Cc: qiyaoltc, Artemiy Volkov
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-03-23 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-03-23 Artemiy Volkov <artemiyv@acm.org>
PR gdb/19820
* gdb.base/printcmds.exp: Add artificial arrays tests.
---
v1 -> v2: Add PR # information to the changelog entries.
gdb/eval.c | 3 ++-
gdb/testsuite/gdb.base/printcmds.exp | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/eval.c b/gdb/eval.c
index 78ad946..5d32a3c 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -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)
{
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 3c78a53..d599a70 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -643,6 +643,11 @@ proc test_artificial_arrays {} {
gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2${ctrlv}@3" \
"({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
{p int1dim[0]@2@3}
+ gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO" " = {0, 1}" \
+ {p int1dim[0]@TWO}
+ gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO${ctrlv}@three" \
+ "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
+ {p int1dim[0]@TWO@three}
gdb_test_escape_braces {p/x (short [])0x12345678} \
" = ({0x1234, 0x5678}|{0x5678, 0x1234})"
}
--
2.7.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-03-23 21:04 ` [PATCH v2] " Artemiy Volkov
@ 2016-04-01 12:15 ` Artemiy Volkov
2016-04-01 13:09 ` Yao Qi
0 siblings, 1 reply; 8+ messages in thread
From: Artemiy Volkov @ 2016-04-01 12:15 UTC (permalink / raw)
To: gdb-patches@sourceware.org ml; +Cc: Yao Qi
On Thu, Mar 24, 2016 at 12:02 AM, Artemiy Volkov <artemiyv@acm.org> wrote:
> 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-03-23 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-03-23 Artemiy Volkov <artemiyv@acm.org>
>
> PR gdb/19820
> * gdb.base/printcmds.exp: Add artificial arrays tests.
> ---
>
> v1 -> v2: Add PR # information to the changelog entries.
>
> gdb/eval.c | 3 ++-
> gdb/testsuite/gdb.base/printcmds.exp | 5 +++++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/eval.c b/gdb/eval.c
> index 78ad946..5d32a3c 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -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)
> {
> diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
> index 3c78a53..d599a70 100644
> --- a/gdb/testsuite/gdb.base/printcmds.exp
> +++ b/gdb/testsuite/gdb.base/printcmds.exp
> @@ -643,6 +643,11 @@ proc test_artificial_arrays {} {
> gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2${ctrlv}@3" \
> "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
> {p int1dim[0]@2@3}
> + gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO" " = {0, 1}" \
> + {p int1dim[0]@TWO}
> + gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@TWO${ctrlv}@three" \
> + "({{0, 1}, {2, 3}, {4, 5}}|\[Cc\]annot.*)" \
> + {p int1dim[0]@TWO@three}
> gdb_test_escape_braces {p/x (short [])0x12345678} \
> " = ({0x1234, 0x5678}|{0x5678, 0x1234})"
> }
> --
> 2.7.3
>
Ping. Is v2 good enough to go in?
Thanks,
Artemiy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-04-01 12:15 ` Artemiy Volkov
@ 2016-04-01 13:09 ` Yao Qi
2016-04-01 13:20 ` Artemiy Volkov
0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2016-04-01 13:09 UTC (permalink / raw)
To: artemiyv; +Cc: gdb-patches@sourceware.org ml, Yao Qi
Artemiy Volkov <artemiyv@acm.org> writes:
> Ping. Is v2 good enough to go in?
Yes, it is. I thought you've pushed v2 in because it was pre-approved
in my review. Sorry for the confusion.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-04-01 13:09 ` Yao Qi
@ 2016-04-01 13:20 ` Artemiy Volkov
2016-04-01 15:02 ` Yao Qi
0 siblings, 1 reply; 8+ messages in thread
From: Artemiy Volkov @ 2016-04-01 13:20 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches@sourceware.org ml
On Fri, Apr 1, 2016 at 4:09 PM, Yao Qi <qiyaoltc@gmail.com> wrote:
> Artemiy Volkov <artemiyv@acm.org> writes:
>
>> Ping. Is v2 good enough to go in?
>
> Yes, it is. I thought you've pushed v2 in because it was pre-approved
> in my review. Sorry for the confusion.
>
I do not have write access to the tree. That's why I was waiting for
you or someone else to pick it up.
Thanks,
Artemiy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT
2016-04-01 13:20 ` Artemiy Volkov
@ 2016-04-01 15:02 ` Yao Qi
0 siblings, 0 replies; 8+ messages in thread
From: Yao Qi @ 2016-04-01 15:02 UTC (permalink / raw)
To: artemiyv; +Cc: Yao Qi, gdb-patches@sourceware.org ml
Artemiy Volkov <artemiyv@acm.org> writes:
> I do not have write access to the tree. That's why I was waiting for
> you or someone else to pick it up.
Done.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-01 15:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-20 19:27 [PATCH] [PR gdb/19820] gdb: allow enumeration constants as second operand of BINOP_REPEAT Artemiy Volkov
2016-03-23 16:21 ` Yao Qi
2016-03-23 19:00 ` Artemiy Volkov
2016-03-23 21:04 ` [PATCH v2] " Artemiy Volkov
2016-04-01 12:15 ` Artemiy Volkov
2016-04-01 13:09 ` Yao Qi
2016-04-01 13:20 ` Artemiy Volkov
2016-04-01 15:02 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox