gimli-rs / cpp_demangle

A crate for demangling C++ symbols
Apache License 2.0
298 stars 36 forks source link

Failed demangling for some ApplyGCThingTyped symbols in libxul #203

Open mstange opened 4 years ago

mstange commented 4 years ago

cppfilt is unable to demangle these names:

__ZN2js17ApplyGCThingTypedIZNS_8GCMarker12traverseEdgeIPNS_5ShapeEN2JS11PropertyKeyEEEvT_RKT0_EUlTyS7_E_EEbRKS6_OS7_`
__ZZN2js8GCMarker12traverseEdgeIPNS_5ShapeEN2JS11PropertyKeyEEEvT_RKT0_ENKUlTyS6_E_clIP8JSStringEEDaS6_

c++filt demangles them to the following:

bool js::ApplyGCThingTyped<void js::GCMarker::traverseEdge<js::Shape*, JS::PropertyKey>(js::Shape*, JS::PropertyKey const&)::'lambda'<typename $T>(js::Shape*)>(JS::PropertyKey const&, js::Shape*&&)
auto void js::GCMarker::traverseEdge<js::Shape*, JS::PropertyKey>(js::Shape*, JS::PropertyKey const&)::'lambda'<typename $T>(js::Shape*)::operator()<JSString*>(js::Shape*) const
khuey commented 4 years ago

Those symbols don't demangle for me with the latest binutils cxxfilt.

Saldivarcher commented 4 years ago

Only llvm-cxxfilt has implemented the new c++20 lambda expressions: https://reviews.llvm.org/rL371273

mstange commented 4 years ago

My c++filt came with macOS 10.15, "GNU c++filt 070207 20070207".

The symbols are produced by the macOS compiler builds installed by mach bootstrap, clang++ --version says clang version 9.0.1.

Saldivarcher commented 4 years ago

@mstange that version of c++filt is a fork from apple that is from around ~2005. It internally calls __cxa_demangle which on an apple machine uses llvm's libc++ rather than gcc's libstdc++, so that's why the apple version of c++filt demangles that mangled name.