Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Make test-cp-name-parser usable
Date: Tue, 02 Aug 2011 17:02:00 -0000	[thread overview]
Message-ID: <20110802170152.GA24932@host1.jankratochvil.net> (raw)

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


             reply	other threads:[~2011-08-02 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 17:02 Jan Kratochvil [this message]
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

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=20110802170152.GA24932@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.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