public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [WIP patch] Fix crash regressions after libiberty/ update
@ 2012-01-08 23:37 Jan Kratochvil
  2012-01-10 19:12 ` Keith Seitz
  2012-01-10 19:37 ` [commit] " Jan Kratochvil
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kratochvil @ 2012-01-08 23:37 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches

Hi Keith,

there is now crash regression for:
	gdb.cp/cpexprs.exp
	gdb.cp/cplusfuncs.exp
after:
	C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)
	http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00336.html

with this patch there "only" remain these regressions:
	FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
	FAIL: gdb.cp/cplusfuncs.exp: print &foo::operator delete(void*)
	FAIL: gdb.cp/cplusfuncs.exp: info function for "operator delete("

I may look into it tomorrow but maybe Keith is more aware of these issues.


Regards,
Jan


gdb/
2012-01-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* c-exp.y (operator) <OPERATOR DELETE>
	(operator) <OPERATOR DELETE '[' ']'>: Add trailing space.
	* cp-name-parser.y (fill_comp, make_operator, make_dtor)
	(make_builtin_type, make_name): New variable i, add gdb_assert.
	(operator) <OPERATOR NEW>: Update ARGS to 3.
	(operator) <OPERATOR DELETE>: Add trailing space.
	(operator) <OPERATOR NEW '[' ']'>: Update ARGS to 3.
	(operator) <OPERATOR DELETE '[' ']'>: Add trailing space.
	* cp-support.c (cp_canonicalize_string): Check NULL from
	cp_comp_to_string, call warning and return.

--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1211,11 +1211,11 @@ const_or_volatile_noopt:  	const_and_volatile
 operator:	OPERATOR NEW
 			{ $$ = operator_stoken (" new"); }
 	|	OPERATOR DELETE
-			{ $$ = operator_stoken (" delete"); }
+			{ $$ = operator_stoken (" delete "); }
 	|	OPERATOR NEW '[' ']'
 			{ $$ = operator_stoken (" new[]"); }
 	|	OPERATOR DELETE '[' ']'
-			{ $$ = operator_stoken (" delete[]"); }
+			{ $$ = operator_stoken (" delete[] "); }
 	|	OPERATOR '+'
 			{ $$ = operator_stoken ("+"); }
 	|	OPERATOR '-'
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -188,7 +188,11 @@ fill_comp (enum demangle_component_type d_type, struct demangle_component *lhs,
 	   struct demangle_component *rhs)
 {
   struct demangle_component *ret = d_grab ();
-  cplus_demangle_fill_component (ret, d_type, lhs, rhs);
+  int i;
+
+  i = cplus_demangle_fill_component (ret, d_type, lhs, rhs);
+  gdb_assert (i);
+
   return ret;
 }
 
@@ -204,7 +208,11 @@ static struct demangle_component *
 make_operator (const char *name, int args)
 {
   struct demangle_component *ret = d_grab ();
-  cplus_demangle_fill_operator (ret, name, args);
+  int i;
+
+  i = cplus_demangle_fill_operator (ret, name, args);
+  gdb_assert (i);
+
   return ret;
 }
 
@@ -212,7 +220,11 @@ static struct demangle_component *
 make_dtor (enum gnu_v3_dtor_kinds kind, struct demangle_component *name)
 {
   struct demangle_component *ret = d_grab ();
-  cplus_demangle_fill_dtor (ret, kind, name);
+  int i;
+
+  i = cplus_demangle_fill_dtor (ret, kind, name);
+  gdb_assert (i);
+
   return ret;
 }
 
@@ -220,7 +232,11 @@ static struct demangle_component *
 make_builtin_type (const char *name)
 {
   struct demangle_component *ret = d_grab ();
-  cplus_demangle_fill_builtin_type (ret, name);
+  int i;
+
+  i = cplus_demangle_fill_builtin_type (ret, name);
+  gdb_assert (i);
+
   return ret;
 }
 
@@ -228,7 +244,11 @@ static struct demangle_component *
 make_name (const char *name, int len)
 {
   struct demangle_component *ret = d_grab ();
-  cplus_demangle_fill_name (ret, name, len);
+  int i;
+
+  i = cplus_demangle_fill_name (ret, name, len);
+  gdb_assert (i);
+
   return ret;
 }
 
@@ -420,13 +440,13 @@ demangler_special
 		;
 
 operator	:	OPERATOR NEW
