Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hafiz Abid Qadeer <hafiz_abid@mentor.com>
To: <gdb-patches@sourceware.org>, <palves@redhat.com>
Subject: [patch] Missing UNOP_PLUS handler in c-lang.c
Date: Tue, 12 Feb 2013 14:38:00 -0000	[thread overview]
Message-ID: <1360679916.8583.0@abidh-ubunto1104> (raw)

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]


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.

[-- Attachment #2: c-lang.patch --]
[-- Type: text/x-patch, Size: 438 bytes --]

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},

             reply	other threads:[~2013-02-12 14:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 14:38 Hafiz Abid Qadeer [this message]
2013-02-12 19:56 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360679916.8583.0@abidh-ubunto1104 \
    --to=hafiz_abid@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox