Search code examples
debuggingcrashpdb-files

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!)


Solution

  • 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.