This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [patchv2] Fix corruption of non-C++ symbols by the demangler
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 15 Jan 2014 17:39:09 +0100
- Subject: Re: [patchv2] Fix corruption of non-C++ symbols by the demangler
On Wed, 2014-01-15 at 14:09 +0100, Jan Kratochvil wrote:
> On Tue, 14 Jan 2014 11:22:41 +0100, Mark Wielaard wrote:
> > On Tue, 2014-01-14 at 10:07 +0100, Jan Kratochvil wrote:
> > > On Tue, 14 Jan 2014 10:00:59 +0100, Mark Wielaard wrote:
> > > > The __GLOBAL__.[ID]_xxx functions are wrappers generated when a module
> > > > xxx contains constructors and destructors of static objects, which will
> > > > call the actual static initialization and destruction functions for all
> > > > globals in the module. Since they are "normal" functions they could
> > > > potentially end up in a backtrace, but I am not sure "demangling" them
> > > > provides any real benefit.
> > >
> > > In such case I will add it, it should be there.
> >
> > It probably doesn't hurt, but it also isn't a real/proper mangling
> > scheme. Just an g++ convention. It "demangles" to 'global constructors
> > keyed to xxx'. According to the documentation the only prefix you should
> > check for is _Z:
> > http://mentorembedded.github.io/cxx-abi/abi.html#demangler
>
> elfutils already implements various non-upstream-standard extensions, like
> .gnu_debugdata for all so I do not find it a relevant argument here.
> So probably another disagreement if you did not agree with it by "doesn't
> hurt", not sure. It is not in the patch below.
I just meant I wouldn't bother since it seems it is a somewhat fringe
corner case with an internal gcc detail that gets translated/demangled
into something that IMHO isn't that interesting to begin with. I am not
opposed to do more than just simple demangling. But maybe we should add
a helper function for it somewhere in that case since there are various
places where we would use it.
> src/
> 2014-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix corruption of non-C++ symbols by the demangler.
> * nm.c (show_symbols_sysv, show_symbols_bsd, show_symbols_posix)
> (show_symbols): Check for _Z.
> * stack.c (print_frames) <USE_DEMANGLE>: Check for _Z.
>
> tests/
> 2014-01-13 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> Fix corruption of non-C++ symbols by the demangler.
> * Makefile.am (TESTS): Add run-backtrace-demangle.sh.
> <!DEMANGLE>: Add ELFUTILS_DISABLE_DEMANGLE export.
> (EXTRA_DIST): Add run-backtrace-demangle.sh,
> testfile-backtrace-demangle.bz2, testfile-backtrace-demangle.cc,
> testfile-backtrace-demangle.core.bz2.
> * backtrace-demangle.cc: New file.
> * run-backtrace-demangle.sh: New file.
> * testfile-backtrace-demangle.bz2: New file.
> * testfile-backtrace-demangle.cc: New file.
> * testfile-backtrace-demangle.core.bz2: New file.
Looks good.
Thanks,
Mark