PDB Files: What Every Developer Must Know

pdb 文件里保存有二进制文件和源代码的映射关系

pdb文件 和 二进制文件 , 在编译时会写入同一个 GUID, debuger使用这个是 GUID来判定 pdb 和 exe,dll 是否匹配, 匹配的话就可以跳转源代码

pdb 的查找顺序

  1. a.exe 的同级目录里的 a.pdb
  2. if not match,会使用 a.exe 的文件头里记录的 pdb文件地址
  3. if not match, use symbol server local cache dir
  4. if not match, download from symbol server

c++ pdb file

  • Public, private, and static function addresses
  • Global variable names and addresses
  • Parameter and local variable names and offsets where to find them on the stack
  • Type data consisting of class, structure, and data definitions
  • Frame Pointer Omission (FPO) data, which is the key to native stack walking on x86
  • Source file names and their lines