This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Thu, Jan 31, 2002 at 11:29:55AM +0100, Hans-Peter Nilsson wrote:
> > From: Phil Edwards <phil@jaj.com>
> > 
> > With this patch, the non-_Z names used in the testcase above can be
> > demangled by c++filt.  I've added an entry to libiberty's testsuite,
> > which fails before and passes after.
> 
> And here's another testsuite entry, for a bug exposed or
> introduced by that patch:

I'd like to think "exposed," but hey, whatever.  :-)


> It's a double doh (no pun intended, I think): For binutils, we
> just want to demangle identifiers (not types), so for that use,
> the _Z check should be there to avoid spurious demangling.
> Tracing through the demangler, I see it's just the "d" character
> demangled, so demangling replaced the whole string with a
> partial demangling.  Sorry, no obvious fix jumped up at me.

I'm about to go into a staff meeting that's scheduled to last the rest of
my natural life, but after looking at demangle_type(), my thoughts are:

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...)
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?  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.


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]