This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Missing UNOP_PLUS handler in c-lang.c
- From: Hafiz Abid Qadeer <hafiz_abid at mentor dot com>
- To: <gdb-patches at sourceware dot org>, <palves at redhat dot com>
- Date: Tue, 12 Feb 2013 14:38:36 +0000
- Subject: [patch] Missing UNOP_PLUS handler in c-lang.c
Hi All,
This patch fixes the problem shown in the session below. The fix was
originally created by Pedro a few years ago. I have updated it with the
current code and regtested it. Is it OK?
(gdb) set debug expression 1
(gdb) p +1
Dump of expression @ 0x8840908, before conversion to prefix form:
Language c, 5 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_LONG 40 (...............
1 <unknown 142879800> 142879800 8,..............
2 BINOP_ADD 1 ................
3 OP_LONG 40 (...............
4 UNOP_PLUS 70 F...............
Dump of expression @ 0x8840908, after conversion to prefix form:
Expression: `Invalid expression
Regards,
Abid
gdb:
2013-02-12 Pedro Alves <palves@redhat.com>
Hafiz Abid Qadeer <abidh@codesourcery.com>
* c-lang.c (c_op_print_tab): Add entry for UNOP_PLUS.diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 3a7d6f1..91cb21e 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -732,6 +732,7 @@ const struct op_print c_op_print_tab[] =
{"/", BINOP_DIV, PREC_MUL, 0},
{"%", BINOP_REM, PREC_MUL, 0},
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
+ {"+", UNOP_PLUS, PREC_PREFIX, 0},
{"-", UNOP_NEG, PREC_PREFIX, 0},
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},