本文介绍了发布生成.pdb文件,为什么呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在地球上的版本编译时Visual Studio 2005中生成 .PDB 文件?我不会调试的发布版本,所以他们为什么产生?

Why on earth does Visual Studio 2005 generate the .pdb files when compiling in release? I won't be debugging a release build, so why are they generated?

推荐答案

由于没有PDB文件,是不可能被任何东西比地址级调试等调试发布版本。优化真的做了一些你的code,使其很难找到罪魁祸首,如果出现错误(例如,将引发异常)。 PDB文件帮你出这一点。

Because without the PDB files, it would be impossible to debug a release build by anything other than address-level debugging. Optimizations really do a number on your code, making it very difficult to find the culprit if something goes wrong (say, an exception is thrown). PDB files help you out with that.

您做出的一点是,如果你的软件准备好发布,你应该到那时做了所有的调试。虽然这是事实,但也有几个要点要牢记:

You make the point that if your software is ready for release, you should have done all your debugging by then. While that's certainly true, there are a couple of important points to keep in mind:

  1. 您应该的的测试和调试应用程序(你释放它之前)使用释放的构建。这是因为打开优化(它们是通过在调试配置默认禁用)有时会引起微妙的错误出现,你会不会以其他方式赶上。当你这样做的调试,你需要的PDB符号。

  1. You should also test and debug your application (before you release it) using the "Release" build. That's because turning optimizations on (they are disabled by default under the "Debug" configuration) can sometimes cause subtle bugs to appear that you wouldn't otherwise catch. When you're doing this debugging, you'll want the PDB symbols.

客户经常报告边界情况和错误,只有在理想情况突然出现。这些事情是几乎不可能在实验室重现,因为它们依赖于用户的机器上的一些怪诞的配置。如果他们是特别有用的客户,他们会报告抛出的异常,并为您提供一个堆栈跟踪。或者,他们甚至会借给你的机器的软件调试。在这两种这些情况下,您会希望PDB文件来帮助你。

Customers frequently report edge cases and bugs that only crop up under "ideal" conditions. These are things that are almost impossible to reproduce in the lab because they rely on some whacky configuration of that user's machine. If they're particularly helpful customers, they'll report the exception that was thrown and provide you with a stack trace. Or they'll even let you borrow their machine to debug your software. In either of those cases, you'll want the PDB files to assist you.

剖析应的总是的是对释放完成建造并启用优化。再一次,在PDB文件派上用场,因为它们允许你映射的汇编指令正在分析回你写的源$ C ​​$ C。

Profiling should always be done on "Release" builds with optimizations enabled. And once again, the PDB files come in handy, because they allow you to map the assembly instructions being profiled back to the source code that you wrote.

您不能生成PDB文件的 的编译后。如果不创建它们,当你编译应用程序,你失去了你的机会。它不会伤害任何东西来创建它们。如果您不希望分发它们,你可以简单地从你的二进制文件忽略它们。但是,如果您稍后决定要他们,你的运气了。更好地产生他们,并让您的机器上保存备份,以防万一。

You can't generate the PDB files after the compile. If you don't create them when you compile the app, you've lost your opportunity. It doesn't hurt anything to create them. If you don't want to distribute them, you can simply omit them from your binaries. But if you later decide you want them, you're out of luck. Better to generate them and keep a copy on your machine, just in case.

如果你真的想将其关闭,这总是一种选择。检查项目的属性窗口。对于要更改任何配置设置调试信息为无。

If you really want to turn them off, that's always an option. Check in your project's Properties window. Set the "Debug Info" to "none" for any configuration you want to change.

做,请注意,调试和发布配置的执行的默认情况下使用不同的设置,用于发射调试信息。在调试信息选项设置为满的调试版本,这意味着,除了PDB文件,调试符号信息嵌入到组件。在发行模式下,PDB-ONLY选项被选中,其中,像它的声音,只包括PDB文件,在不影响大会的内容。这不是很简单,只要在你的 /箱目录仅仅presence与否PDB文件。包括PDB文件绝不会影响您的code运行时的性能,假设您编译使用PDB-仅选项。

Do note, however, that the "Debug" and "Release" configurations do by default use different settings for emitting debug information. The "Debug Info" option is set to "full" for a Debug build, which means that in addition to a PDB file, debugging symbol information is embedded into the assembly. In Release mode, the "pdb-only" option is selected, which, like it sounds, includes only the PDB file, without affecting the content of the assembly. It's not quite as simple as the mere presence or absence of PDB files in your /bin directory. Including the PDB file will in no way affect the run-time performance of your code, assuming you compiled using the "pdb-only" option.

这篇关于发布生成.pdb文件,为什么呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 03:08