Debugging MFC: “mfc100.dll” cannot find or open pdb

情到浓时终转凉″ 提交于 2019-12-10 21:06:19

问题


I'm trying to step into MFC source code while debugging. However, Visual Studio apparently has problems with loading the appropriate symbols:

C:\WINDOWS\symbols\dll\mfc100.i386.pdb: PDB does not match image.

I checked other questions on SO, often it is recommended to enable "symbol servers". This is not helping though, because it only seems to download a minimal PDB file (~2 MB) instead of a PDB file that actually enables you to step into the source (~20 MB).

According to Cannot load symbols for mfc100.dll I should download a full symbol package from http://msdn.microsoft.com/en-us/windows/hardware/gg463028. I did that, but it doesn't help either because this package does not actually include symbols for mfc100.dll at all.

Next thing I tried is copying PDB files from another system. On my local Win7 OS I have a mfc100.i386.pdb from 2011-06-10 (24.708 KB). On the system I debug I have mfc100.i386.pdb from 2010-03-18 (23.732 KB). Both do "not match image" though.

So where should I get the correct and full symbol files from?

OS: Windows 8 x86. Visual Studio 2013 with VS 2010 C++ project. mfc100.dll version: 10.00.40219.01

WinDbg !sym noisy output:

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
OK                                             C:\Windows\symbols\dll
DBGHELP: Symbol Search Path: c:\windows\symbols\dll
DBGHELP: Symbol Search Path: c:\windows\symbols\dll
0:000> .reload
Reloading current modules

DBGHELP: c:\windows\symbols\dll\mfc100.i386.pdb - mismatched pdb
DBGHELP: c:\windows\symbols\dll\dll\mfc100.i386.pdb - file not found
DBGHELP: c:\windows\symbols\dll\symbols\dll\mfc100.i386.pdb - file not found
DBGHELP: C:\WINDOWS\SYSTEM32\mfc100.i386.pdb - file not found
DBGHELP: mfc100.i386.pdb - file not found
DBGHELP: Couldn't load mismatched pdb for C:\WINDOWS\SYSTEM32\mfc100.dll
*** ERROR: Module load completed but symbols could not be loaded for C:\WINDOWS\SYSTEM32\mfc100.dll
DBGHELP: mfc100 - no symbols loaded

************* Symbol Loading Error Summary **************
Module name            Error
mfc100                 PDB not found : c:\windows\symbols\dll\symbols\dll\mfc100.i386.pdb
                Unable to locate the .pdb file in this location

回答1:


As explained in this MSDN post (by Crescens2k) -

Those symbols should be matched to the version that VS uses, so they can get out of sync if you install a version of the VC redist which is newer than what VS is currently using. Check the version of the CRT in VC directory where VS2010 is installed. There should be a redist directory in there and under that is the CRT. Check the version of these files and see if they have the same version as the ones in your system32 directory. These normally should match. If they don't then check for updates for VS. The latest version should be 10.0.40219.325 so make sure that VS has been updated to use that.

And later -

...try manually applying the MFC security update. ... and seeing if that fixes everything.

Happily, with WinDbg tool you could locate your problem to mismatched symbols, and an advice from experienced programmer (Crescens2k) helped to solve the painfully ugly problem of versions mismatch from "DLL hell".



来源:https://stackoverflow.com/questions/23008222/debugging-mfc-mfc100-dll-cannot-find-or-open-pdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!