读取移出页面的标头中的符号

内核调试器必须读取每个已加载模块映像的标头,以便知道哪些符号对应于该模块。

如果将模块的标头分页到磁盘,调试器将不会加载此模块的符号。 如果对调试过程至关重要的模块发生这种情况,则可能是一个关键问题。

以下过程可用于解决此问题。

获取分页的页眉的符号

  1. 创建内核本身的第二个副本。 将其放在网络共享上可能最容易。

  2. 将此共享的根目录追加到符号路径。 有关更改 符号路径 的方法,请参阅符号路径。

  3. 使用 .reload (重载模块) 命令。

  4. 使用 !sym 干扰扩展 命令查看更详细的输出。 如果使用此方法,你将能够看到哪些符号是从目标计算机上的模块映像加载的,以及哪些符号是从内核模块的副本加载的。

必须谨慎使用此方法,因为调试器无法验证文件副本是否与原始副本实际匹配。 因此,网络共享上使用的 Windows 版本与目标计算机上所用的版本匹配至关重要。

此方法仅用于内核模式调试。 操作系统能够在用户模式调试 (期间所需的任何标头中分页,除非存放分页文件的磁盘已卸载或) 无法访问。

下面是使用此方法的示例:

kd> .reload
Connected to Windows XP 2268 x86 compatible target, ptr64 FALSE
Loading Kernel Symbols
..........Unable to read image header for dmload.sys at fe0be000 - NTSTATUS 0xC0000001
..........Unable to read image header for dmboot.sys at fda93000 - NTSTATUS 0xC0000001
.....................................Unable to read image header for fdc.sys at fdfc2000 - NTSTATUS 0xC0000001
...Unable to read image header for flpydisk.sys at fde4a000 - NTSTATUS 0xC0000001
.Unable to read image header for Fs_Rec.SYS at fe0c8000 - NTSTATUS 0xC0000001
.Unable to read image header for Null.SYS at fe2c4000 - NTSTATUS 0xC0000001
...................Unable to read image header for win32k.sys at a0000000 - NTSTATUS 0xC0000001
..Unable to read image header for dxg.sys at a0194000 - NTSTATUS 0xC0000001
.......Unable to read image header for ati2draa.dll at a01a4000 - NTSTATUS 0xC0000001
..Unable to read image header for ParVdm.SYS at fe116000 - NTSTATUS 0xC0000001
.......
Loading unloaded module list
..............
Loading User Symbols
Unable to retrieve the PEB address. This is usually caused
by being in the wrong process context or by paging

请注意,许多图像具有不可访问的标头。 检查以下示例中 (其中一个文件中的符号,fs_rec.sys) :

kd> x fs_rec!*
*** ERROR: Module load completed but symbols could not be loaded for fs_rec.sys

这些标头显然是分页的。因此,需要将正确的图像添加到符号路径:

kd> .sympath+ \\myserver\myshare\symbols\x86fre\symbols
Symbol search path is: symsrv*symsrv.dll*c:\localcache*https://msdl.microsoft.com/download/symbols;\\myserver\myshare\symbols\x86fre\symbols

kd> .reload
Connected to Windows XP 2268 x86 compatible target, ptr64 FALSE
Loading Kernel Symbols
..........Unable to read image header for dmload.sys at fe0be000 - NTSTATUS 0xC0000001
..........Unable to read image header for dmboot.sys at fda93000 - NTSTATUS 0xC0000001
.....................................Unable to read image header for fdc.sys at fdfc2000 - NTSTATUS 0xC0000001
...Unable to read image header for flpydisk.sys at fde4a000 - NTSTATUS 0xC0000001
.Unable to read image header for Fs_Rec.SYS at fe0c8000 - NTSTATUS 0xC0000001
.Unable to read image header for Null.SYS at fe2c4000 - NTSTATUS 0xC0000001
...................Unable to read image header for win32k.sys at a0000000 - NTSTATUS 0xC0000001
..Unable to read image header for dxg.sys at a0194000 - NTSTATUS 0xC0000001
.......Unable to read image header for ati2draa.dll at a01a4000 - NTSTATUS 0xC0000001
..Unable to read image header for ParVdm.SYS at fe116000 - NTSTATUS 0xC0000001
.......
Loading unloaded module list
..............
Loading User Symbols
Unable to retrieve the PEB address. This is usually caused
by being in the wrong process context or by paging

出现相同的警告,但符号本身现在可以访问:

kd> x fs_Rec!*
fe0c8358  Fs_Rec!_imp___allmul
fe0c8310  Fs_Rec!_imp__IoCreateDevice
fe0c835c  Fs_Rec!_imp___allshr
........
fe0c8360  Fs_Rec!ntoskrnl_NULL_THUNK_DATA
fe0c832c  Fs_Rec!_imp__KeSetEvent
fe0c9570  Fs_Rec!_NULL_IMPORT_DESCRIPTOR