使用WinDBG分析、调试dump文件

本文介绍了解决因MS Cordacwks.dll版本不一致导致的Windbg扩展命令无法正常工作的问题。通过复制匹配版本的MS Cordacwks.dll文件并放置到Windbg搜索路径中,可以有效解决该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.load C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\SOS.dll

!dumpheap -stat

!dumpheap -mt <内存地址>

 

 

 

问题1、如何处理源dump文件的mscordacwks.dll文件与调试机上的版本不一致问题而无法使用extension cmd的问题

 

问题描述:

当抓取了问题机器上的managed application的dump文件之后, 而在另外一台机器上对该dump进行分析时。如果问题机器和目标机器的mscordacwks.dll版本不一致,则在 .load C:\Windows\Microsoft.NET\Framework\v2.0.50727\sos.dll之后目标机器上找不到正确的mscordacwks.dll而导致无法使用debugger extension command.

例如随便键入一个extension command: !dumpheap

收到的错误信息如下:

*** ERROR: Symbol file could not be found.  Defaulted to export symbols for mscorwks.dll -
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 -ve -u -l看看

CLRDLL: C:\WINDOWS\Microsoft.NET\Framework\v2. 0.50727 \mscordacwks.dll: 2.0 . 50727.1434  f: 0
doesn
' t match desired version 2.0.50727.1433 f:0
CLRDLL: Unable to find mscordacwks_x86_x86_2. 0.50727 . 1433 .dll by mscorwks search
CLRDLL: Unable to find 
' mscordacwks_x86_x86_2.0.50727.1433.dll '  on the path
CLRDLL: Unable to find mscorwks.dll by search
CLRDLL: ERROR: Unable to load DLL mscordacwks_x86_x86_2.
0.50727 . 1433 .dll, Win32 error 0n2
CLR DLL status: ERROR: Unable to load DLL mscordacwks_x86_x86_2.
0.50727 . 1433 .dll, Win32 error 0n2

原来调试机器上的mscordacwks.dll和所抓取dump时的mscordacwks.dll所需要的dll版本不一致。 怎么办?很简单,就是把发生问题的客户机上的mscordackws.dll文件copy过来,然后将其rename为其所需要的文件名,并将其放置到适当的search path下。这里最适合的search path就是windbg安转文件夹下了。

然后用.cordll -ve -u -l 看看,结果如下:

CLRDLL: C:\WINDOWS\Microsoft.NET\Framework\v2. 0.50727 \mscordacwks.dll: 2.0 . 50727.1434  f: 0
doesn
' t match desired version 2.0.50727.1433 f:0
CLRDLL: Unable to find mscordacwks_x86_x86_2. 0.50727 . 1433 .dll by mscorwks search
CLRDLL: Loaded DLL mscordacwks_x86_x86_2.
0.50727 . 1433 .dll
CLR DLL status: Loaded DLL mscordacwks_x86_x86_2.
0.50727 . 1433 .dll

说明按照几个search path,终于最后搜索成功,找到所需dll.

 

另,参考链接:http://epiwiki.se/tools/windbg/analyze-the-dump-file/failed-to-load-data-access-dll,-0x80004005

 

 

转载于:https://www.cnblogs.com/peijihui/archive/2011/03/22/1991731.html

WinDBG 是个非常强大的调试器,它设计了极其丰富的功能来支持各种调试任务,包括用户 态调试、 内核态调试调试转储文件、 远程调试等等。 WinDBG 具有非常大的灵活性和可扩展性, 用来满足各种各样的调试需求,比如用户可以自由定义调试事件的处理方式,编写调试扩展模块 来定制和补充 WinDBG调试功能。 尽管 WinDBG 是个典型的窗口程序, 但是它的大多数调试功能还是以手工输入命令的方式来 工作的。目前版本的 WinDBG 共提供了 20 多条标准命令, 140 多条元命令( Meta-commands), 和难以计数的大量扩展命令。学习和灵活使用这些命令是学习 WinDBG 的关键,也是难点。 上一章我们从设计的角度分析WinDBG ,本章将从使用(用户)的角度介绍 WinDBG 。我 们先介绍工作空间的概念和用法(第 1 节),然后介绍命令的分类和不同种类的命令提示符(第 2 节)。 第 3 节介绍不同的调试模式, 也就是如何与不同特征的调试目标建立调试会话。 第 4 节介绍 上下文的概念和在调试时应该如何切换和控制上下文。第 5 节介绍调试事件和如何定制调试事件 的处理方式。 从第 6 节到第 9 节我们将分别介绍如何在 WinDBG 中完成典型的调试操作, 比如控 制调试目标(第 6 节)、设置断点(第 7 节)、观察栈(第 8 节)以及如何观察和修改数据(第 9 节)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值