Visual Studio 2008 断点不会被命中

发布于 2024-11-16 05:41:08 字数 150 浏览 5 评论 0原文

我有一个仅在发布模式下出现的错误,这是一个问题,因为我无法定期调试我的代码。断点显示“当前不会命中断点。尚未为此文档加载任何符号。”我已经尝试了人们发布的有关此问题的许多其他解决方案,但它们似乎都不适用于发布模式。对于如何在发布模式下查找错误或如何在发布模式下定期调试代码有什么建议吗?

I have a bug that only occurs in release mode, which is a problem because I am not able to regularly debug my code. The breakpoint says "The breakpoint will not currently be hit. No symbols have been loaded for this document." I have tried many of the other solutions people have posted about this problem, but none of them seem to work for release mode. Are there any suggestions on how to find a bug in release mode or how to regularly debug code in release mode?

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

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

发布评论

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

评论(2

清眉祭 2024-11-23 05:41:08

您需要在项目中启用调试符号。

如果这是一个 C++ 项目,您需要做 2 件事来获取调试信息:

1) 在“配置属性”下的“项目设置”中 -> “C/C++”-> “常规”,需要将“调试信息格式”设置为“程序数据库(/Zi)”。

2)在“项目设置”下的“配置属性”-> “链接器”-> “调试”确保将“生成调试信息”设置为“是(/DEBUG)”。

然后,构建(编译和链接)过程将生成一个带有调试信息的 PDB...通常位于 exe 文件旁边,但带有 pdb 扩展名。

现在,当您从 Visual Studio 运行项目时,您应该能够调试和设置断点。

其他语言也有类似的设置,尽管位置略有不同。

You need to enable debug symbols in your project.

If this is a C++ Project, you need to do 2 things to get debug info:

1) In the "Project Settings" under "Configuration Properties" -> "C/C++" -> "General", you need to set "Debug Information Format" to "Program Database (/Zi)".

2) In the "Project Settings" under "Configuration Properties" -> "Linker" -> "Debugging" make sure you set the "Generate Debug Info" to "Yes (/DEBUG)".

Then, the build (compile and link) process will generate a PDB with debug info... typically next to your exe file but with a pdb extension.

Now when you run the project from Visual Studio, you should be able to debug and set breakpoints.

Other languages have similars settings although in slightly different locations.

风渺 2024-11-23 05:41:08

默认情况下,发布配置不会构建 .pdb 文件(其中包含无法加载的符号)。您可以在项目属性中启用此选项。另请注意,默认情况下您的代码将被优化。这可能会影响断点,所以通常,当我调试发布版本时,我会创建几个断点(因为无法加载您的符号,所以这不是您的问题...)。

如果您在构建该程序的同一台计算机上运行,​​那么它通常会找到 .pdb 文件和源代码。如果没有,请确保 .pdb 文件与 .exe 位于同一目录中,以便运行时/调试器可以找到这些符号。

By default, the release configuration does not build a .pdb file (which contains the symbols that cannot be loaded). You can enable this option in your project properties. Also be aware that your code will be optimized, by default. This can affect breakpoints, so often, when I am debugging release builds, I will create several breakpoints (Since your symbols cannot be loaded, this is not your problem... yet).

If you are running the on the same computer that built the program, then it will usually find the .pdb file and source code. If not, make sure that the .pdb file is in the same directory as your .exe so the runtime/debugger can find the symbols.

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