rainers / cv2pdb

converter of DMD CodeView/DWARF debug information to PDB files
Artistic License 2.0
466 stars 110 forks source link

Support VS 2019 #57

Closed dscho closed 4 years ago

dscho commented 4 years ago

The location of the mspdb140.dll file is not that easy to obtain, and there are even multiple ones. Let's try to use vswhere.exe and a directory enumeration to figure out the location of the newest DLL.

rainers commented 4 years ago

cv2pdb works with VS2019 for me. Are you using a 32-bit or 64-bit build of cv2pdb?

vswhere does the same as tryLoadMsPdbCom, so maybe a different path inside the VS installation has to be added there?

dscho commented 4 years ago

cv2pdb works with VS2019 for me. Are you using a 32-bit or 64-bit build of cv2pdb?

I am using a 64-bit build.

vswhere does the same as tryLoadMsPdbCom, so maybe a different path inside the VS installation has to be added there?

Right, and as you probably suspected, the path <installDir>\\Common7\\IDE\\mspdb140.dll refers to the i686 version.

I reworked my patch to avoid spawning vswhere.exe and instead piggy-back on top of the tryLoadMsPdbCom() function. In my tests, the new test finds the DLL as well as my previous patch.

rainers commented 4 years ago

Oops, I just noticed that it works for me because I had some similar local changes that were never committed. I pushed them now. Sorry for the trouble. I see you are looking for the most recent DLL, is that necessary?

dscho commented 4 years ago

I see you are looking for the most recent DLL, is that necessary?

In my setup, yes:

$ find "$(../../../msbuild/vswhere.exe -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath)" -name mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/Common7/IDE/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.16.27023/bin/HostX64/x64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.16.27023/bin/HostX86/x86/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.20.27508/bin/HostX64/x64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.20.27508/bin/HostX86/x86/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx64/arm/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx64/arm64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x86/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx86/arm/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx86/arm64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx86/x64/mspdbcore.dll
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise/VC/Tools/MSVC/14.24.28314/bin/Hostx86/x86/mspdbcore.dll
rainers commented 4 years ago

In my setup, yes:

I guess it doesn't really matter which one of these is actually used (if the architecture matches). The usual installation doesn't keep older versions, but replaces them.

dscho commented 4 years ago

Fair enough.