Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@wasabisystems.com>
To: David Carlton <carlton@kealia.com>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: new demangler
Date: Mon, 15 Dec 2003 23:23:00 -0000	[thread overview]
Message-ID: <m3ptepfyxh.fsf@gossamer.airs.com> (raw)
In-Reply-To: <m3u141fz28.fsf@gossamer.airs.com>

Ian Lance Taylor <ian@wasabisystems.com> writes:

> David Carlton <carlton@kealia.com> writes:
> 
> > So is there a problem with the way class_name_from_physname invokes
> > the demangler?  It does this:
> > 
> >   char *demangled_name = cplus_demangle (physname, DMGL_ANSI);
> > 
> > Compared to other places in GDB where the demangler is called, this is
> > unusual since DMGL_PARAMS isn't passed in as well, but I don't see why
> > that would cause the demangling to fail completely.
> 
> Well, in fact, there was a bug in the case where DMGL_PARAMS was not
> set.  I just checked in a patch for it.
> 
> Sorry about that.  I've had the patch for a while, but I haven't had a
> chance to check it in.

BTW, when I say that I just checked in the patch, I mean that I just
checked it in to the master sources in the gcc repository.

Here's the patch.

Ian

Index: cp-demangle.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/cp-demangle.c,v
retrieving revision 1.58
diff -u -p -r1.58 cp-demangle.c
--- cp-demangle.c	15 Dec 2003 14:37:25 -0000	1.58
+++ cp-demangle.c	15 Dec 2003 23:14:02 -0000
@@ -3622,9 +3622,11 @@ d_demangle (mangled, options, palc)
   else
     dc = d_type (&di);
 
-  /* If we didn't consume the entire mangled string, then we didn't
-     successfully demangle it.  */
-  if (d_peek_char (&di) != '\0')
+  /* If DMGL_PARAMS is set, then if we didn't consume the entire
+     mangled string, then we didn't successfully demangle it.  If
+     DMGL_PARAMS is not set, we didn't look at the trailing
+     parameters.  */
+  if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0')
     dc = NULL;
 
 #ifdef CP_DEMANGLE_DEBUG
@@ -3829,37 +3831,37 @@ is_ctor_or_dtor (mangled, ctor_kind, dto
 
   dc = d_mangled_name (&di, 1);
 
+  /* Note that because we did not pass DMGL_PARAMS, we don't expect to
+     demangle the entire string.  */
+
   ret = 0;
-  if (d_peek_char (&di) == '\0')
+  while (dc != NULL)
     {
-      while (dc != NULL)
+      switch (dc->type)
 	{
-	  switch (dc->type)
-	    {
-	    default:
-	      dc = NULL;
-	      break;
-	    case D_COMP_TYPED_NAME:
-	    case D_COMP_TEMPLATE:
-	    case D_COMP_RESTRICT_THIS:
-	    case D_COMP_VOLATILE_THIS:
-	    case D_COMP_CONST_THIS:
-	      dc = d_left (dc);
-	      break;
-	    case D_COMP_QUAL_NAME:
-	      dc = d_right (dc);
-	      break;
-	    case D_COMP_CTOR:
-	      *ctor_kind = dc->u.s_ctor.kind;
-	      ret = 1;
-	      dc = NULL;
-	      break;
-	    case D_COMP_DTOR:
-	      *dtor_kind = dc->u.s_dtor.kind;
-	      ret = 1;
-	      dc = NULL;
-	      break;
-	    }
+	default:
+	  dc = NULL;
+	  break;
+	case D_COMP_TYPED_NAME:
+	case D_COMP_TEMPLATE:
+	case D_COMP_RESTRICT_THIS:
+	case D_COMP_VOLATILE_THIS:
+	case D_COMP_CONST_THIS:
+	  dc = d_left (dc);
+	  break;
+	case D_COMP_QUAL_NAME:
+	  dc = d_right (dc);
+	  break;
+	case D_COMP_CTOR:
+	  *ctor_kind = dc->u.s_ctor.kind;
+	  ret = 1;
+	  dc = NULL;
+	  break;
+	case D_COMP_DTOR:
+	  *dtor_kind = dc->u.s_dtor.kind;
+	  ret = 1;
+	  dc = NULL;
+	  break;
 	}
     }
 


  reply	other threads:[~2003-12-15 23:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-15 22:53 David Carlton
2003-12-15 22:54 ` Daniel Jacobowitz
2003-12-15 23:01   ` David Carlton
2003-12-15 23:10     ` Ian Lance Taylor
2003-12-15 23:17       ` David Carlton
2003-12-15 23:20         ` Ian Lance Taylor
2003-12-15 23:23           ` Ian Lance Taylor [this message]
2003-12-15 23:29             ` David Carlton
2003-12-15 23:33               ` Ian Lance Taylor
2003-12-15 23:38                 ` David Carlton
2003-12-16  5:30                   ` Daniel Jacobowitz
2003-12-18  2:22                     ` Jim Blandy
2003-12-18  2:58                       ` Ian Lance Taylor
2003-12-18  5:21                         ` Daniel Jacobowitz
2003-12-18 16:01                           ` Ian Lance Taylor
2003-12-15 23:16 Michael Elizabeth Chastain
2003-12-15 23:55 Michael Elizabeth Chastain
2003-12-18  4:04 Michael Elizabeth Chastain

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=m3ptepfyxh.fsf@gossamer.airs.com \
    --to=ian@wasabisystems.com \
    --cc=carlton@kealia.com \
    --cc=gdb@sources.redhat.com \
    /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