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

前端 未结 5 1487
暖寄归人
暖寄归人 2020-12-30 02:36

Is is wise to redistribute the pdb files along with a commercial application?

Occasionally, I\'m using the stack trace to get a more detailed error reporting logs fr

相关标签:
5条回答
  • 2020-12-30 02:42

    The managed .pdb files contain the following information:

    • The names of all local variables
    • The names of all source code files and the mapping from IL instructions onto lines within those files.

    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.

    0 讨论(0)
  • 2020-12-30 02:47

    You could try using dia2dump to look at the contents.

    0 讨论(0)
  • 2020-12-30 02:51

    The PDB-files also include all comments of your source files. So with EXE AND PDB-file it is possible to generate a 1:1-copy from your original source code.

    0 讨论(0)
  • 2020-12-30 03:00

    Newer .Net compiler versions can embed the full source code with all comments in the PDB file.

    The free JetBrains dotPeek decompiler uses this Blob to show the decompiled code. Check Assembly -> Metadata -> Portable PDB Metadata -> CustomDebugInformation -> Kind: guid 0003 0E8A571B-6926-466E-B4AD-8AB04611F5FE (Embedded Source).

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

    0 讨论(0)
  • 2020-12-30 03:03

    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.

    Oh you edited to add C#/.NET, so I'm not sure if "PDBSTRIPPED" is applicable. However .NET applications are very easy to reverse engineer even without any symbol information. I wouldn't mind including them in a .NET project.

    0 讨论(0)
提交回复
热议问题