Loading mismtached PDBs and DLLs in Visual Studio

Amyuni's Development Team would like to share with fellow developers general information about Windows and Web development. These are issues encountered by Amyuni's team and were either solved or pending solution.

Loading mismtached PDBs and DLLs in Visual Studio

Postby Devteam on Fri Aug 25 2017

When investigating crashes in a DLL or executable that was built in release mode, the symbol file (.PDB) for the DLL or exe is needed. The symbol file has to match exactly the executable and has to be built at the same time as the executable. Sometimes we run into situations where the PDB is not available and has to be rebuilt from the source-code. Even when the source code is exactly the one that was used to generate the executable, Visual Studio cannot match the new PDBs with the DLLs that were previously built. The frustrating error "Cannot find matching symbol files" always pops up no matter how hard you try.

There are 2 solutions to this situation:

Solution 1) Use the alternative Microsoft debugger : WinDdg.exe available from [url]https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/index[/url]. The user interface might not be very fancy, but this is actually is very powerful debugger. You still need to tweak Windbg to force it into loading the mismatched PDBs by calling : .symopt +0x40. The value 40 corresponds to SYMOPT_LOAD_ANYTHING

Solution 2) Fix the PDBs. Assuming they were indeed generated from exactly the same codebase with the same compiler, there is a very handy chkmatch tool that will fix the PDBs for you. Chkmatch is available from: [url]http://www.debuginfo.com/tools/chkmatch.html[/url]. chkmatch -m exefile pdbfile will attempt to fix the PDB without touching the executable.

Have fun with your debugging!
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - http://www.amyuni.com
Devteam
 
Posts: 115
Joined: Fri Oct 14 2005
Location: Montreal

Return to Useful Hints / Windows & Web Programming

Who is online

Users browsing this forum: No registered users and 1 guest