diff options
author | Rui Ueyama <ruiu@google.com> | 2016-06-03 20:48:51 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-06-03 20:48:51 +0000 |
commit | fd97bf1f766550b1fefebbdf8aa29c2e8649fd3d (patch) | |
tree | fd4159f3f9245f2f8b201975021e71d982184bb1 /llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | |
parent | bc929e47659dcf318641892f44f424e07e1bc051 (diff) | |
download | llvm-fd97bf1f766550b1fefebbdf8aa29c2e8649fd3d.zip llvm-fd97bf1f766550b1fefebbdf8aa29c2e8649fd3d.tar.gz llvm-fd97bf1f766550b1fefebbdf8aa29c2e8649fd3d.tar.bz2 |
pdbdump: print out TPI hashes.
Differential Revision: http://reviews.llvm.org/D20945
llvm-svn: 271736
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp index 74a0427..8b9b7c8 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -11,11 +11,13 @@ #include "llvm/DebugInfo/CodeView/CodeView.h" #include "llvm/DebugInfo/CodeView/StreamReader.h" +#include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/Raw/PDBFile.h" #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" #include "llvm/DebugInfo/PDB/Raw/RawError.h" +#include "llvm/DebugInfo/PDB/Raw/RawTypes.h" #include "llvm/Support/Endian.h" @@ -99,20 +101,23 @@ Error TpiStream::reload() { return EC; // Hash indices, hash values, etc come from the hash stream. - MappedBlockStream HS(Header->HashStreamIndex, Pdb); - codeview::StreamReader HSR(HS); + HashStream.reset(new MappedBlockStream(Header->HashStreamIndex, Pdb)); + codeview::StreamReader HSR(*HashStream); + uint32_t NumHashValues = Header->HashValueBuffer.Length / sizeof(ulittle32_t); HSR.setOffset(Header->HashValueBuffer.Off); - if (auto EC = - HSR.readStreamRef(HashValuesBuffer, Header->HashValueBuffer.Length)) + if (auto EC = HSR.readArray(HashValues, NumHashValues)) return EC; - HSR.setOffset(Header->HashAdjBuffer.Off); - if (auto EC = HSR.readStreamRef(HashAdjBuffer, Header->HashAdjBuffer.Length)) + HSR.setOffset(Header->IndexOffsetBuffer.Off); + uint32_t NumTypeIndexOffsets = + Header->IndexOffsetBuffer.Length / sizeof(TypeIndexOffset); + if (auto EC = HSR.readArray(TypeIndexOffsets, NumTypeIndexOffsets)) return EC; - HSR.setOffset(Header->IndexOffsetBuffer.Off); - if (auto EC = HSR.readStreamRef(TypeIndexOffsetBuffer, - Header->IndexOffsetBuffer.Length)) + HSR.setOffset(Header->HashAdjBuffer.Off); + uint32_t NumHashAdjustments = + Header->HashAdjBuffer.Length / sizeof(TypeIndexOffset); + if (auto EC = HSR.readArray(HashAdjustments, NumHashAdjustments)) return EC; return Error::success(); @@ -139,6 +144,21 @@ uint16_t TpiStream::getTypeHashStreamAuxIndex() const { return Header->HashAuxStreamIndex; } +codeview::FixedStreamArray<support::ulittle32_t> +TpiStream::getHashValues() const { + return HashValues; +} + +codeview::FixedStreamArray<TypeIndexOffset> +TpiStream::getTypeIndexOffsets() const { + return TypeIndexOffsets; +} + +codeview::FixedStreamArray<TypeIndexOffset> +TpiStream::getHashAdjustments() const { + return HashAdjustments; +} + iterator_range<codeview::CVTypeArray::Iterator> TpiStream::types(bool *HadError) const { return llvm::make_range(TypeRecords.begin(HadError), TypeRecords.end()); |