PDB Symbol File

1. Symbol File

Symbol file contains debugging information such as publics and exports, symbols, type information, source and line numbers. In early days, those debugging information was embedded in EXE file, but can be stripped out into .DBG file. These days almost all symbol files are *.PDB files. PDB (stands for Program DataBase) file is a separate symbol file from the EXE or DLL file.

Typically Visual Studio or msbuild automatically generates *.PDB file along with EXE or DLL file. PDB file will be newly generated when new EXE or DLL is built. And one should always use exactly matching PDB file for the executable. If the executable is Debug build, PDB file will contain more debugging information. And if it is Release build, build tool still will generate PDB file but with limited debugging information. So whenever possible, use PDB from debug build. It will be way better than release PDB.

2. Symbol Path

The first thing to do in WinDbg debugging is to set symbol path. Symbol path is a list of path that is used for looking for correct symbol file. Symbol path can be set in WinDbg UI, by using .sympath WinDbg command or by setting _NT_SYMBOL_PATH environment variable. Each path is separated by semicolon.
For example, if an application MyApp.exe and its MyApp.pdb files are in C:\MyApp and some DLLs are in C:\Common, one can set symbol path as follows.

Symbol path also can include symbol servers. Symbol server is the server that has symbol files and it can be built as file server or even as external HTTP server. Symbol server organizes symbol files in symbol store which is indexed collection of symbol files. In order to add symbol store to symbol path, special syntax "srv*" is used. For example, in addition to local disk C:\MyApp, if we need to search symbols in file server \\server\share and http://symbols.company.com, symbol path will be:


* in srv is a separator, just like semicolon in PATH is a separator.

One thing to remember is WinDbg search from left to right of the symbol path, and if it finds symbol file on the right, it copies the symbol file to all of the left symbol stores. For example, if a symbol file is found in http://symbols.company.com, the symbol file is copied to \\server\share and C:\MyApp. Since http protocol does not allow file copy, typically http symbol store is placed at the end.

As a side note if one does not want to copy symbol files locally, symbol path can be


3. Microsoft Symbol Store

Microsoft provides public symbol store and its URL is https://msdl.microsoft.com/download/symbols (Please note that msdl link above is not accessible from browser. Meant to be accessed by debugger)
Microsoft Symbol Store contains Windows symbols which are very useful for debugging.

Typically one can cache MS symbols as below, which is common practice.


However, if one uses simply "srv*" in symbol path, the sympath will be expanded as below and symbols are cached to %ProgramData% folder.


4. ".sympath" command

Symbol path should be set either from WinDbg UI (File/Symbol File Path menu) or .sympath command. Here is an example of setting symbol path with .sympath command when C:\MyApp folder has symbol files. Any Microsoft symbols will be cached to C:\symbols folder.

    .sympath C:\MyApp;srv*C:\symbols*https://msdl.microsoft.com/download/symbols