Demangling broken (was: Re: [PATCH] Demangler woes with current CVS and type names)

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Thu Jan 31 10:31:00 GMT 2002


> Date: Thu, 31 Jan 2002 12:31:41 -0500
> From: Phil Edwards <phil@jaj.com>

> Does it ever make sense for any demangling anywhere -- i.e., for non-types --
> to only partially consume a mangled string?  (I wouldn't think so, but...)

I don't know either, but supposedly it can stop at characters
not in the mangled set.  I don't remember if it has to eat all
characters fed to it to be considered successful.

> Right now nothing checks for leftover characters, hence the partial
> demangling.  If demangle_type() were to check for leftover characters,
> and return failure in that situation, wouldn't that solve the problem
> altogether, without needing additional flags?

No.  To repeat in other words: it would only be a partial
solution, solving the partial-demangling bug.  An option flag
seems needed.  Otherwise, an identifier named "d" would be
demangled as "double" which isn't a valid demangling *for an
identifier*.  That's why we need a flag, so the caller can say
that it just wants _Z symbols demangled with the v3-demangler.

>  ldmisc.c:demangle() would
> then see the failure and return the "mangled" string.
>
> Or demangle_type's parent, cplus_demangle_v3, could do the check.
> That would catch extra characters left behind after non-type demangling.

Either way seems a partial solution, solving the "data" ->
"double" error, but not to the "d" -> "double" error.

I don't know if partial demangling is needed for *other callers*.
Presumably doing what the old demangler does would fit.

brgds, H-P



More information about the Binutils mailing list