我已经从7.1 Windows SDK安装了WinDBG。然后在VC++ 2008中,我创建了一个程序'CleanPayload.exe',它只包含一个'main'和一个对故意包含缺陷的函数的调用。它是一个包含调试符号的发行版本。我打开该程序进入WindDBG然后使用WinDBG识别有缺陷的功能
- 做了
.sympath+
以指示PDB是该程序。 - 做了
ld *
加载所有符号 - 做了
lm
验证所有符号加载(我的程序,适用于Windows图书馆公共符号专用符号)。
然后我跑了程序,它抛出了第一次机会的例外,这是相当期待的。具体如下:
(910.12a0): WOW64 breakpoint - code 4000001f (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll32!LdrpDoDebuggerBreak+0x2c:
771e0f2b cc int 3
但是当我问WinDBG中给我的堆栈,它不显示我的节目“CleanPayload.exe”的东西。相反,它表明我:
0:000:x86> kb
ChildEBP RetAddr Args to Child
004bf5ec 771c122b 7efdd000 7efde000 7724206c ntdll32!LdrpDoDebuggerBreak+0x2c
004bf764 77192187 004bf7d8 77140000 7c185e6a ntdll32!LdrpInitializeProcess+0x132f
004bf7b4 77179e89 004bf7d8 77140000 00000000 ntdll32!_LdrpInitialize+0x78
004bf7c4 00000000 004bf7d8 77140000 00000000 ntdll32!LdrInitializeThunk+0x10
什么我必须这样做,它会告诉我一个堆栈跟踪其中(1)包括我的程序和(2)的功能,在异常被抛出?
更新我跟着拉里的建议,过去的第一个异常运行,并得到了以下结果:
0:000:x86> g
ntdll!NtTerminateProcess+0xa:
00000000`76faf97a c3 ret
0:000> kb
RetAddr : Args to Child : Call Site
00000000`74c6601a : 00000000`00000000 00000000`000de600 00000000`000ddc80 00000000`74c60304 : ntdll!NtTerminateProcess+0xa
00000000`74c5cf87 : 00000000`0030f988 00000000`0030dba8 00000000`7efdb000 00000000`0030f934 : wow64!whNtTerminateProcess+0x46
00000000`74be276d : 00000000`77150190 00000000`74c50023 00000000`00000000 00000000`0030fab8 : wow64!Wow64SystemServiceEx+0xd7
00000000`74c5d07e : 00000000`00000000 00000000`74be1920 00000000`000de820 00000000`76f93501 : wow64cpu!TurboDispatchJumpAddressEnd+0x24
00000000`74c5c549 : 00000000`00000000 00000000`00000000 00000000`74c54ac8 00000000`7ffe0030 : wow64!RunCpuSimulation+0xa
00000000`76faae27 : 00000000`004a3100 00000000`00000000 00000000`7707a1e0 00000000`7efdf000 : wow64!Wow64LdrpInitialize+0x429
00000000`76fa72f8 : 00000000`00000000 00000000`76fa8641 00000000`76fb84e0 00000000`00000000 : ntdll!LdrpInitializeProcess+0x1780
00000000`76f92ace : 00000000`000df1b0 00000000`00000000 00000000`7efdf000 00000000`00000000 : ntdll! ?? ::FNODOBFM::`string'+0x2af20
00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!LdrInitializeThunk+0xe
因此,不幸的是,我还没有看到相关的堆栈跟踪信息。在上述步骤之前,我还尝试了.effmach x86
命令,但似乎没有影响。顺便提一下,我还使用为我正在测试的目标程序激活的应用程序验证程序重新执行了整个测试。我非常矛盾的结果:
0:000> g
ModLoad: 00000000`76d40000 00000000`76e5f000 WOW64_IMAGE_SECTION
ModLoad: 00000000`74f90000 00000000`75090000 WOW64_IMAGE_SECTION
ModLoad: 00000000`76d40000 00000000`76e5f000 NOT_AN_IMAGE
ModLoad: 00000000`76e60000 00000000`76f5a000 NOT_AN_IMAGE
ModLoad: 00000000`71160000 00000000`711c0000 C:\Windows\syswow64\verifier.dll
Page heap: pid 0x1A54: page heap enabled with flags 0x3.
AVRF: CleanPayload.exe: pid 0x1A54: flags 0x80643027: application verifier enabled
ModLoad: 00000000`71130000 00000000`7115b000 C:\Windows\SysWOW64\vrfcore.dll
ModLoad: 00000000`710d0000 00000000`71128000 C:\Windows\SysWOW64\vfbasics.dll
ModLoad: 00000000`74f90000 00000000`75090000 C:\Windows\syswow64\kernel32.dll
ModLoad: 00000000`76830000 00000000`76876000 C:\Windows\syswow64\KERNELBASE.dll
ModLoad: 00000000`715c0000 00000000`7164e000 C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a\MSVCP90.dll
ModLoad: 00000000`73dc0000 00000000`73e63000 C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a\MSVCR90.dll
(1a54.17dc): WOW64 breakpoint - code 4000001f (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
ntdll32!LdrpDoDebuggerBreak+0x2c:
771e0f2b cc int 3
0:000:x86> !avrf
*************************************************************************
*** ***
*** ***
*** 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: wow64!_TEB32 ***
*** ***
*************************************************************************
Application verifier is not enabled for this process.
Use appverif.exe tool to enable it.
以上执行说AVRF: Cleanpayload.exe ... application verifier enabled
,这表明它被锁定到目标。但后来的!avrf
命令显示调试符号不好,即使lm
命令显示它们都已正确加载!这里发生了什么?
你找出异常原因吗? – 2014-12-12 20:51:59