在单独的项目中调试多个相关的 dll

发布于 2024-09-26 00:48:28 字数 117 浏览 1 评论 0原文

我必须在自己的项目中调试多个 dll。有一个加载 dll 的父可执行文件,它充当其他 dll 的容器。 我的问题是如何使用 Visual Studio 2005 for C++ 调试整个“组件”,即:涉及的所有 dll。

I have to debug multiple dlls each within their own project. There is a parent executable that loads a dll, which serves as a container for the other dlls.
My question is how can I debug the whole 'component' ie: all the dll's involved, using Visual Studio 2005 for C++.

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

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

发布评论

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

评论(2

瞎闹 2024-10-03 00:48:28

如果它们都在同一个解决方案中,请在要调试的 DLL 项目中设置断点,右键单击 EXE 项目,然后选择“调试”>“调试”。启动新实例。

如果它们位于单独的解决方案中,请打开 DLL 解决方案,右键单击该项目,展开左侧树中的“配置属性”节点,选择“调试”。将 Command 属性设置为指向其他项目中 EXE 的调试版本。然后设置断点并按 F5 开始调试。

If they're all in the same solution, set a breakpoint in the DLL project where you want to debug, right click on the EXE project, and select Debug > Start new instance.

If they're in separate solutions, open the DLL solution, right click on the project, expand the Configuration Properties node in the tree on the left, select Debugging. Set the Command property to point to the debug build of the EXE in the other project. Then set your breakpoint(s) and hit F5 to start debugging.

给不了的爱 2024-10-03 00:48:28

任意选择一个DLL项目作为启动项目,哪个都没关系。右键单击+属性,调试。将“命令”设置设置为将加载 DLL 的测试 EXE 的路径。如果你没有好的,那么就写一个,不妨将其添加到项目中并使其成为启动项目。

EXE 启动时请注意输出窗口。您将看到加载的每个 DLL 的通知。一旦解决方案中的某个 DLL 被加载,调试器就会立即介入,查找该 DLL 的 .pdb 文件,并激活您在 DLL 源代码中设置的所有断点。除非 EXE 加载它,否则您无法调试 DLL。

如果仍然无法启用断点,则使用“调试”+“Windows”+“模块”并在列表中找到 DLL。右键单击它并选择“符号加载信息”以找出调试器在何处查找 .pdb 文件。这不会经常出错,因为 DLL 包含 .pdb 文件的路径。更典型的故障模式是 EXE 根本没有加载 DLL。

Arbitrarily pick one of the DLL projects as the startup project, it doesn't matter which. Right-click + Properties, Debugging. Set the 'Command' setting to the path of a test EXE that will load the DLLs. If you don't have a good one then just write one, might as well add it to the project and make it the startup project.

Pay attention to the Output window while the EXE starts. You'll see notifications for each DLL that gets loaded. As soon as one of the DLLs that's in your solution gets loaded then the debugger jumps in, looks for the .pdb file for the DLL and activates any breakpoints you'd have set in the DLL source code. You cannot debug the DLL unless the EXE loads it.

If that still doesn't enable breakpoints then use Debug + Windows + Modules and locate the DLL in the list. Right-click it and choose Symbol Load Information to find out where the debugger looked for the .pdb file. This doesn't go wrong very often since the DLL contains the path to the .pdb file. The far more typical failure mode is that the EXE simply didn't load the DLL.

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