由于缺少符号,WinDbg !heap命令无法工作

WinDbg !heap command not working due to missing symbols

本文关键字:命令 工作 heap 于缺少 符号 WinDbg      更新时间:2023-10-16

我正在尝试使用WinDbg调试我的。net应用程序与c++非托管内存分配。

当我试图运行!堆命令,我得到以下错误消息:

0:022> !heap
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:Windowssystem32KERNEL32.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

如何修复这个错误?

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

.symfix
.reload

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

  1. 为下载的符号创建一个本地目录。我将使用"C:Symbols"。
  2. 在"文件"菜单中选择"符号文件路径…"。
  3. 输入"SRV*C:Symbols*http://msdl.microsoft.com/download/symbols"并按"OK"。
  4. 再试一次。最初,在下载符号的过程中会有一些延迟。以后将使用本地副本(步骤1)。

您需要为您的应用程序设置符号,并使其指向windows符号服务器。对于windows符号服务器,你可以按Steve说的做。

" SRV * C: 符号* http://msdl.microsoft.com/download/symbols"

之后,设置!sym noisy,这将在详细模式下加载符号。

执行。reload,这样可以让你知道哪些符号是需要的,但没有找到。

如果你已经知道你的应用程序的pdbs的位置,使符号路径指向该位置,并重复上述步骤,以确保所有必需的符号都已加载