创建调试信息时,发布版本的影响是什么? [英] What is the effect off a release build when debug information is created?

查看:34
本文介绍了创建调试信息时,发布版本的影响是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于nuget集成,我正在研究调试版本与完整PDB文件之间的区别,以及使用仅PDB文件发布版本。

For nuget integration I am researching the difference between debug builds with full PDB files, and release builds with PDB only files.

到目前为止,我发现只创建一个完整的PDB不会影响任何内容。

So far I found out that creating a FULL of PDB only does not affect anything.

我发现调试信息NONE和调试信息之间的DLL构建存在细微差别。仅PDB,文件大小增加6kb(1272kb对1264kb)。

I found out that there is a small difference in my DLL builds between debug info NONE and PDB only, the filesize is 6kb larger (1272kb vs 1264kb).

我还发现二进制差异在DLL中到处都存在差异,不仅仅是在一个或几个地方。

I also found out with a binary diff that there are differences everywhere in DLL, not only on one or a few places.

我读了一些帖子,创建调试信息可能会影响性能,但有些下降。

I read some posts that creating debug information could affect performance, but some decline.

那么当调试PDB是什么时添加到DLL创建?

So what is added to the DLL when a debug PDB is created?

Repro:

- 发布构建没有调试信息的DLL

- 重命名bin中的DLL /发布

- 发布带有调试信息的DLL(仅限完整或PDB)

- DLL不同

- release build a DLL without debug info
- rename the DLL in the bin/release
- release buld a DLL with debug info (full or PDB only)
- the DLL is different

祝你好运,

Rene 

Rene 

.NET开发人员/架构师

.NET developer / architect

推荐答案

完整的PDB包含调试包含的代码所需的所有符号信息,包括行信息,公共和私有符号以及相关信息。这是最大调试所需的信息。 PDB文件通常很大,因为

A full PDB contains all the symbol information needed to debug the contained code including line information, public and private symbols and related information. This is the kind of info you need for maximal debugging. PDB files are generally huge because of this.

PDB仅生成PDB但仅包含公共符号的信息。这个文件要小得多,允许调试面向公众的组件,但不允许调试内部组件。

A PDB only still generates a PDB but only contains the information for the public symbols. This file is a lot smaller and allows debugging of the public-facing components but nothing about the internal.

一般的经验法则是为调试版本生成完整的PDB,仅为发布版本生成pdb。在运行调试版本时,您可以获得最佳调试信息。发布版本仅获取pdb,并且(理想情况下)pdbs随二进制文件一起提供。
如果发布版本出现问题,崩溃处理程序可以使用pdb来尽可能多地获取有关程序崩溃位置的信息以及可能的某些符号信息。这使得调试无法在本地复制
的问题变得容易得多。此外,调试堆栈在调试器中查看时有更多有用的信息,因此您可以更好地诊断发布版本中的问题。

The general rule of thumb is to generate a full PDB for debug builds and a pdb only for release builds. You get optimal debugging info while running your debug builds. The release build gets the pdb-only and (ideally) the pdbs are shipped with the binaries. If something goes wrong with the release version, the pdb can be used by the crash handler to get as much info as possible about where the program crashed and possibly some symbol information. This makes it far easier to debug issues that you cannot replicate locally. Additionally the call stack has more useful information when looking at it in the debugger so you can better diagnose issues in the release build.

如果生成PDB,则DLL包含一些额外信息允许PDB识别它。 PDB与其相关的二进制文件紧密耦合。通常,您不希望尝试使用与用于生成它的
二进制文件无关的PDB。因此,PDB和二进制包含一些额外的信息以允许它们"同步"。事实上,如果VS与已加载的二进制文件不完全匹配,则可以选择不加载PDB。

If you generate a PDB then the DLL contains a little extra information that allows the PDB to identify it. A PDB is tightly coupled to the binary that it is related to. In general you don't want to try to use a PDB that isn't tied to the binary that was used to generate it. Hence the PDB and binary contain a little extra information to allow them to "sync up". In fact VS has an option to not load a PDB if it doesn't exactly match the binary that is already loaded.

为发布版本生成PDB是无害的,所以实际上没有你为什么不这样做的原因。唯一真正的问题是,您是将PDB作为包装的一部分运输,作为单独的符号包还是仅在客户遇到问题时提供。

Generating a PDB for a release build is harmless so there is really no reason why you wouldn't. The only real question is whether you ship the PDB as part of the package, as a separate symbol package or only provide it when a customer has an issue.

最后要注意的是配置确定构建影响。代码的调试版本将添加大量(可能)额外的调试信息,并且主要禁用任何优化。因此,调试版本总是比
发布版本更大,更慢。调试版本应仅用于开发。发布版本应该部署到生产服务器或发送给客户。调试版本不为它们提供任何内容,更大且速度更慢。如果您使用pdb(仅来自pdb)发布版本
,那么客户几乎从不需要调试版本。然而,他们获得了最小和最快的二进制文件,如果出现问题仍然可以使用部分PDB。

The final thing to note is that configurations determine the build impact. A debug build of your code will add a lot (potentially) of extra debug information and mostly disables any optimizations. As such a debug build is always larger and slower than a release build. Debug builds should only be used for development. A release build is what should be deployed to production servers or shipped to customers. The debug version provides nothing for them, is larger and is slower. If you ship the release version with the pdb (from pdb-only) then there is almost never a reason why a customer would need a debug build. Yet they get the smallest and fastest binary available and still have the partial PDB if something goes wrong.

Michael Taylor

http://www.michaeltaylorp3.net

Michael Taylor
http://www.michaeltaylorp3.net


这篇关于创建调试信息时,发布版本的影响是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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