Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use PDB files

I have heard using PDB files can help diagnose where a crash occurred.
My basic understanding is that you give Visual studio the source file, the pdb file and the crash information (from Dr Watson?)
Can someone please explain how it all works / what is involved? (Thank you!)

like image 523
hamishmcn Avatar asked Sep 16 '08 13:09

hamishmcn


People also ask

What do I do with PDB files?

pdb file holds debugging and project state information that allows incremental linking of a Debug configuration of your app. The Visual Studio debugger uses . pdb files to determine two key pieces of information while debugging: The source file name and line number to display in the Visual Studio IDE.

How do I open PDB files?

Click "File" and select "Open File" > "PDB File". Select the file, and click "Load". The 3D view of the structure you have uploaded will now be displayed.

Do I need a PDB file?

You don't need them to run. pdb files can be used to debug even if the build is on release configuration.


2 Answers

PDB files map an assembly's MSIL to the original source lines. This means that if you put the PDB that was compiled with the assembly in the same directory as the assembly, your exception stack traces will have the names and lines of the positions in the original source files. Without the PDB file, you will only see the name of the class and method for each level of the stack trace.

like image 143
Omer van Kloeten Avatar answered Oct 03 '22 09:10

Omer van Kloeten


PDB files are generated when you build your project. They contain information relating to the built binaries which Visual Studio can interpret.

When a program crashes and it generates a crash report, Visual Studio is able to take that report and link it back to the source code via the PDB file for the application. PDB files must be built from the same binary that generated the crash report!

There are some issues that we have encountered over time.

  • The machine that is debugging the crash report needs to have the source on the same path as the machine that built the binary.
  • Release builds often optimize to the extent where you cannot view the state of object member variables

If anyone knows how to defeat the former, I would be grateful for some input.

like image 32
roo Avatar answered Oct 03 '22 11:10

roo