microsoft / microsoft-pdb

Information from Microsoft about the PDB format. We'll try to keep this up to date. Just trying to help the CLANG/LLVM community get onto Windows.
Other
1.85k stars 271 forks source link

Publish stuff for undecorating C++ symbols #17

Open jonwil opened 8 years ago

jonwil commented 8 years ago

I would like to see code (or docs) for undecorating C++ symbols made available.

The Visual C++ runtime library contains a function called unDName (or something like that, its referenced all over the CRT source code) but that function is undocumented and no official header for it is available (3rd party headers exist for it but they may not have the correct definitions). Also not everyone working with PDB files can link to the Visual C++ runtime library (even if undname was usable). The Visual Studio 2015 CRT source code includes an undname.cxx file but it is missing required header files (and cant be used anyway because of the license)

There is also a function UnDecorateSymbolName in dbghelp.dll but it doesn't support the full set of decorated names and not everyone working with pdb files is in a position to use dbghelp.dll or the UnDecorateSymbolName function.

There is a tool called undname.exe in the Windows SDK but that cant be redistributed and its a tool, not a library you can call so that isn't an option.

There are 3rd party implementations for undecorating symbols but those may not be complete or accurate.

There is also code claiming to be from Microsoft at this URL https://github.com/sundayliu/windbg/tree/master/langapi/undname but that doesn't have any license attached so we cant use it. Also we dont know how old that is or if it was even legitimately released by Microsoft (its quite possible this code came from one of the various source code thefts Microsoft has experienced in the past (e.g. Windows NT4 source or Windows 2000 source).

I would like to see usable complete source code for undecorating names published (under the same MIT license as the PDB code ideally) or if that is not possible, complete official header files required for using the undname function in Visual C++ libraries.

skochinsky commented 8 years ago

Wine has an implementation: http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/msvcrt/undname.c

jonwil commented 8 years ago

I already mentioned "3rd party implementations" above. My point is that no-one can be sure if the WINE implementation is 100% complete/accurate (including all the weird corner cases) and 100% up to date with the latest compiler bits Microsoft is shipping. (don't get me wrong, the WINE guys do some good work but just because someone else has already reverse engineered this stuff doesn't mean its not worthwhile for Microsoft to at least see how fesable it is to publish the official implementation)

tracernz commented 7 years ago

Yes please, this would be excellent.