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.
Post Reply
Devteam
Posts: 115
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Loading mismtached PDBs and DLLs in Visual Studio

Post by Devteam » 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 https://docs.microsoft.com/en-us/window ... gger/index. 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: http://www.debuginfo.com/tools/chkmatch.html. 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

Post Reply