summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-04-11 16:26:15 +0000
committerReid Kleckner <rnk@google.com>2017-04-11 16:26:15 +0000
commit6e545ffc4e99b16cab6494eba21dd3b6cf06ee68 (patch)
tree90459834c4fa5cc9175e13e308fe91ddb246c659 /llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
parent83d37dc0662ceb4489fceda0d3044a08ef5a6159 (diff)
downloadbcm5719-llvm-6e545ffc4e99b16cab6494eba21dd3b6cf06ee68.tar.gz
bcm5719-llvm-6e545ffc4e99b16cab6494eba21dd3b6cf06ee68.zip
[PDB] Emit index/offset pairs for TPI and IPI streams
Summary: This lets PDB readers lookup type record data by type index in O(log n) time. It also enables makes `cvdump -t` work on PDBs produced by LLD. cvdump will not dump a PDB that doesn't have an index-to-offset table. The table is sorted by type index, and has an entry every 8KB. Looking up a type record by index is a binary search of this table, followed by a scan of at most 8KB. Reviewers: ruiu, zturner, inglorion Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31636 llvm-svn: 299958
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
index ee4c3af8484..5fef3edf8c2 100644
--- a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp
@@ -95,9 +95,10 @@ Error TpiStream::reload() {
Pdb.getMsfLayout(), Pdb.getMsfBuffer(), Header->HashStreamIndex);
BinaryStreamReader HSR(*HS);
+ // There should be a hash value for every type record, or no hashes at all.
uint32_t NumHashValues =
Header->HashValueBuffer.Length / sizeof(ulittle32_t);
- if (NumHashValues != NumTypeRecords())
+ if (NumHashValues != NumTypeRecords() && NumHashValues != 0)
return make_error<RawError>(
raw_error_code::corrupt_file,
"TPI hash count does not match with the number of type records.");
@@ -124,8 +125,9 @@ Error TpiStream::reload() {
// TPI hash table is a parallel array for the type records.
// Verify that the hash values match with type records.
- if (auto EC = verifyHashValues())
- return EC;
+ if (NumHashValues > 0)
+ if (auto EC = verifyHashValues())
+ return EC;
}
return Error::success();
OpenPOWER on IntegriCloud