Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Make test-cp-name-parser usable
@ 2011-08-02 17:02 Jan Kratochvil
  2011-08-03 20:37 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2011-08-02 17:02 UTC (permalink / raw)
  To: gdb-patches

Hi,

I found during `make test-cp-name-parser' a dead-loop

#0  0x00000000004065ef in xfree (ptr=0x623a40) at cp-name-parser.y:2108
#1  0x00000000004065f4 in xfree (ptr=0x623a40) at cp-name-parser.y:2108
#2  0x00000000004065f4 in xfree (ptr=0x623a40) at cp-name-parser.y:2108

I do not see how easily enough to fix it and I do not think a small memory
leak matters for a test program.

And also a bit misleading that parsing errors were not indicated.
That commented string was already there during initial check-in.


Thanks,
Jan


gdb/
2011-08-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* cp-name-parser.y (xfree): Remove the call of free.
	(main): Uncomment "Demangling error\n".

--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -2036,13 +2036,12 @@ trim_chars (char *lexptr, char **extra_chars)
 }
 
 /* When this file is built as a standalone program, xmalloc comes from
-   libiberty --- in which case we have to provide xfree ourselves.  */
+   libiberty --- in which case we have to provide xfree ourselves.
+   A call to free would get translated xfree back again.  Leak is OK.  */
 
 void
 xfree (void *ptr)
 {
-  if (ptr != NULL)
-    free (ptr);
 }
 
 int
@@ -2071,7 +2070,7 @@ main (int argc, char **argv)
 	str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
 	if (str2 == NULL)
 	  {
-	    /* printf ("Demangling error\n"); */
+	    printf ("Demangling error\n");
 	    if (c)
 	      printf ("%s%c%s\n", buf, c, extra_chars);
 	    else


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

end of thread, other threads:[~2011-08-06 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 17:02 [patch] Make test-cp-name-parser usable Jan Kratochvil
2011-08-03 20:37 ` Daniel Jacobowitz
2011-08-03 20:56   ` Tom Tromey
2011-08-04  9:51     ` Jan Kratochvil
2011-08-05 20:19       ` Daniel Jacobowitz
2011-08-06 14:15         ` Jan Kratochvil

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