-			{ $$ = make_operator ("new", 1); }
+			{ $$ = make_operator ("new", 3); }
 		|	OPERATOR DELETE
-			{ $$ = make_operator ("delete", 1); }
+			{ $$ = make_operator ("delete ", 1); }
 		|	OPERATOR NEW '[' ']'
-			{ $$ = make_operator ("new[]", 1); }
+			{ $$ = make_operator ("new[]", 3); }
 		|	OPERATOR DELETE '[' ']'
-			{ $$ = make_operator ("delete[]", 1); }
+			{ $$ = make_operator ("delete[] ", 1); }
 		|	OPERATOR '+'
 			{ $$ = make_operator ("+", 2); }
 		|	OPERATOR '-'
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -528,6 +528,13 @@ cp_canonicalize_string (const char *string)
   ret = cp_comp_to_string (info->tree, estimated_len);
   cp_demangled_name_parse_free (info);
 
+  if (ret == NULL)
+    {
+      warning (_("internal error: string \"%s\" failed to be canonicalized"),
+	       string);
+      return NULL;
+    }
+
   if (strcmp (string, ret) == 0)
     {
       xfree (ret);

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

* Re: [WIP patch] Fix crash regressions after libiberty/ update
  2012-01-08 23:37 [WIP patch] Fix crash regressions after libiberty/ update Jan Kratochvil
@ 2012-01-10 19:12 ` Keith Seitz
  2012-01-10 19:37 ` [commit] " Jan Kratochvil
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2012-01-10 19:12 UTC (permalink / raw)
  To: Jan Kratochvil, gdb-patches

On 01/08/2012 03:37 PM, Jan Kratochvil wrote:
> Hi Keith,
>
> there is now crash regression for:
> 	gdb.cp/cpexprs.exp
> 	gdb.cp/cplusfuncs.exp
> after:
> 	C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)
> 	http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00336.html
>
> with this patch there "only" remain these regressions:
> 	FAIL: gdb.cp/cplusfuncs.exp: print&foo::operator delete(void*)
> 	FAIL: gdb.cp/cplusfuncs.exp: print&foo::operator delete(void*)
> 	FAIL: gdb.cp/cplusfuncs.exp: info function for "operator delete("
>
> I may look into it tomorrow but maybe Keith is more aware of these issues.

Jason Merrill just committed another patch to libiberty which will fix 
these problems (with your patch, which I have perused and recommend you 
commit).

Thank you Jan and Jason!

Keith

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

* [commit] [WIP patch] Fix crash regressions after libiberty/ update
  2012-01-08 23:37 [WIP patch] Fix crash regressions after libiberty/ update Jan Kratochvil
  2012-01-10 19:12 ` Keith Seitz
@ 2012-01-10 19:37 ` Jan Kratochvil
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2012-01-10 19:37 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb-patches, Jason Merrill

On Mon, 09 Jan 2012 00:37:09 +0100, Jan Kratochvil wrote:
> gdb/
> 2012-01-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* c-exp.y (operator) <OPERATOR DELETE>
> 	(operator) <OPERATOR DELETE '[' ']'>: Add trailing space.
> 	* cp-name-parser.y (fill_comp, make_operator, make_dtor)
> 	(make_builtin_type, make_name): New variable i, add gdb_assert.
> 	(operator) <OPERATOR NEW>: Update ARGS to 3.
> 	(operator) <OPERATOR DELETE>: Add trailing space.
> 	(operator) <OPERATOR NEW '[' ']'>: Update ARGS to 3.
> 	(operator) <OPERATOR DELETE '[' ']'>: Add trailing space.
> 	* cp-support.c (cp_canonicalize_string): Check NULL from
> 	cp_comp_to_string, call warning and return.

Checked in:
	http://sourceware.org/ml/gdb-cvs/2012-01/msg00100.html


On Tue, 10 Jan 2012 20:02:31 +0100, Keith Seitz wrote:
> Jason Merrill just committed another patch to libiberty

      Re: C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)
      http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00505.html


> which will fix these problems (with your patch, which I have perused and
> recommend you commit).

I can confirm these two patches together fix for me all the regressions last
correct in 20120106, that was in GIT:
	ec9f619953971666fccfc2a5f92f67a6f57a22ac


Thanks,
Jan

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

end of thread, other threads:[~2012-01-10 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08 23:37 [WIP patch] Fix crash regressions after libiberty/ update Jan Kratochvil
2012-01-10 19:12 ` Keith Seitz
2012-01-10 19:37 ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).