Visual Studio中:在发布版本调试信息 [英] Visual Studio: debug information in release build

查看:220
本文介绍了Visual Studio中:在发布版本调试信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想包括调试信息在我的发布版本是出去给客户。据我看到的唯一的缺点是二进制文件大小增加25%。它的优点是我能得到一个立即可用崩溃转储,更易于分析。
我愿意活在25%的增幅。是否有任何其他的缺点我失踪?

I'm tempted to include debug information in my release builds that go out to customers. As far as I see the only down side is 25% increase in the binary file size. The advantage is that I can get an immediately usable crash dump, much easier to analyze. I'm willing to live with the 25% increase. Are there any other disadvantages I'm missing?

这是一个C项目和所有我想要做的就是链接/调试/生成调试信息

This is a C project and all I want to do is Linked/Debugging/Generate Debug Info

推荐答案

可执行文件的大小应增加超过25%少得多。

The size of the executable should increase much less than 25%.

实际上,我有点惊讶,它增加了很多在所有,但一些快速的测试表明,至少有一个大的示例项目(的ScummVM)刚刚加入<$ C $从10205184字节10996224字节增加的.exe C> / DEBUG 选项链接步骤(约8%的增长)。 / DEBUG 使用指定为链接|调试|生成调试信息在IDE选项。请注意,此设置 的应当对由编译器生成的优化没有影响

I'm actually a little surprised that it increases much at all, but some quick tests show that at least one large example project (ScummVM) increases the .exe from 10,205,184 bytes to 10,996,224 bytes just by adding the /DEBUG option to the link step (about an 8% increase). /DEBUG is specified using the "Linker | Debugging | Generate Debug Info" option in the IDE. Note that this settings should have no effect on the optimizations generated by the compiler.

我知道,一个指向.pdb文件被放在可执行文件,但没有多少了这一点。我试验了一下,发现使 / OPT:NOREF 连接选项改变了大小差异10205184与10205696。所以非 / DEBUG 构建保持不变的尺寸,但 / DEBUG 打造下降到只有512更大的字节数(即可以由指针到.PDB占到 - 也许是连接几轮的512或东西)有些多。远远高于1%,同比少增。显然,加入 / DEBUG 将导致连接器保持未引用的对象,除非您还指定 / OPT:NOREF 。 (连接器|优化|引用在IDE中选择)。

I know that a pointer to the .pdb file is put in the executable, but there's not much to that. I experimented a bit and found that enabling the /OPT:NOREF linker option changed the size difference to 10,205,184 vs. 10,205,696. So the non /DEBUG build stayed the same size, but the /DEBUG build dropped to only 512 bytes larger (which could be accounted for by the pointer-to-.pdb - maybe the linker rounds to some multiple of 512 or something). Much less than 1% increase. Apparently, adding /DEBUG causes the linker to keep unreferenced objects unless you also specify /OPT:NOREF. ("Linker | Optimization | References" option in the IDE).

该程序将运行没有.pdb文件罚款 - 你可以选择将其发送给客户的,如果你要提供在客户现场更好的调试经验。如果你只是希望能够获得体面的堆栈跟踪,你并不需要有客户机上的.pdb文件 - 他们(或某些工具/功能,您提供)可以发送它可以加载到转储文件在您的网站提供的.pdb文件调试器并获得相同的堆栈跟踪信息的端口验。

The program will run fine without the .pdb file - you can choose to send it to customers if you want to provide a better debugging experience at the customer site. If you just want to be able to get decent stack traces, you don't need to have the .pdb file on the customer machine - they (or some tool/functionality you provide) can send a dump file which can be loaded into a debugger at your site with the .pdb file available and get the same stack trace information port-mortem.

一件事,当然需要注意的是,你需要与你一起释放存档.pdb文件。在Windows调试工具包(也就是现在分布在Windows SDK)提供了一个符号服务器工具,这样你就可以存档.pdbs,轻松地检索它们进行调试。

One thing to of course be aware of is that you'll need to archive the .pdb files along with your releases. The "Debugging Tools for Windows" package (which is now distributed in the Windows SDK) provides a symbol server tool so you can archive .pdbs and easily retrieve them for debugging.

这是我能想到的分发.pdb文件的唯一缺点是,它可以使逆向工程的应用程序更容易,如果这是你关心的问题。需要注意的是Microsoft分发符号为Windows(使用公共符号服务器 - 以及完整的符号包规定了一些具体的版本)。然而,他们分发的符号确实会通过消毒的步骤,消除某些项目,他们认为敏感的运行。你可以做使用相同(或类似)链接器的 / PDBSTRIPPED 选项(连接器|调试|地带私有符号在IDE)。请参见在MSDN文档有关选项删除哪些细节。如果你要分发的符号,它可能适合使用该选项。

The only drawback that I can think of to distributing .pdb files is that it can make reverse engineering your application easier, if that's a concern for you. Note that Microsoft distributes symbols for Windows (using a public symbol server - as well as packages of the full symbols sets for some specific releases). However, the symbols they distribute do get run through a sanitizing step that removes certain items they consider sensitive. You can do the same (or similar) using the linker's /PDBSTRIPPED option ("Linker | Debugging | Strip Private Symbols" in the IDE). See the MSDN docs for details on what the option removes. If you're going to distribute symbols, it's probably appropriate to use that option.

这篇关于Visual Studio中:在发布版本调试信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