来自 Microsoft Dia2Lib 的 0x806D0005 的 HRESULT

发布于 2024-09-02 08:10:40 字数 1130 浏览 6 评论 0原文

我正在尝试将 PDB 文件读入 C# 应用程序。当我使用已知存在的文件调用 loadDataFromPdbloadAndValidateDataFromPdb 时,我得到的 HRESULT 为 0x806D0005。不幸的是,我不知道这意味着什么。我有可能的结果列表[此处](http://msdn.microsoft.com/en-us/library/2008hf0e(v=VS.80).aspx)但恐怕我无法最终确定问题。

有人知道我做错了什么吗?或者至少有一种方法来检查对应的内容?

异常:System.Runtime.InteropServices.COMException(0x806D0005):来自HRESULT的异常:0x806D0005 在 Dia2Lib.DiaSourceClass.loadDataFromPdb(String pdbPath)

代码示例:

public static void LoadSymbolsForModule(uint baseAddress, uint size, uint timeStamp, DM_PDB_SIGNATURE signature)
{
    IDiaDataSource m_source = new DiaSourceClass();
    //m_source.loadAndValidateDataFromPdb(signature.path, ref signature.guid, 0, signature.age);
    m_source.loadDataFromPdb(signature.path);
    IDiaSession m_session;
    m_source.openSession(out m_session);
    m_session.loadAddress = baseAddress;
    modules.Add(new Module(baseAddress, size, m_session));
}

提前致谢,伙计们。这个问题困扰了我一整天。

I'm trying to read a PDB file into a C# application. When I call loadDataFromPdb or loadAndValidateDataFromPdb with a file that I know exists, I get an HRESULT of 0x806D0005. Unfortunately, I have no idea what that means. I have the list of possible results [here](http://msdn.microsoft.com/en-us/library/2008hf0e(v=VS.80).aspx) but I'm afraid I can't conclusively determine the problem.

Does anybody know what I'm doing wrong? Or at least a method of checking what that corresponds to?

Exception: System.Runtime.InteropServices.COMException (0x806D0005): Exception from HRESULT: 0x806D0005
at Dia2Lib.DiaSourceClass.loadDataFromPdb(String pdbPath)

Code Sample:

public static void LoadSymbolsForModule(uint baseAddress, uint size, uint timeStamp, DM_PDB_SIGNATURE signature)
{
    IDiaDataSource m_source = new DiaSourceClass();
    //m_source.loadAndValidateDataFromPdb(signature.path, ref signature.guid, 0, signature.age);
    m_source.loadDataFromPdb(signature.path);
    IDiaSession m_session;
    m_source.openSession(out m_session);
    m_session.loadAddress = baseAddress;
    modules.Add(new Module(baseAddress, size, m_session));
}

Thanks in advance, guys. This problem has been killing me all day.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

入画浅相思 2024-09-09 08:10:40

搜索 E_PDB_NOT_FOUND const 在 google 代码上找到了 dia2.h,确认 0x806D0005 是 E_PDB_NOT_FOUND。

E_PDB_OK            = ( HRESULT  )(( ( ( ( unsigned long  )1 << 31 )  | ( ( unsigned long  )( LONG  )0x6d << 16 )  )  | ( unsigned long  )1 ) ),
E_PDB_USAGE         = ( E_PDB_OK + 1 ) ,
E_PDB_OUT_OF_MEMORY = ( E_PDB_USAGE + 1 ) ,
E_PDB_FILE_SYSTEM   = ( E_PDB_OUT_OF_MEMORY + 1 ) ,
E_PDB_NOT_FOUND     = ( E_PDB_FILE_SYSTEM + 1 ) ,

请注意,您正在使用的函数的签名采用 LPCOLESTR,它是一个 unicode 字符串。确保在接口声明中正确编组字符串,即:

Int32 loadDataFromPdb ( [MarshalAs(UnmanagedType.LPWStr)] string pdbPath );

msdn 文档 还暗示,如果该文件存在,并且“确定该文件的格式无效”,则将返回该错误。我怀疑这是实际的问题,但如果您以某种非标准方式生成该 pdb 文件,问题可能是 pdb 文件本身。

搜索 hresult 和 E_PDB_NOT_FOUND 发现有人遇到了同样的问题。看来他们的问题是由于资源消耗造成的,即加载了太多pdb或没有正确释放。该 hresult 和该错误名称的其他搜索结果似乎支持由于其他加载 pdb 失败(例如 pdb 太大)而引发此错误的可能性。

希望这会有所帮助。 :)

Searching for the E_PDB_NOT_FOUND const turned up the source code on google code of dia2.h, which confirmed that 0x806D0005 is E_PDB_NOT_FOUND.

E_PDB_OK            = ( HRESULT  )(( ( ( ( unsigned long  )1 << 31 )  | ( ( unsigned long  )( LONG  )0x6d << 16 )  )  | ( unsigned long  )1 ) ),
E_PDB_USAGE         = ( E_PDB_OK + 1 ) ,
E_PDB_OUT_OF_MEMORY = ( E_PDB_USAGE + 1 ) ,
E_PDB_FILE_SYSTEM   = ( E_PDB_OUT_OF_MEMORY + 1 ) ,
E_PDB_NOT_FOUND     = ( E_PDB_FILE_SYSTEM + 1 ) ,

Note that the signature of the function you're using takes a LPCOLESTR, which is a unicode string. Make sure you're marshaling your string correctly in your interface declaration, ie:

Int32 loadDataFromPdb ( [MarshalAs(UnmanagedType.LPWStr)] string pdbPath );

The msdn documentation also implies that if the file exists, that error will be returned if it "determined that the file has an invalid format". I doubt this is the actual problem, but if you're generating that pdb file in some non-standard way, the problem could be the pdb file itself.

Searching for the hresult and E_PDB_NOT_FOUND found someone that encountered the same problem. It seemed that their problem was due to resource consumption, ie too many pdbs being loaded or not being released properly. Other search results for that hresult and that error name seem to support the possibility that this error is being thrown for other failures to load the pdb, such as pdbs being too large.

Hopefully this helps a bit. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文