locked
Why some symbols can't be demangled ? RRS feed

  • Question

  • In a program, I use DIA SDK to find a C++ symbol's name, and use
    UnDecorateSymbolName to demangle the name if necessary. It works.

    Today I found that some symbols can't be demangled, for example:

    ??$Start@$$$V@FmsInitializeEnumerator@FMSTraceLoggingTelemetry@@SA?AV01@XZ
    ??$ExceptionBoundary@V<lambda_5355c1995a44913d2a2ef79e344f4d43>@@@@YAJ$$QEAV<lambda_5355c1995a44913d2a2ef79e344f4d43>@@@Z
    ??$ExceptionBoundary@V<lambda_6c89d8280c26f993e42c3e31163b130b>@@@@YAJ$$QEAV<lambda_6c89d8280c26f993e42c3e31163b130b>@@@Z
    ??$ExceptionBoundary@V<lambda_cec4728b5ade3e7fd81f39fc4747bc4c>@@@@YAJ$$QEAV<lambda_cec4728b5ade3e7fd81f39fc4747bc4c>@@@Z
    ??0?$set@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@U?$less@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@@std@@QEAA@$$QEAV01@@Z
    ??$ExceptionBoundary@V<lambda_d12834b9ae34333ffd9a79b6fe40a7e1>@@@@YAJ$$QEAV<lambda_d12834b9ae34333ffd9a79b6fe40a7e1>@@@Z


    So how to deal with these ?


    Aman

    Monday, November 23, 2015 4:30 PM

Answers

  • The dbghelp.dll you are using is probably too old to understand newer C++ features. For example, the giant

    ??0?$set@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@U?$less@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@@std@@QEAA@$$QEAV01@@Z

    is

    public: __cdecl std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >(class std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > && __ptr64) __ptr64

    which contains an r-value reference.

    DIA's IDiaSymbol has get_undecoratedName, have you tried using that instead of UnDecorateSymbolName? Of course, you'd need to use the latest DIA SDK to be sure that all symbols that you may encounter can be undecorated.

    • Marked as answer by Aman JIANG Tuesday, November 24, 2015 2:38 AM
    Monday, November 23, 2015 6:36 PM

All replies

  • Those look like lamba expressions. Are you trying to export a lambda? You shouldn't be doing that, because that ties you to a particular compiler and compiler settings.

    Monday, November 23, 2015 4:53 PM
  • The dbghelp.dll you are using is probably too old to understand newer C++ features. For example, the giant

    ??0?$set@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@U?$less@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@@std@@QEAA@$$QEAV01@@Z

    is

    public: __cdecl std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >(class std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > && __ptr64) __ptr64

    which contains an r-value reference.

    DIA's IDiaSymbol has get_undecoratedName, have you tried using that instead of UnDecorateSymbolName? Of course, you'd need to use the latest DIA SDK to be sure that all symbols that you may encounter can be undecorated.

    • Marked as answer by Aman JIANG Tuesday, November 24, 2015 2:38 AM
    Monday, November 23, 2015 6:36 PM
  • Try the “undname.exe” tool, which is included in Visual Studio. Use quotation marks if argument contains “<” or “>”.

    Example:

    undname.exe "??0?$set@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@U?$less@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@V?$allocator@V?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@2@@std@@QEAA@$$QEAV01@@Z"

    Result:

    public: __cdecl std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > >(class std::set<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> >,struct std::less<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > >,class std::allocator<class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > > > && __ptr64) __ptr64

     

    Monday, November 23, 2015 6:41 PM
  • No, I'm not, I don't even know how to export a lambda...

    These symbols are came from some Windows DLLs.


    Aman

    Tuesday, November 24, 2015 2:42 AM