SOS是一个调试器扩展,用于调试.NET应用程序。它提供了一组非常丰富的命令,这些命令使开发人员可以对CLR进行深入分析,并且有助于找出应用程序中各种复杂错误的原因。
我的一台Win2008R2(64位)安装了VS2012和windbg32位版。
用VC2012编了个简单的32位控制台程序ConsoleApplication1,并创建C:\MyLocalSymbols目录,然后启动windbg:
(1)设置File-->Symbol file path填入:
C:\MyLocalSymbols;SRV*C:\MyLocalSymbols*http://msdl.microsoft.com/download/symbols
(2)File-->Open executable打开ConsoleApplication1,
进入Windbg的窗口:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine:
"C:\Users\Administrator\Documents\Visual Studio 2012\Projects\ConsoleApplication1\Debug\ConsoleApplication1.exe"
Symbol search path is: C:\MyLocalSymbols;SRV*C:\MyLocalSymbols*http:
//msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00200000 00228000 ConsoleApplication1.exe
ModLoad: 77c40000 77dc0000 ntdll.dll
ModLoad: 75f90000 760a0000 C:\Windows\syswow64\kernel32.dll
ModLoad: 76160000 761a6000 C:\Windows\syswow64\KERNELBASE.dll
ModLoad: 0f660000 0f72b000 C:\Windows\SysWOW64\MSVCP110D.dll
ModLoad: 0f150000 0f2f1000 C:\Windows\SysWOW64\MSVCR110D.dll
(1e20.1e0c): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00000000 ecx=cc7e0000 edx=002ae018 esi=fffffffe edi=00000000
eip=77ce0f3b esp=003af90c ebp=003af938 iopl=0 nv up ei pl zr na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246
*** ERROR: Symbol file could not be found. Defaulted to export symbols
for
ntdll.dll -
ntdll!LdrVerifyImageMatchesChecksum+0x96c:
77ce0f3b cc
int
3
0:000> .sympath
Symbol search path is: C:\MyLocalSymbols;SRV*C:\MyLocalSymbols*http:
//msdl.microsoft.com/download/symbols
Expanded Symbol search path is: c:\mylocalsymbols;srv*c:\mylocalsymbols*http:
//msdl.microsoft.com/download/symbols
|
明明用.sympath已经看到我正确设置了符号文件路径,而且C盘下面的MyLocalSymbols里面也有了不少东西,如下图所示: