Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Debugging 使用Windbg进入MFC源代码_Debugging_Mfc_Windbg - Fatal编程技术网

Debugging 使用Windbg进入MFC源代码

Debugging 使用Windbg进入MFC源代码,debugging,mfc,windbg,Debugging,Mfc,Windbg,我需要在Windbg中设置哪些设置才能像使用Visual Studio一样进入/通过MFC源代码?进入MFC源代码需要两件事:加载正确的MFC符号和设置正确的源路径 MFC符号 在Windbg中设置符号路径的常见建议是使用.symfix,这会将公共Microsoft符号服务器添加到符号路径中。这将允许Windbg从Microsoft下载适用于许多Windows DLL(包括MFC DLL)的PDB。但是,这些PDB不包括源单步执行所需的专用符号 相反,您需要告诉Windbg首先查找随Visual

我需要在Windbg中设置哪些设置才能像使用Visual Studio一样进入/通过MFC源代码?

进入MFC源代码需要两件事:加载正确的MFC符号和设置正确的源路径

MFC符号 在Windbg中设置符号路径的常见建议是使用
.symfix
,这会将公共Microsoft符号服务器添加到符号路径中。这将允许Windbg从Microsoft下载适用于许多Windows DLL(包括MFC DLL)的PDB。但是,这些PDB不包括源单步执行所需的专用符号

相反,您需要告诉Windbg首先查找随Visual Studio安装的专用符号PDB,然后查找符号服务器:

.sympath c:\windows\symbols\dll
.symfix+ c:\symbols
或者,如果要复制并粘贴到文件>符号文件路径…对话框中,请使用以下命令:

c:\windows\symbols\dll;srv*c:\symbols*http://msdl.microsoft.com/download/symbols
提供给
.symfix+
c:\symbols
路径告诉Windbg在哪里存储从服务器下载的任何PDB的缓存副本

通过使用Windbg(
Windbg app.exe
)启动MFC应用程序,强制加载MFC符号,并检查输出(这是Windbg命令会话的日志),可以检查是否找到了正确的PDB:

注意:mfc100d行包含专用pdb符号。如果最后一个命令显示
mfc100d(pdb符号)
,但没有单词private,则无法加载正确的pdb,并且无法进入MFC源。再看看你的同情心。您也可以尝试打开
!sym noised
并运行
.reload/f mfcdllpath
命令以查看有关尝试加载PDB的更多诊断信息

MFC源路径 如果已完成默认Visual Studio安装,则MFC(和C-runtime)源将位于:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src
VS2010。过去的版本具有类似的目录布局。您可以通过以下方式进行设置:

.sympath C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src;
或者将上述行(不带
.sympath
)复制并粘贴到文件>源文件路径…对话框中

如果这些目录不存在,您可以查看VisualStudio认为MFC源代码在哪里

VS2010(可能还有2012年):

  • 启动Visual Studio
  • 打开一个项目
  • 在“项目”菜单中,选择“属性”
  • 在左窗格中,展开配置属性并选择VC++目录
  • 在右侧窗格中,查看源目录的值
VS2008及更早版本

  • 启动Visual Studio
  • 在“工具”菜单中,选择“选项”
  • 在左窗格中,展开项目和解决方案并选择VC++目录
  • 在右侧窗格中,查看源目录的值
.sympath C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfcm;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src;