Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jun 2014 22:44:36 -0400
From:      Ed Maste <emaste@freebsd.org>
To:        Ryan Stone <rysto32@gmail.com>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: abi::__cxa_demangle provides invalid result on non-mangled symbols
Message-ID:  <CAPyFy2Buh4BUEuYW5nfQFdEMio9=yaDAkivg1zXPnEBzr_CzJQ@mail.gmail.com>
In-Reply-To: <CAFMmRNw_9hS3YuDbjFJH0btvoPADJ7_4=L13z2sK71gctPzXhQ@mail.gmail.com>
References:  <CAFMmRNw_9hS3YuDbjFJH0btvoPADJ7_4=L13z2sK71gctPzXhQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9 June 2014 21:48, Ryan Stone <rysto32@gmail.com> wrote:
> abi::__cxa_demangle is giving me an invalid result if I pass it a
> symbol that is not mangled.  This is causing me problems as in my
> application, I'm getting symbol names from libelf and have no way of
> know a priori whether a symbol is mangled or not.

I had the same issue in LLVM, and as hacky as it seems, the solution
is to check that the name starts with "_Z" before passing it to
__cxa_demangle.

For reference the LLVM review for the change is here:
http://reviews.llvm.org/D2552

I didn't get around to testing it on Linux; since you have a test
application ready it would be interesting to see the result of
__cxa_demangle("f") there.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2Buh4BUEuYW5nfQFdEMio9=yaDAkivg1zXPnEBzr_CzJQ>