summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-10-08 22:38:27 +0000
committerZachary Turner <zturner@google.com>2018-10-08 22:38:27 +0000
commitc8207fa59ba19d63b1356d489028b5ec0bf6eafd (patch)
tree2f176bacf1677593c79ff96d2793b822bc8276b4 /llvm/lib/DebugInfo/PDB/Native
parentbc1cd929bf9f4a65911c85bdc45b51a5ad6d5449 (diff)
downloadbcm5719-llvm-c8207fa59ba19d63b1356d489028b5ec0bf6eafd.tar.gz
bcm5719-llvm-c8207fa59ba19d63b1356d489028b5ec0bf6eafd.zip
[PDB] fix a bug in global stream name lookup.
When we're looking up a record in the last hash bucket chain, we need to be careful with the end-offset calculation. llvm-svn: 344001
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
index 529f6703789..d76852be08a 100644
--- a/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
@@ -57,13 +57,16 @@ GlobalsStream::findRecordsByName(StringRef Name,
return Result;
uint32_t ChainStartOffset = GlobalsTable.HashBuckets[CompressedBucketIndex];
- uint32_t NextChainStart = GlobalsTable.HashBuckets.size();
- if (static_cast<uint32_t>(CompressedBucketIndex + 1) < NextChainStart)
- NextChainStart = GlobalsTable.HashBuckets[CompressedBucketIndex + 1];
+ uint32_t NextChainOffset = GlobalsTable.HashBuckets.size() * 12;
+ uint32_t LastBucketIndex = GlobalsTable.HashBuckets.size() - 1;
+ if (static_cast<uint32_t>(CompressedBucketIndex) < LastBucketIndex) {
+ NextChainOffset = GlobalsTable.HashBuckets[CompressedBucketIndex + 1];
+ }
ChainStartOffset /= 12;
- NextChainStart /= 12;
+ NextChainOffset /= 12;
- while (ChainStartOffset < NextChainStart) {
+ auto &Back = GlobalsTable.HashRecords.back();
+ while (ChainStartOffset < NextChainOffset) {
PSHashRecord PSH = GlobalsTable.HashRecords[ChainStartOffset];
uint32_t Off = PSH.Off - 1;
codeview::CVSymbol Record = Symbols.readRecord(Off);
OpenPOWER on IntegriCloud