我有一个使用 WPF 的混合模式 C++/CLI 应用程序。我们客户的崩溃作为小型转储报告给我们自己的服务器。
当我尝试使用来自 windbg sos-extension 的 !pe 或 !clrstack 命令调查小型转储时,我经常会从 WPF 程序集中获得不完整的堆栈帧信息,例如
SP IP Function
0013E370 564618E3 PresentationFramework_ni!Unknown+0x1bf
0013E3A4 56461258 PresentationFramework_ni!Unknown+0x58
0013E3CC 5634C6D8 PresentationFramework_ni!Unknown+0x18
0013E3D8 55C04AA2 PresentationFramework_ni!Unknown+0x502
...
在这种情况下,堆栈跟踪解码也会变得非常慢。
使用 !sym noise 显示了很多来自以下内容的消息
SYMSRV: C:\Symbols\PresentationFramework.ni.dll\488F142Edab000\PresentationFramework.ni.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/PresentationFramework.ni.dll/488F142Edab000/PresentationFramework.ni.dll not found
DBGHELP: C:\Program Files (x86)\Debugging Tools for Windows (x86)\PresentationFramework.ni.dll - file not found
DBGHELP: PresentationFramework.ni.dll not found in c:\Windows\System32
SYMSRV: C:\Symbols\PresentationFramework.ni.dll\488F142Edab000\PresentationFramework.ni.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/PresentationFramework.ni.dll/488F142Edab000/PresentationFramework.ni.dll not found
DBGENG: C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\PresentationFramewo#\9519494798a88867406b5755e1dbded6\PresentationFramework.ni.dll - Couldn't map image from disk.
SYMSRV: C:\Symbols\PresentationFramework.dll\488F142E50e000\PresentationFramework.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/PresentationFramework.dll/488F142E50e000/PresentationFramework.dll not found
DBGHELP: C:\Program Files (x86)\Debugging Tools for Windows (x86)\PresentationFramework.dll - file not found
DBGHELP: PresentationFramework.dll not found in c:\Windows\System32
SYMSRV: C:\Symbols\PresentationFramework.dll\488F142E50e000\PresentationFramework.dll not found
SYMSRV: http://msdl.microsoft.com/download/symbols/PresentationFramework.dll/488F142E50e000/PresentationFramework.dll not found
DBGENG: C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll image header does not match memory image header.
DBGENG: C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll - Couldn't map image from disk.
我用了
c:\Windows\System32;SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
作为windbg符号和图像路径。
据我了解,如果发生崩溃的机器和带有调试器的机器在 Windows 版本、.NET 版本的 SP 方面不同,只会发生在 .NET 本机映像上。我主要看到它用于 WPF 本机图像。
我能做些什么来避免这个问题?
更新我最初的问题:
我忘了提到我在使用不同的 mscordacwks dll 版本时遇到了类似的问题。为了使用 SOS,在调试计算机上需要崩溃计算机上使用的 mscordacwks.dll 版本。所以我开始从不同的Windows和SP组合中收集这个dll的各种版本,并将它们放在我们自己的符号服务器上。当然,这很尴尬,甚至更是如此,因为它们需要按照特殊约定命名(例如 mscordacwks_x86_x86_2.0.50727.4952.dll)。
如果我从下面正确理解 Rick 的回答,我必须对我们引用的 .NET 程序集的本机映像做类似的事情。我已经通过一个示例(WindowsBase.ni.dll)手动尝试了这一点,但我无法轻松地将这个 dll 存储在我们的符号服务器上。symstore 似乎不理解本机图像。来自 symstore 的错误消息是:
SYMSTORE MESSAGE: Skipping file .\WindowsBase.ni.dll - not a known file type.
所以我尝试将它放入一个额外的目录并将其添加到我的符号或图像路径中,然后 SOS 正确解码了 WindowsBase_ni 帧。
但是这一切看起来像是很多烦人的手动设置工作:获取各种 .NET 版本的所有本机映像(SP 和安全更新呢),手动设置调试器,因为无法使用 symstore,...
这真的是唯一的方法吗?
如果您可以控制客户的环境,这可能不是这样的问题。但对于为大型用户群构建混合模式应用程序的组织来说,这似乎是一场事后调试的噩梦。