Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PING: [PATCH] Fixing parse errors in c-exp.y
@ 2011-09-24 10:37 Abhijit Halder
  2011-09-24 10:44 ` Abhijit Halder
  2011-09-26 19:12 ` Keith Seitz
  0 siblings, 2 replies; 5+ messages in thread
From: Abhijit Halder @ 2011-09-24 10:37 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

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

Hi all,

This patch is about fixing parse error coming when gdb tries to parse
a pointer to a function pointer. e.g. (int)(**)(int) and the
associated problem, defined in PR 9837, which says wrong parsing when
pointers appear in function argument e.g.  (int)(*)(int*)

Please review this.

Thanks,
Abhijit Halder

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 268 bytes --]

2011-09-13  Abhijit Halder  <abhijit.k.halder@gmail.com>

	PR wrong parse/9837:
	* c-exp.y (nonempty_typelist): Use typebase instead of type.  Add rule
	to resolve pointers in function arguments.
	(abs_decl): Add new rule to resolve pointer(s) to a
	function pointer.

[-- Attachment #3: gdb-parse-error.patch --]
[-- Type: text/x-patch, Size: 976 bytes --]

Index: gdb/c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.82
diff -a -p -u -r1.82 c-exp.y
--- gdb/c-exp.y	6 May 2011 14:12:17 -0000	1.82
+++ gdb/c-exp.y	21 Sep 2011 05:53:28 -0000
@@ -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; }
 	|	'&'
@@ -1162,12 +1164,13 @@ typename:	TYPENAME
 	;
 
 nonempty_typelist
-	:	type
+	:	typebase
 		{ $$ = (struct type **) malloc (sizeof (struct type *) * 2);
 		  $<ivec>$[0] = 1;	/* Number of types in vector */
 		  $$[1] = $1;
 		}
