diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h | 2 | ||||
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Raw/RawConstants.h | 15 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp | 12 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-headers.test | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp | 22 |
5 files changed, 53 insertions, 2 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h b/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h index 1ff5c3fcfef..33ac97a6553 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/DbiStream.h @@ -51,6 +51,8 @@ public: ArrayRef<ModuleInfoEx> modules() const; + uint32_t getDebugStreamIndex(DbgHeaderType Type) const; + private: Error initializeFileInfo(); diff --git a/llvm/include/llvm/DebugInfo/PDB/Raw/RawConstants.h b/llvm/include/llvm/DebugInfo/PDB/Raw/RawConstants.h index 5e087136fc3..5c512f156f4 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Raw/RawConstants.h +++ b/llvm/include/llvm/DebugInfo/PDB/Raw/RawConstants.h @@ -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 diff --git a/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp index 2cc2a73a0d1..6b5cd212ed9 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/DbiStream.cpp @@ -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)]; +} diff --git a/llvm/test/DebugInfo/PDB/pdbdump-headers.test b/llvm/test/DebugInfo/PDB/pdbdump-headers.test index 84b698af106..37d9ccf0f29 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-headers.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-headers.test @@ -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) diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp index 423ff7b6745..fb52ebf5113 100644 --- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp +++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -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); |