简体   繁体   English

pdb 文件包含多少信息? (C#/.NET)

[英]How much information do pdb files contain? (C# / .NET)

Is it wise to redistribute the pdb files along with a commercial application?将 pdb 文件与商业应用程序一起重新分发是否明智?

Occasionally, I'm using the stack trace to get a more detailed error reporting logs from the deployed applications;有时,我会使用堆栈跟踪从部署的应用程序中获取更详细的错误报告日志; can this functionality be achieved without relying to those files?可以在不依赖这些文件的情况下实现此功能吗?

Also, how much hints of the original source code does these files contain?另外,这些文件包含多少原始源代码的提示? Would it be easier to reverse-engineer my application using it?使用它对我的应用程序进行逆向工程会更容易吗?

It basically adds information for:它基本上添加了以下信息:

  • All non-public types, interfaces, structures, classes所有非公共类型、接口、结构、类
  • Local variables in functions函数中的局部变量
  • Source file names for relevant code and corresponding line numbers in source code.相关代码的源文件名和源代码中相应的行号。

which all combined makes reverse engineering very easy for native code.所有这些结合起来使本机代码的逆向工程变得非常容易。

Luckily you can create a stripped down version of your PDB files which only contains public information with /PDBSTRIPPED parameter.幸运的是,您可以创建 PDB 文件的精简版本,该版本仅包含带有/PDBSTRIPPED参数的公共信息。

Oh you edited to add C#/.NET, so I'm not sure if "PDBSTRIPPED" is applicable.哦,您编辑添加了 C#/.NET,所以我不确定“PDBSTRIPPED”是否适用。 However .NET applications are very easy to reverse engineer even without any symbol information.然而,即使没有任何符号信息,.NET 应用程序也很容易进行逆向工程 I wouldn't mind including them in a .NET project.我不介意将它们包含在 .NET 项目中。

您可以尝试使用dia2dump查看内容。

The managed .pdb files contain the following information:托管 .pdb 文件包含以下信息:

  • The names of all local variables所有局部变量的名称
  • The names of all source code files and the mapping from IL instructions onto lines within those files.所有源代码文件的名称以及从 IL 指令到这些文件中的行的映射。

Everything else is contained in the binary itself, including the names of all types, members and function arguments.其他所有内容都包含在二进制文件本身中,包括所有类型、成员和函数参数的名称。

Source: PDB files: what every developer must know .来源: PDB 文件:每个开发人员必须知道的内容

The PDB-files also include all comments of your source files. PDB 文件还包括源文件的所有注释。 So with EXE AND PDB-file it is possible to generate a 1:1-copy from your original source code.因此,使用 EXE 和 PDB 文件,可以从原始源代码生成 1:1 副本。

Newer .Net compiler versions can embed the full source code with all comments in the PDB file.较新的 .Net 编译器版本可以在 PDB 文件中嵌入带有所有注释完整源代码

The free JetBrains dotPeek decompiler uses this Blob to show the decompiled code.免费的JetBrains dotPeek反编译器使用这个 Blob 来显示反编译的代码。 Check Assembly -> Metadata -> Portable PDB Metadata -> CustomDebugInformation -> Kind: guid 0003 0E8A571B-6926-466E-B4AD-8AB04611F5FE (Embedded Source).检查程序集 -> 元数据 -> 便携式 PDB 元数据 -> CustomDebugInformation -> 种类:guid 0003 0E8A571B-6926-466E-B4AD-8AB04611F5FE(嵌入式源)。

This is documented here: https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#EmbeddedSource这在此处记录: https : //github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#EmbeddedSource

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM