五、开始使用WinDbg 现在我们有了dump file来进行调试,在Windbg程序的file菜单下,选择“File / Open Crash Dump”来打开我们的dump 文件,然后你可以看到类似如下的信息
Microsoft (R) Windows Debugger Version 6.11.0001.404 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
Loading Dump File [D:\debug\w3wp.DMP]
User Mini Dump File with Full Memory: Only application data is available
Symbol search path is: srv*D:\Debug\Symbols*http://msdl.microsoft.com/download/symbols
Executable search path is:
Windows 7 Version 7600 MP (4 procs) Free x64
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Debug session time: Sat Nov 12 22:18:52.000 2011 (GMT+11)
System Uptime: 1 days 19:01:34.239
Process Uptime: 0 days 19:34:52.000
Loading unloaded module list
ntdll!ZwWaitForSingleObject+0xa:
00000000`77c1f6fa c3 ret 在上述信息中,你可以找到你的dump file的存放路径以及你的symbol search path。在Windbg的最下面是命令窗口,也是我们的主要操作接口。
.load d:\debug\psscor2\amd64\psscor2.dll 由于我的生产机是64-bit Intel,它所创建的dump是64bit的,所以在此处,我就加载了 AMD64 version 的 PssCor2.dll。如果你是调试基于x86的进程,那么你就需要加载 x86 version 的PssCor2.dll. 为了验证PssCor2.dll成功加载,你可以输入下面的命令
!help
输入结果如下:
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
* *
* The Symbol Path can be set by: *
* using the _NT_SYMBOL_PATH environment variable. *
* using the -y <symbol_path> argument when starting the debugger. *
* using .sympath and .sympath+ *
*********************************************************************
PDB symbol for mscorwks.dll not loaded
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
2) the file mscordacwks.dll that matches your version of mscorwks.dll is
in the version directory
3) or, if you are debugging a dump file, verify that the file
mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
4) you are debugging on the same architecture as the dump file.
For example, an IA64 dump file must be debugged on an IA64
machine.
You can also run the debugger command .cordll to control the debugger's
load of mscordacwks.dll. .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.
If you are debugging a minidump, you need to make sure that your executable
path is pointing to mscorwks.dll as well. 用.cordll看一看,feedback如下: