[Bug 222563] libcxxrt abi::__cxa_demangle() does not successfully demangle names
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sun Sep 24 17:20:00 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222563
Bug ID: 222563
Summary: libcxxrt abi::__cxa_demangle() does not successfully
demangle names
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: ian at FreeBSD.org
Created attachment 186671
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=186671&action=edit
Small c++ program to demonstrate the problem
The attached small c++ program should print the demangled names of a couple
symbols when it runs, but it does not:
# make tester && ./tester
c++ -O -pipe tester.cc -o tester
name '3Foo' = '3Foo' status=-2
name 'Z4mainE3Bar' = '(null)' status=-2
The current demangling code in libcxxrt is a snapshot of the libelftc demangler
from 10-ish years ago. If you replace it with the current libelftc demangling
code and make some other small changes you can get abi::__cxa_demangle() to the
point where it returns the same slightly-less-wrong results as c++filt (see PR
222562).
Part of the problem with abi::__cxa_demangle() is that it is not correctly
glued to the libelftc demangling code. The demangler wants to see a prefix on
the symbol name, like what you see in nm(1) output. That is,
typeid(bar).name() returns "Z4mainE3Bar" and the demangle code expects
"_ZTSZ4mainE3Bar". (This is the small change I referred to above.)
One potential fix for this would be to examine llvm's libcxxabi and possibly
import its demangler (or maybe the entire library). I gather this libcxxabi
didn't exist when we created/imported libcxxrt.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list