| OOP-vs-IOP-vs-AOP :👈 | 👉:Debug and Release build |
PDB (Program Database) files |
What are PDBs?
PDB (Program Database) files are debugging symbol files generated by compilers such as the C# and C++ compilers in Visual Studio.
They contain information that maps the compiled executable code back to the original source code, including:
- Source file names
- Line numbers
- Method and variable names
- Data types
- Breakpoint locations
- Stack trace information
Example:
When your application throws an exception:
Without a PDB:
MyApp.exe + 0x1A3F2
With a PDB:
OrderService.ProcessOrder()
OrderService.cs : Line 125
Why are PDBs needed?
PDBs enable debugging features such as:
- Setting and hitting breakpoints
- Viewing local variables
- Stepping through code (F10/F11)
- Meaningful call stacks
- Source-level debugging
Without matching PDB files, Visual Studio can run the application but cannot accurately map machine code back to source code.
Where must PDBs be located?
The debugger must be able to find the matching PDB file for the assembly being debugged.
Common locations include:
1. Same folder as the assembly (most common)
bin\Debug\
MyApp.exe
MyApp.pdb
or
bin\Debug\
MyLibrary.dll
MyLibrary.pdb
Visual Studio automatically looks here first.
2. Symbol server
Organizations often publish PDBs to a symbol server:
https://symbols.company.com
or Microsoft's public symbol server:
https://msdl.microsoft.com/download/symbols
Visual Studio can download the symbols automatically.
3. Configured symbol paths
Visual Studio allows additional symbol locations:
Tools → Options → Debugging → Symbols
You can specify:
- Local folders
- Network shares
- Symbol servers
Important Requirement
The PDB must be created from the exact same build as the DLL or EXE being debugged.
For example:
MyLibrary.dll (Build #100)
MyLibrary.pdb (Build #100) ✅
works, but:
MyLibrary.dll (Build #100)
MyLibrary.pdb (Build #101) ❌
will result in:
Symbols not loaded
because the debugger verifies that the DLL and PDB timestamps/signatures match.
Interview Answer
A PDB (Program Database) file contains debugging symbols that map compiled code back to source code information such as method names, variables, and line numbers. Debuggers use PDB files to enable breakpoints, source-level stepping, and detailed stack traces. The PDB must match the exact build of the assembly and is typically located in the same folder as the EXE/DLL, on a symbol server, or in a symbol path configured in Visual Studio.
| OOP-vs-IOP-vs-AOP :👈 | 👉:Debug and Release build |