Microsoft Open Sources PDB
PDB or Program DataBase is a central component of the Windows ecosystem. Without a PDB file, even basic tasks such as stepping through code becomes impossible. And yet, the PDB format is largely a black box. At least until now.
Over the last few years, Microsoft has released public APIs that allow developers to query the PDB files directly. Jim Hogg of Microsoft cites three articles in particular to start with:
- Description of PDB files: https://support.microsoft.com/en-us/kb/121366
- Querying the PDB: https://msdn.microsoft.com/en-us/library/eee38t3h.aspx
- Debug Interface Access SDK: https://msdn.microsoft.com/en-us/library/x93ctkx8(VS.80).aspx
While certainly useful, they aren’t enough for those writing compilers and linkers such as the CLANG/LLVM community. They need to know how to create new PDB files, which requires a deeper understanding of the file format.
To address this situation, Microsoft has released much of the code needed to read and write PDB files under the MIT license. This code cannot be directly compiled, as it lacks the necessary build files. The intention is that developers will read, and possibly reuse, just parts of the code that they need. If you instead want a turn-key solution, Microsoft recommends continuing to use the published APIs.
Jim Hogg writes,
The PDB format is complicated. We’re not sure whether the files uploaded so far provide all the details you might need. If you have brief questions, please post them as comments to this blog. But for issues (eg: I need to view the header that defines the XXX struct), please file them directly on the GitHub project so we can track and respond.
Typo in the article.