mstange / msvc-demangler-rust

A rust library that demangles / undecorates C++ symbols mangled by MSVC
Other
42 stars 13 forks source link

More unimplemented cases #68

Open mstange opened 2 years ago

mstange commented 2 years ago

Here's a list of non-demanglable symbols from this mozglue.pdb:

??_FUniqueJSONStrings@baseprofiler@mozilla@@QEAAXXZ
??_E?$basic_ofstream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
??_E?$basic_ostream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
??_EProfileBufferChunkManagerWithLocalLimit@mozilla@@W7EAAPEAXI@Z
??_EIFStream@mozilla@@$4PPPPPPPM@A@EAAPEAXI@Z
??_E?$basic_istream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
??_FDecimal@blink@@QEAAXXZ
??_E?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
??_FLZ4FrameDecompressionContext@Compression@mozilla@@QEAAXXZ
?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z
?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z
?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ
?_Xbad_function_call@std@@YAXXZ
?_Xlength_error@std@@YAXPEBD@Z
?_Xout_of_range@std@@YAXPEBD@Z
?classic@locale@std@@SAAEBV12@XZ
?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z
?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAAXXZ
?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAAXXZ
?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z
?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z
?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ
?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ
?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ
?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z
?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z

demangler.com supports all of these except for the ones starting with ??_E:

public: void __cdecl mozilla::baseprofiler::UniqueJSONStrings::`default constructor closure'(void) __ptr64
??_E?$basic_ofstream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
??_E?$basic_ostream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
[thunk]:public: virtual void * __ptr64 __cdecl mozilla::ProfileBufferChunkManagerWithLocalLimit::`vector deleting destructor'`adjustor{8}' (unsigned int) __ptr64
??_EIFStream@mozilla@@$4PPPPPPPM@A@EAAPEAXI@Z
??_E?$basic_istream@DU?$char_traits@D@std@@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
public: void __cdecl blink::Decimal::`default constructor closure'(void) __ptr64
??_E?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@$4PPPPPPPM@A@EAAPEAXI@Z
public: void __cdecl mozilla::Compression::LZ4FrameDecompressionContext::`default constructor closure'(void) __ptr64
struct _iobuf * __ptr64 __cdecl std::_Fiopen(char const * __ptr64,int,int)
struct _iobuf * __ptr64 __cdecl std::_Fiopen(wchar_t const * __ptr64,int,int)
private: static class std::locale::_Locimp * __ptr64 __cdecl std::locale::_Getgloballocale(void)
void __cdecl std::_Xbad_function_call(void)
void __cdecl std::_Xlength_error(char const * __ptr64)
void __cdecl std::_Xout_of_range(char const * __ptr64)
public: static class std::locale const & __ptr64 __cdecl std::locale::classic(void)
struct std::_Smanip<__int64> __cdecl std::setprecision(__int64)
public: virtual void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void) __ptr64
public: virtual void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void) __ptr64
protected: virtual void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::imbue(class std::locale const & __ptr64) __ptr64
protected: virtual class std::basic_streambuf<char,struct std::char_traits<char> > * __ptr64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::setbuf(char * __ptr64,__int64) __ptr64
protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::showmanyc(void) __ptr64
protected: virtual int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::sync(void) __ptr64
protected: virtual int __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::uflow(void) __ptr64
protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char * __ptr64,__int64) __ptr64
protected: virtual __int64 __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const * __ptr64,__int64) __ptr64
gabrielesvelto commented 10 months ago

FYI we're encountering more of those symbols starting with ?? in the wild. Looking at this crash lead me to this PDB file for a Microsoft library that seems to have several.

gabrielesvelto commented 10 months ago

I tried to feed ??A?$map@W4StatsType@TelemetryLoggerContextBase@@UCompositionStats@@U?$less@W4StatsType@TelemetryLoggerContextBase@@@std@@V?$allocator@U?$pair@$$CBW4StatsType@TelemetryLoggerContextBase@@UCompositionStats@@@std@@@5@@std@@QEAAAEAUCompositionStats@@$$QEAW4StatsType@TelemetryLoggerContextBase@@@Z to the last version of undname.exe and it spits this out: public: struct CompositionStats & __ptr64 __cdecl std::map<enum TelemetryLoggerContextBase::StatsType,struct CompositionStats,struct std::less<enum TelemetryLoggerContextBase::StatsType>,class std::allocator<struct std::pair<enum TelemetryLoggerContextBase::StatsType const ,struct CompositionStats> > >::operator[](enum TelemetryLoggerContextBase::StatsType && __ptr64) __ptr64

Trying it on ??_FUniqueJSONStrings@baseprofiler@mozilla@@QEAAXXZ yields public: void __cdecl mozilla::baseprofiler::UniqueJSONStrings::default constructor closure'(void) __ptr64`.

A bit of search yielded this:

A name fragment starting with ?? denotes a nested name. This is a name inside a local scope which must be exported. Its structure looks like the following: [...]

There's a bunch of details in that wiki page which I had never encountered before.