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

5

21

Is it 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 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?

Outstare answered 27/2, 2009 at 20:22 Comment(1)
It would help if you specified which environment you're using. Lots of dev tools output PDB files.Lynxeyed
S
13

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.

Strickler answered 27/2, 2009 at 20:42 Comment(0)
J
4

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.

Jara answered 13/12, 2011 at 14:27 Comment(0)
N
3

You could try using dia2dump to look at the contents.

Namedropper answered 17/6, 2009 at 16:18 Comment(0)
L
2

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

Laity answered 4/10, 2020 at 16:20 Comment(0)
E
0

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.

Electrometallurgy answered 3/8, 2018 at 13:9 Comment(5)
I don't think so. The comments are not in pdb files neither you can generate 1:1 copy from pdb without the source files.Forcible
If you open the PDB file in a hex editor, you can determine that comments are not found there.Swainson
@Swainson You have to unzip the PDBElectrometallurgy
@Electrometallurgy I don't know if your PDB files differ from mine, but the PDB files that C# generates when building code for me, are not zip files.Swainson
@Swainson your right, I mixed it yesterday with dacpac files, they have nothing todo with pdbs. So i can't remeber from where I got the idea I posted in this topic.Electrometallurgy

© 2022 - 2024 — McMap. All rights reserved.