断点没有命中
我将一个应用程序从 VC6 移植到 VS 2008。我在发布版本中重建了该应用程序。 Pdb 文件位于 exe 所在的文件夹中。但是,当我加载应用程序并放置断点时,我收到以下消息
“当前不会命中断点。此文档没有加载任何符号”
问题的原因是什么?
I ported an application from VC6 to VS 2008. I rebuilt the application in release build. The Pdb file is available in the folder where exe is located. But when I loaded the application and put break point I am getting the following message
"The breakpoint will not currently be hit.No symbols have been loaded for this document"
What would be the cause of the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
调试器找不到应用程序或 PDB。
当您启动程序时,加载的二进制文件会准确显示在“输出”窗口中。确保加载正确的文件。当一切正确加载时,输出看起来像这样:
当未找到 PDB 时,不会显示“符号已加载”,而是显示:
请确保您首先运行应用程序的正确版本(检查运行路径),然后确保 PDB 位于该目录中。您可以通过调整“项目>属性...>链接器>生成程序数据库文件”来更改 PDB 的生成位置
The debugger could not find either the application or the PDBs.
When you start the program, exactly which binaries are loaded are shown in the Output window. Make sure the right files are being loaded. When everything loads properly, the output looks something like this:
When the PDB is not found, instead of saying "Symbols loaded" it says:
Make sure that you are first running the correct version of your application (check the running path), and then make sure that the PDB is in that directory. You can change where the PDB is generated to by tweaking "Project>Properties...>Linker>Generate Program Database File"
调试器找不到与您放置断点的源位置关联的代码。
造成这种情况的原因可能有很多。我最常发现的是一段真正未编译的代码(由于预处理器条件或死代码删除)。
我想也可能有其他原因(例如内联,尽管理论上编译器可以为所有内联生成正确的映射。我不知道VS2008在这里做什么)。
您确定将断点放置在应该执行的代码路径中吗?
The debugger could not find code associated with the source location you put the breakpoint at.
There can be a number of reasons for this. The one I've most often found was a section of code that was truly not compiled in. (either because of preprocessor conditionals or dead-code removal).
I imagine there can be other reasons too (e.g. inlining, though in theory, the compiler could generate the proper mapping for all the inlines. I don't know what VS2008 does here).
Are you sure you're putting the breakpoint in a code path that is supposed to be executed ?
您提到的 PDB 文件可能与发布版本无关,
发布版本中通常不存在调试信息(尽管您可以在必要时启用它,但应该预料到由于编译器优化而产生的令人惊讶的效果)。
因此,您只能在已知的 DLL 入口点上设置断点(可以通过模块列表视图 - 我已经有一段时间没有大量使用 Visual Studio)或直接在汇编指令上设置断点。
请注意,您也许可以使用调试符号编译应用程序的一部分。
The PDB file you mention is probably not related to the release build,
Debug information is normally absent in the release build (though you can enable it if you have to but should anticipate surprising effects due to compiler optimizations).
Therefore, you can only set breakpoints on known DLL entry points (possible via the Module List view - it has been a while since I used Visual Studio intensively) or directly on assembly instructions.
Note that you could perhaps compile part of your application with debug symbols.
我刚刚解决了一个类似的问题,
我不确定其中哪一个解决了问题,但确实解决了!
I have just solved a similar problem
I'm not sure which of these fixed the problem, but it did!