WinDbg: Version mismatch of dbghelp.dll when trying to attach to a process

落爺英雄遲暮 提交于 2019-12-02 04:04:52

问题


Over a year ago I already used WinDbg and DebugDiag to find a memory leak in a JNI native DLL that we use from within Java. Now I am searching for a thread handle leak. I created a memory dump using Process Explorer and tried to analyze it in DebugDiag, but all I get are script errors:

I also tried WinDbg, but it is not able to attach to a process anymore. I always get the error message "dbghelp.dll has a version mismatch with the debugger":

("Unbekannter Fehler" means "Unknown error")

I uninstalled DebugDiag and the Windows SDK, then downloaded the newest versions and installed Windows SDK 8 and DebugDiag 1.2 (x86). The problem stays the same. Even after replacing the Windows SDK with Version 7.1 (the latest SDK for Windows 7) nothing changes.

I'm using a machine with Windows 7 (32 Bit).

I assume that the problems in DebugDiag have the same cause as the problems in WinDbg. But I don't understand what version mismatch is meant (and googling didn't help either):

  • WinDbg: 6.12.0002.633
  • dbgeng: 6.12.0002.633
  • dbghelp: 6.12.0002.633

How can I make WinDbg (and hopefully DebugDiag) work again?


回答1:


This is pseudo code of the part of dbgeng that performs this check:

var (
    g_ApiVersion = API_VERSION{1, 0, 12, 0}
    g_DbghelpVersion API_VERSION
    g_EngOptions = Options{...}
)

func ChkDbghlpVersion() uint32 {
    g_DbghlpVersion = dbghelp.ImagehlpVersionEx(g_ApiVersion)
    if g_DbghelpVersion.Revision < g_ApiVersion.Revision {
        DebugOutput("dbghelp.dll has version mismatch with the debugger")
        if !(g_EngOptions.SomeOpt & 1) {
            return E_UNKNOWN
        }
    }
    return S_OK
}

So, you should check what dbghelp.dll from the debugging folder returns from ImagehlpApiVersionEx (and possibly what dbgeng.dll has in its g_ApiVersion) to find out why your debugger is failing.

Possible causes:

  • dbghelp.dll really has an alternate build information.
  • dbgeng.dll is corrupt (?) and contains invalid data in its api version block


来源:https://stackoverflow.com/questions/15882862/windbg-version-mismatch-of-dbghelp-dll-when-trying-to-attach-to-a-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!