混合模式程序集未加载本机 C++ 的符号数据库
我正在使用 C++/CLI 中的混合模式程序集。在混合模式汇编中成功时,所有托管模式组装的 pdb 都会被加载,但即使本机 pdb 的信息显示在“模块”窗格中(即在 VS 调试 -> Windows -> 模块中),也不会加载本机 dll 和 pdb。 。
我正在使用本机 dll 并在 C++/CLI 代码中的混合程序集中调用其导出函数。在这里,函数被成功调用,但本机 pdb 符号未加载,本机代码中的所有断点都显示为空心圆圈,并且工具提示显示没有为此加载符号。
我已经完成了所有操作,将 pdb 放置在托管进程启动的当前目录中;删除所有 obj 和 debug 文件夹并同时重新编译每个项目;我什至使用了 ChkMatch 实用程序,它显示 Exe 中的符号和相应的 pdb 匹配。
有没有办法在从托管(C++/LCI 混合模式)代码调用时启用本机代码的断点?
问候,
乌斯曼
I am working with mixed mode assemblies in C++/CLI. All managed mode assembled pdb's get loaded when successfully in mixed mode assembly, but native dll's and pdb's are not getting loaded even though the information of native pdb's is shown in the Modules pane (i.e. in VS Debug->Windows->Modules).
I am using native dll and calling its exported function in mixed assembly in C++/CLI code. Here, functions get called successfully, but native pdb symbols are not loading and all breakpoints in the native code are shown as hollow circle and tool tips says there are no symbols loaded for this.
I have done everything, pdb placed in current directory to where the managed process is launched; deleted all obj and debug folders and recompiled every project at the same time; I even used the ChkMatch utility which shows that the symbols in the Exe and corresponding pdb match.
Is there any way to enable breakpoints of native code while calling from managed (C++/LCI Mixed mode) code?
Regards,
Usman
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
混合模式调试有时会出现失误,但大多数情况下会出现失误。首先检查您是否确实启用了混合模式调试。对于 C# 项目,它是“项目 + 属性”、“调试”、“启用非托管代码调试”复选框。接下来,不为 64 位进程启用混合模式调试。如果您在 64 位操作系统上运行,请确保强制 .exe 在 32 位模式下运行。项目 + 属性,构建选项卡,平台目标 = x86。
接下来验证调试器在何处查找 .pdb 文件。在“调试”+“Windows”+“模块”窗口中,右键单击 DLL 并选择“符号加载信息”。最后喘息的是在非托管代码中使用 __debugbreak() 。
更新:VS 的最新版本(从 VS2012 开始)有一个新的托管调试引擎,与非托管调试引擎不够兼容。工具>选项>调试>一般,勾选“使用托管兼容模式”。它启用旧版调试引擎,即 VS2010 中最后使用的引擎。
Mixed-mode debugging can be hit and miss, mostly miss. First check that you've actually have mixed-mode debugging enabled. From a C# project, it is Project + Properties, Debug, Enabled unmanaged code debugging check box. Next, mixed-mode debugging is not enabled for 64-bit processes. If you run on a 64-bit operating system, make sure you force the .exe to run in 32-bit mode. Project + Properties, Build tab, Platform Target = x86.
Next verify where the debugger looked for the .pdb files. From the Debug + Windows + Modules window, right-click the DLL and select "Symbol load information". Final gasp is to use __debugbreak() in the unmanaged code.
UPDATE: Recent versions of VS (starting with VS2012) have a new managed debugging engine that is not compatible enough with the unmanaged debugging engine. Tools > Options > Debugging > General, tick "Use Managed Compatibility Mode". It enables the legacy debugging engine, the one last used in VS2010.