From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: gdb-patches@sourceware.org
Subject: Re: [BUG] Parser error for "pointer to a function pointer"
Date: Sun, 04 Sep 2011 10:43:00 -0000 [thread overview]
Message-ID: <CAOhZP9zhhUshhbHCxw6pwKoNPpfXtLgR5g=ZuHQa8u-VbVqJeA@mail.gmail.com> (raw)
In-Reply-To: <CAOhZP9xKjoYM=aeys_R_S=Jean1VGRgC6EiVdOhim8MD0ypyfQ@mail.gmail.com>
On Sun, Sep 4, 2011 at 2:08 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> Hello everybody,
>
> While working with gdb I have encountered the following problem.
>
> GNU gdb (GDB) 7.3.50.20110814-cvs
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> (gdb) ptype int(**)(void)
> A syntax error in expression, near `*)(void)'.
>
>
> I have made the following changes to fix this issue.
>
>
> --- src/gdb/c-exp.y 2011-05-06 19:42:17.000000000 +0530
> +++ dst/gdb/c-exp.y 2011-09-04 13:57:16.082207664 +0530
> @@ -19,7 +19,7 @@
> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>
> /* Parse a C expression from text in a string,
> - and return the result as a struct expression pointer.
> + and return the result as a struct expression pointer.
> That structure contains arithmetic operations in reverse polish,
> with constants represented by operations that are followed by special data.
> See expression.h for the details of the format.
> @@ -926,12 +926,12 @@ const_or_volatile_or_space_identifier:
>
> abs_decl: '*'
> { push_type (tp_pointer); $$ = 0; }
> - | '*' abs_decl
> - { push_type (tp_pointer); $$ = $2; }
> + | abs_decl '*'
> + { push_type (tp_pointer); $$ = $1; }
> | '&'
> { push_type (tp_reference); $$ = 0; }
> - | '&' abs_decl
> - { push_type (tp_reference); $$ = $2; }
> + | abs_decl '&'
> + { push_type (tp_reference); $$ = $1; }
> | direct_abs_decl
> ;
>
> Thanks,
> Abhijit Halder
>
A regression happens with the above fix.
The above fix is not working for the following:
(gdb)ptype int (*(**(*)(char))(short int))(long int
The following is working fine.
--- src/gdb/c-exp.y 2011-05-06 19:42:17.000000000 +0530
+++ dst/gdb/c-exp.y 2011-09-04 15:57:51.212167205 +0530
@@ -926,6 +926,8 @@ const_or_volatile_or_space_identifier:
abs_decl: '*'
{ push_type (tp_pointer); $$ = 0; }
+ | abs_decl '*'
+ { push_type (tp_pointer); $$ = $1; }
| '*' abs_decl
{ push_type (tp_pointer); $$ = $2; }
| '&'
Thanks,
Abhijit Halder
next prev parent reply other threads:[~2011-09-04 10:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-04 9:22 Abhijit Halder
2011-09-04 10:43 ` Abhijit Halder [this message]
2011-09-04 10:47 ` Abhijit Halder
2011-09-04 13:54 ` Abhijit Halder
2011-09-04 14:52 ` Jan Kratochvil
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='CAOhZP9zhhUshhbHCxw6pwKoNPpfXtLgR5g=ZuHQa8u-VbVqJeA@mail.gmail.com' \
--to=abhijit.k.halder@gmail.com \
--cc=gdb-patches@sourceware.org \
/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