创建转储我设置未处理的异常过滤器通过做: SetUnhandledExceptionFilter(UnhandledException)WinDbg的:越来越堆栈跟踪在UnhandledExceptionFilter的
,并在我的UnhandledException功能,我写出来的使用MiniDumpWriteDump一个小型转储:
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),hFile, MiniDumpNormal,excpInfo?& eInfo: NULL,NULL,NULL);
当我看在WinDbg中的堆栈跟踪,我看不出有:
0:023> kb ChildEBP RetAddr Args to Child WARNING: Stack unwind information not available. Following frames may be wrong. 15e7e7dc 08f00150 08f00a78 08f00000 08f00150 ntdll!ZwGetContextThread+0x12 15e7e7fc 777d301e 6f00016e 00000044 627e056a 0x8f00150 15e7e890 777d2ffa 777d2bf2 00000000 00650000 ntdll!RtlInterlockedFlushSList+0x889 15e7e894 777d2bf2 00000000 00650000 077e1b88 ntdll!RtlInterlockedFlushSList+0x865 15e7e8b4 772b14d1 08f00000 00000000 077e0c48 ntdll!RtlInterlockedFlushSList+0x45d 15e7e8d0 777ce023 077e1b88 08f00138 00000001 kernel32!HeapFree+0x14 15e7e8e8 777d48c6 777bfafa 777d419a ffffffff ntdll!RtlFreeHeap+0x7e 15e7e914 777e9ed7 ffffffff 15e7e938 15e7e944 ntdll!RtlImageNtHeader+0xe2 15e7e93c 777e9e49 00010000 00000000 08c70000 ntdll!RtlDestroyHeap+0x139 15e7e958 75d5458e 08f00000 00000000 08ccfe46 ntdll!RtlDestroyHeap+0xab 15e7e9c4 777ce023 104d9250 104d91f0 104d9250 KERNELBASE!HeapDestroy+0xe 00000000 00000000 00000000 00000000 00000000 ntdll!RtlFreeHeap+0x7e
的MiniDumpWriteDump文档中提到的STRACK跟踪可能不太好,但我真的不明白我应该做些什么: http://msdn.microsoft.com/en-us/library/ms680360%28v=vs.85%29.aspx
任何帮助赞赏!
我很好奇 - 堆栈行走是否也可以在没有任何PDB文件的发布模式下工作? – Warpin 2011-03-31 00:52:39
如果DbgHelp库没有符号(PDB文件),它假定方法调用使用一些默认调用约定(可能是stdcall,但我不确定)。这使得堆栈走得很近,大多数情况下无用。你实际上需要符号。但是,您可以创建完全优化的二进制文件(即发布模式)并生成PDB。你会得到正确的调用堆栈。使用完全优化的二进制文件时唯一会遗漏的是函数参数和局部变量 - 其中很多会被优化掉或重用。 – 2011-03-31 01:38:16