[llvm] r270669 - [llvm-pdbdump] Decipher the remaining PDB streams.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue May 24 22:49:49 PDT 2016
Author: zturner
Date: Wed May 25 00:49:48 2016
New Revision: 270669
URL: http://llvm.org/viewvc/llvm-project?rev=270669&view=rev
Log:
[llvm-pdbdump] Decipher the remaining PDB streams.
We know at least know the meaning of every stream of the
PDB file. Yay!
Modified:
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h
llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp
llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h?rev=270669&r1=270668&r2=270669&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h Wed May 25 00:49:48 2016
@@ -51,6 +51,8 @@ public:
ArrayRef<ModuleInfoEx> modules() const;
+ uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
+
private:
Error initializeFileInfo();
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h?rev=270669&r1=270668&r2=270669&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h Wed May 25 00:49:48 2016
@@ -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
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp?rev=270669&r1=270668&r2=270669&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp Wed May 25 00:49:48 2016
@@ -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)];
+}
Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test?rev=270669&r1=270668&r2=270669&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test Wed May 25 00:49:48 2016
@@ -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)
Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=270669&r1=270668&r2=270669&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Wed May 25 00:49:48 2016
@@ -272,6 +272,28 @@ static Error dumpStreamSummary(ScopedPri
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);
More information about the llvm-commits
mailing list