2011-08-04 31 views
4

我想用WinDbg调试我的.NET应用程序和C++非托管内存分配。WinDbg!堆命令由于缺少符号而不工作

当我尝试运行命令,我收到以下错误信息:

0:022> !heap 
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\system32\KERNEL32.dll - 
************************************************************************* 
***                 *** 
***                 *** 
*** Your debugger is not using the correct symbols     *** 
***                 *** 
*** In order for this command to work properly, your symbol path *** 
*** must point to .pdb files that have full type information.  *** 
***                 *** 
*** Certain .pdb files (such as the public OS symbols) do not  *** 
*** contain the required information. Contact the group that  *** 
*** provided you with these symbols if you need this command to *** 
*** work.               *** 
***                 *** 
*** Type referenced: ntdll!_HEAP_ENTRY        *** 
***                 *** 
************************************************************************* 
Invalid type information 

我怎样才能解决这个问题?

回答

3

配置符号服务器。请按照下列步骤操作:

  1. 为下载的符号创建本地目录。我将使用“C:\ Symbols”。
  2. 从“文件”菜单中选择“符号文件路径...”。
  3. 输入“SRV * C:\ Symbols * http://msdl.microsoft.com/download/symbols”,然后按“确定”。
  4. 再试一次。最初在下载符号时会有延迟。将来会使用本地副本(步骤1)。

请参阅here了解更多详情。

5

使用以下命令来修复您的符号路径:

.symfix 
.reload 
1

您需要设置符号为您的应用程序,也有它指向Windows符号服务器。对于windows符号服务器,你可以做Steve所说的。

“SRV * C:\ *符号的http://msdl.microsoft.com/download/symbols”!

之后,设置SYM嘈杂的,这将做符号加载的详细模式。

做.reload,这让你知道哪些符号是需要的但没有找到。

如果您已经知道您的应用程序的pdbs的位置,请使符号路径指向该位置,然后重复上述步骤以确保所有需要的符号都已被使用。

+1

!heap命令不起作用的问题在于调试器需要Windows本身的符号,而不是应用程序。在这种情况下,ntdll.dll的符号。 – Steve