This is an archive of the discontinued LLVM Phabricator instance.

Refactor some more PDB reading code into DebugInfoPDB
ClosedPublic

Authored by zturner on Apr 22 2016, 3:53 PM.

Details

Summary

The code that reads the name map and the pdb header information was still lingering in llvm-pdbdump.

The NameMap, it turns out, is a common data structure used in other places in the PDB file as well. So the ability to parse a name map out of a PDB file will be useful for us down the line. So I abstracted that into a PDBNameMap class. It's very simple right now, but at least it can be re-used on an arbitrary stream.

I'm also moving towards an approach where we have concrete implementations of each stream type that provides friendly class-like access to the fields of different streams. The basic layout and format of which streams are what is described here [https://github.com/Microsoft/microsoft-pdb/]. Currently llvm-pdbdump has only attempted to parse data out of Stream 1 -- called the PDB Stream -- so I made a class called PDBInfoStream which provides convenient access to fields of the PDB stream. In the future we would probably add PDBDbiStream, and PDBModuleStream, etc.

This patch loses some of the output of llvm-pdbdump -dump-headers, because previously it was dumping every entry in the name map. And now that the name map parsing is handled separately, I felt it wasn't important to print so much detail anymore. Let me know if you disagree.

Diff Detail

Event Timeline

zturner updated this revision to Diff 54743.Apr 22 2016, 3:53 PM
zturner retitled this revision from to Refactor some more PDB reading code into DebugInfoPDB.
zturner updated this object.
zturner added reviewers: majnemer, rnk.
zturner added a subscriber: llvm-commits.
majnemer added inline comments.Apr 22 2016, 6:54 PM
include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h
40–51

It's a little unusual to have these be members be support::ulittle32_t. Instead, can you have them be uint32_t and initialize them via readInteger?

include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h
27

tryGetValue

lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
42

This cast can be removed if you make Version a uint32_t.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 7 2019, 7:04 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2019, 7:04 AM