lucasg / Dependencies

A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.
MIT License
9.07k stars 743 forks source link

Move parameters are not being unmangled #32

Closed hmartinez82 closed 6 years ago

hmartinez82 commented 6 years ago

Functions and methods with && as the parameter modifier are not being unmangled

lucasg commented 6 years ago

I rely on demumble and dbghelp.dll's UnDecorateSymbolName to demangle decorated symbols. Unfortunately demumble is not maintained anymore and UnDecorateSymbolName only unmangle MSVC names.

I'm currently trying to incoporate LLVM's demangler, but it keeps crashing on pretty sane inputs.

lucasg commented 6 years ago

I've integrated llvm's MicrosoftDemangler in Dependencies, can you tell me if that's solve the issue ? https://ci.appveyor.com/api/buildjobs/vdvsksuje713kxkx/artifacts/output%2FDependencies_x64_Debug.zip

hmartinez82 commented 6 years ago

@lucasg nope, tried that one, it's still not demangling rvalue references. These three are showing in the attached DependenciesGui you posted above:

private: __cdecl QJsonArray::QJsonArray(class QJsonPrivate::Data * __ptr64,class QJsonPrivate::Array * __ptr64) __ptr64
??0QJsonArray@@QEAA@$$QEAV0@@Z
public: __cdecl QJsonArray::QJsonArray(class QJsonArray const & __ptr64) __ptr64

The middle one should be

public: __cdecl QJsonArray::QJsonArray(class QJsonArray && __ptr64) __ptr64

which I checked with undname ??0QJsonArray@@QEAA@$$QEAV0@@Z

hmartinez82 commented 6 years ago

I wonder what 'undname' that comes with Visual Studio uses

lucasg commented 6 years ago

It rely on vcruntime's UndNameEx which is not documented, but probably more up to date than dbghelp's UndecorateSymbol. Anyway I found LLVM demangler pretty satisfying for this task, I push an update later this week.

hmartinez82 commented 6 years ago

@lucasg so you got it working wit the new demangler?

lucasg commented 6 years ago

Yep, it should work now. There still a cosmetic issue : llvm demangler does not undecorate exactly the same way Microsoft's does so it may looks weird side-by-side, but that's pretty harmless. You can test it : https://ci.appveyor.com/api/buildjobs/ejg576s7vvbeqg0p/artifacts/output%2FDependencies_x64_Debug.zip

Alternatively, you can test directly the demangler using demangler-test.exe in the zipped folder. The command line is currently horrendous, but here the usage :

& .\demangler-test.exe [-DEMANGLER] MANGLING-NAME | FILE

Possible names for the DEMANGLER option:

E.g. :

& .\demangler-test.exe -Default '"??0QJsonArray@@QEAA@$$QEAV0@@Z"'
__cdecl QJsonArray::QJsonArray(class QJsonArray &&)
nico commented 5 years ago

(fwiw demumble is maintained, it's just working pretty well and changing rarely. I just pushed a change to make it demangle rvalue refs etc; looks like you went with the same approach I went with by now.)