我应该将带有调试信息的发布版本编译为“完整"吗?还是“仅限 pdb"? [英] Should I compile release builds with debug info as "full" or "pdb-only"?

查看:17
本文介绍了我应该将带有调试信息的发布版本编译为“完整"吗?还是“仅限 pdb"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 C# 项目的 Visual Studio 中,如果您转到项目属性 >构建 >高级 >Debug Info 您有三个选项:nonefullpdb-only.

In Visual Studio for a C# project, if you go to Project Properties > Build > Advanced > Debug Info you have three options: none, full, or pdb-only.

哪种设置最适合发布版本?

Which setting is the most appropriate for a release build?

那么,fullpdb-only 有什么区别?

So, what are the differences between full and pdb-only?

如果我使用 full 会对性能产生影响吗?如果我使用 pdb-only 会更难调试生产问题吗?

If I use full will there be performance ramifications? If I use pdb-only will it be harder to debug production issues?

推荐答案

我会使用 pdb-only 构建.您将无法将调试器附加到已发布的产品,但如果您收到故障转储,您可以使用 Visual Studio 或 WinDBG 检查崩溃时的堆栈跟踪和内存转储.

I would build with pdb-only. You will not be able to attach a debugger to the released product, but if you get a crash dump, you can use Visual Studio or WinDBG to examine the stack traces and memory dumps at the time of the crash.

如果您使用 full 而不是 pdb-only,您将获得相同的好处,除了可执行文件可以直接附加到调试器.鉴于您的产品,您需要确定这是否合理.客户.

If you go with full rather than pdb-only, you'll get the same benefits, except that the executable can be attached directly to a debugger. You'll need to determine if this is reasonable given your product & customers.

请务必将 PDB 文件保存在某处,以便在出现崩溃报告时可以参考它们.如果您可以设置 符号服务器来存储那些调试符号,这样就更好了.

Be sure to save the PDB files somewhere so that you can reference them when a crash report comes in. If you can set up a symbol server to store those debugging symbols, so much the better.

如果您选择使用 none 进行构建,则在现场发生崩溃时您将无法追索.您将无法对事故进行任何事后检查,这可能会严重影响您追查问题的能力.

If you opt to build with none, you will have no recourse when there's a crash in the field. You won't be able to do any sort of after-the-fact examination of the crash, which could severely hamper your ability to track down the problem.

关于性能的说明:

John RobbinsEric Lippert 已经写了博客关于 /debug 标志的帖子,它们都表明此设置对性能的影响.有一个单独的 /optimize 标志指示编译器是否应该执行优化.

Both John Robbins and Eric Lippert have written blog posts about the /debug flag, and they both indicate that this setting has zero performance impact. There is a separate /optimize flag which dictates whether the compiler should perform optimizations.

这篇关于我应该将带有调试信息的发布版本编译为“完整"吗?还是“仅限 pdb"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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