-	|	nonempty_typelist ',' type
+	|	nonempty_typelist '*'
+	|	nonempty_typelist ',' typebase
 		{ int len = sizeof (struct type *) * (++($<ivec>1[0]) + 1);
 		  $$ = (struct type **) realloc ((char *) $1, len);
 		  $$[$<ivec>$[0]] = $3;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PING: [PATCH] Fixing parse errors in c-exp.y
  2011-09-24 10:37 PING: [PATCH] Fixing parse errors in c-exp.y Abhijit Halder
@ 2011-09-24 10:44 ` Abhijit Halder
  2011-09-25  8:51   ` Abhijit Halder
  2011-09-26 19:12 ` Keith Seitz
  1 sibling, 1 reply; 5+ messages in thread
From: Abhijit Halder @ 2011-09-24 10:44 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

On Sat, Sep 24, 2011 at 2:48 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> Hi all,
>
> This patch is about fixing parse error coming when gdb tries to parse
> a pointer to a function pointer. e.g. (int)(**)(int) and the

This is also a filed bug. (PR 9514).

> associated problem, defined in PR 9837, which says wrong parsing when
> pointers appear in function argument e.g.  (int)(*)(int*)
>
> Please review this.
>
> Thanks,
> Abhijit Halder
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PING: [PATCH] Fixing parse errors in c-exp.y
  2011-09-24 10:44 ` Abhijit Halder
@ 2011-09-25  8:51   ` Abhijit Halder
  0 siblings, 0 replies; 5+ messages in thread
From: Abhijit Halder @ 2011-09-25  8:51 UTC (permalink / raw)
  To: gdb-patches@sourceware.org ml

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

On Sat, Sep 24, 2011 at 4:07 PM, Abhijit Halder
<abhijit.k.halder@gmail.com> wrote:
> On Sat, Sep 24, 2011 at 2:48 PM, Abhijit Halder
> <abhijit.k.halder@gmail.com> wrote:
>> Hi all,
>>
>> This patch is about fixing parse error coming when gdb tries to parse
>> a pointer to a function pointer. e.g. (int)(**)(int) and the
>
> This is also a filed bug. (PR 9514).
>
>> associated problem, defined in PR 9837, which says wrong parsing when
>> pointers appear in function argument e.g.  (int)(*)(int*)
>>
>> Please review this.
>>
>> Thanks,
>> Abhijit Halder
>>
>

Updating the Changelog.

Regards,
Abhijit Halder

[-- Attachment #2: ChangeLog.txt --]
[-- Type: text/plain, Size: 278 bytes --]

2011-09-13  Abhijit Halder  <abhijit.k.halder@gmail.com>

	Fix PR exp/9514, gdb/9837:
	* c-exp.y (nonempty_typelist): Use typebase instead of type.  Add rule
	to resolve pointer(s) in function argument(s).
	(abs_decl): Add new rule to resolve pointer(s) to a
	function pointer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PING: [PATCH] Fixing parse errors in c-exp.y
  2011-09-24 10:37 PING: [PATCH] Fixing parse errors in c-exp.y Abhijit Halder
  2011-09-24 10:44 ` Abhijit Halder
@ 2011-09-26 19:12 ` Keith Seitz
  2011-09-27 10:44   ` Abhijit Halder
  1 sibling, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2011-09-26 19:12 UTC (permalink / raw)
  To: Abhijit Halder; +Cc: gdb-patches@sourceware.org ml

On 09/24/2011 02:18 AM, Abhijit Halder wrote:

> This patch is about fixing parse error coming when gdb tries to parse
> a pointer to a function pointer. e.g. (int)(**)(int) and the
> associated problem, defined in PR 9837, which says wrong parsing when
> pointers appear in function argument e.g.  (int)(*)(int*)

Thank you for looking into this issue -- I have recently stumbled upon 
this (again), and I am glad someone is attempting to fix it. It is 
definitely not an easy task (which is why this has been sitting broken 
for so long).

> Please review this.

I have applied your patch to HEAD and run the test suite. Unfortunately, 
the proposed patch causes quite a few regressions:

! FAIL: gdb.base/code-expr.exp: (int ** @code)
! FAIL: gdb.base/cvexpr.exp: (int ** const)
! FAIL: gdb.cp/cpexprs.exp: print base::overload(base&) const
! FAIL: gdb.cp/cpexprs.exp: print base::overload(char*) const
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator*(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator%(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator-(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>>(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator!=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator|(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&&(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator+=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator*=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator%=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>>=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator|=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator,(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator/(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator+(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<<(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator==(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator^(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator||(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator-=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator/=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<<=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator^=(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator->*(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator[](foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator()(foo&)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
! FAIL: gdb.cp/overload.exp: print foo::overload1arg(char***)

These will need to be fixed before a serious review of this patch can 
proceed.

Keith


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PING: [PATCH] Fixing parse errors in c-exp.y
  2011-09-26 19:12 ` Keith Seitz
@ 2011-09-27 10:44   ` Abhijit Halder
  0 siblings, 0 replies; 5+ messages in thread
From: Abhijit Halder @ 2011-09-27 10:44 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches@sourceware.org ml

On Mon, Sep 26, 2011 at 11:53 PM, Keith Seitz <keiths@redhat.com> wrote:
> On 09/24/2011 02:18 AM, Abhijit Halder wrote:
>
>> This patch is about fixing parse error coming when gdb tries to parse
>> a pointer to a function pointer. e.g. (int)(**)(int) and the
>> associated problem, defined in PR 9837, which says wrong parsing when
>> pointers appear in function argument e.g.  (int)(*)(int*)
>
> Thank you for looking into this issue -- I have recently stumbled upon this
> (again), and I am glad someone is attempting to fix it. It is definitely not
> an easy task (which is why this has been sitting broken for so long).
>
>> Please review this.
>
> I have applied your patch to HEAD and run the test suite. Unfortunately, the
> proposed patch causes quite a few regressions:
>
> ! FAIL: gdb.base/code-expr.exp: (int ** @code)
> ! FAIL: gdb.base/cvexpr.exp: (int ** const)
> ! FAIL: gdb.cp/cpexprs.exp: print base::overload(base&) const
> ! FAIL: gdb.cp/cpexprs.exp: print base::overload(char*) const
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator*(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator%(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator-(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>>(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator!=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator|(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&&(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator+=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator*=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator%=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator>>=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator|=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator,(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator/(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator+(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<<(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator==(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator^(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator||(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator-=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator/=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator<<=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator&=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator^=(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator->*(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator[](foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator()(foo&)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
> ! FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
> ! FAIL: gdb.cp/overload.exp: print foo::overload1arg(char***)
>
> These will need to be fixed before a serious review of this patch can
> proceed.
>
> Keith
>

Sure, I will try to fix these issues soon.

Thanks,
Abhijit Halder


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-27  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-24 10:37 PING: [PATCH] Fixing parse errors in c-exp.y Abhijit Halder
2011-09-24 10:44 ` Abhijit Halder
2011-09-25  8:51   ` Abhijit Halder
2011-09-26 19:12 ` Keith Seitz
2011-09-27 10:44   ` Abhijit Halder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox