[llvm-pdbdump] Decipher the remaining PDB streams.

We know at least know the meaning of every stream of the
PDB file.  Yay!

llvm-svn: 270669
This commit is contained in:
Zachary Turner 2016-05-25 05:49:48 +00:00
parent 546e64affd
commit d3076ab36f
5 changed files with 53 additions and 2 deletions

View File

@ -51,6 +51,8 @@ public:
ArrayRef<ModuleInfoEx> modules() const;
uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
private:
Error initializeFileInfo();

View File

@ -51,6 +51,21 @@ enum SpecialStream : uint32_t {
StreamIPI = 4,
};
enum class DbgHeaderType : uint16_t {
FPO,
Exception,
Fixup,
OmapToSrc,
OmapFromSrc,
SectionHdr,
TokenRidMap,
Xdata,
Pdata,
NewFPO,
SectionHdrOrig,
Max
};
} // end namespace pdb
} // end namespace llvm

View File

@ -302,3 +302,15 @@ Error DbiStream::initializeFileInfo() {
return Error::success();
}
uint32_t DbiStream::getDebugStreamIndex(DbgHeaderType Type) const {
ArrayRef<uint8_t> DbgData;
if (auto EC = DbgHeader.getArrayRef(0, DbgData, DbgHeader.getLength())) {
consumeError(std::move(EC));
return uint32_t(-1);
}
ArrayRef<ulittle16_t> DebugStreams(
reinterpret_cast<const ulittle16_t *>(DbgData.data()),
DbgData.size() / sizeof(ulittle16_t));
return DebugStreams[static_cast<uint16_t>(Type)];
}

View File

@ -29,8 +29,8 @@
; EMPTY-NEXT: Stream 7: [Public Symbol Hash] (604 bytes)
; EMPTY-NEXT: Stream 8: [Public Symbol Records] (104 bytes)
; EMPTY-NEXT: Stream 9: [Named Stream "/src/headerblock"] (0 bytes)
; EMPTY-NEXT: Stream 10: [???] (160 bytes)
; EMPTY-NEXT: Stream 11: [???] (32 bytes)
; EMPTY-NEXT: Stream 10: [Section Header Data] (160 bytes)
; EMPTY-NEXT: Stream 11: [New FPO Data] (32 bytes)
; EMPTY-NEXT: Stream 12: [Module "d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj"] (308 bytes)
; EMPTY-NEXT: Stream 13: [Named Stream "/names"] (239 bytes)
; EMPTY-NEXT: Stream 14: [Module "* Linker *"] (520 bytes)

View File

@ -272,6 +272,28 @@ static Error dumpStreamSummary(ScopedPrinter &P, PDBFile &File) {
Value = "IPI Hash";
else if (StreamIdx == TIS.getTypeHashStreamAuxIndex())
Value = "IPI Aux Hash";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::Exception))
Value = "Exception Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::Fixup))
Value = "Fixup Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::FPO))
Value = "FPO Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::NewFPO))
Value = "New FPO Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::OmapFromSrc))
Value = "Omap From Source Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::OmapToSrc))
Value = "Omap To Source Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::Pdata))
Value = "Pdata";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::SectionHdr))
Value = "Section Header Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::SectionHdrOrig))
Value = "Section Header Original Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::TokenRidMap))
Value = "Token Rid Data";
else if (StreamIdx == DS.getDebugStreamIndex(DbgHeaderType::Xdata))
Value = "Xdata";
else {
auto ModIter = ModStreams.find(StreamIdx);
auto NSIter = NamedStreams.find(StreamIdx);