This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
alternate __cxa_demangle implementation
- From: Carlo Wood <carlo at alinoe dot com>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 3 Jan 2003 15:26:54 +0100
- Subject: alternate __cxa_demangle implementation
- References: <20021206212725.GA2242@alinoe.com> <20021206190513.5cd7fa23.bkoz@redhat.com> <20021210225141.GA30359@alinoe.com> <20021211111047.3b05ef8b.bkoz@redhat.com> <20021213141046.GA16644@alinoe.com> <20021213080757.1b214974.bkoz@redhat.com> <20021218225255.GA22064@alinoe.com> <20021218182113.6cf381f7.bkoz@redhat.com> <20030103005744.GA13577@alinoe.com> <20030102231733.49b292e7.bkoz@redhat.com>
On Thu, Jan 02, 2003 at 11:17:33PM -0600, Benjamin Kosnik wrote:
> Also, I get trailing bits in some demangled names when I run
> 'make check-abi':
>
> _ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8_
> demangled symbol
> std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)!
>
> Note the last '!'.
This is not a bug in my orignial code, it seems:
~/c++/demangler>dt _ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_S8_
std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
There is no '!' at the end.
> I'm unsure what to do with the debugging hooks, but leaving in
> references to libcwd is not going to work.
Removing the debugging hooks will make the code unmaintainable.
At least, it will become 10,000 harder to find bugs - and bugs
will (of course) be introduced after making changes. Thus...
unmaintainable. I urge you to find a way to keep the debug hooks
in.
> I'm not quite sure "session" really captures what is being attempted
> here. I would like a bit more time on this, I think.
A "session" is the state object for a new encoding, including pointers
into the input buffer (where are we with decoding?), lists of current
substitutions (also pointers into the input string) and the decoded
output-so-far. Encodings can recursively contain other encodings, the
old state needs to be kept on the stack in the meantime and not being
clobbered by the recursive call. I suppose you could rename 'session'
to 'encoding' and then capture a PART of the data members of the object,
but I certainly wouldn't rename the instance names of the session object,
because that would make the code less readable as a session object has
many 'decode' methods that work on the *current* input position and
have at that moment little to do with the full encoding that you started
with.
--
Carlo Wood <carlo@alinoe.com>