forked from OSchip/llvm-project
[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
This commit is contained in:
parent
bc1cd929bf
commit
c8207fa59b
|
@ -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);
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
; RUN: -global-name=abcdefg \
|
||||
; RUN: %p/Inputs/every-function.pdb | FileCheck %s
|
||||
|
||||
; This is a separate command line invocation because B::PureFunc
|
||||
; is special. It's in the last hash bucket, so it exercises a special
|
||||
; calculation path.
|
||||
; RUN: llvm-pdbutil dump -globals -global-name=B::PureFunc \
|
||||
; RUN: %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=PURE %s
|
||||
|
||||
CHECK: Global Symbols
|
||||
CHECK-NEXT: ============================================================
|
||||
CHECK-NEXT: Global Name `operator delete`
|
||||
|
@ -16,3 +22,9 @@ CHECK-NEXT: 2016 | S_PROCREF [size = 20] `main`
|
|||
CHECK-NEXT: module = 1, sum name = 0, offset = 1952
|
||||
CHECK-NEXT: Global Name `abcdefg`
|
||||
CHECK-NEXT: (no matching records found)
|
||||
|
||||
PURE: Global Symbols
|
||||
PURE-NEXT: ============================================================
|
||||
PURE-NEXT: Global Name `B::PureFunc`
|
||||
PURE-NEXT: 980 | S_PROCREF [size = 28] `B::PureFunc`
|
||||
PURE-NEXT: module = 1, sum name = 0, offset = 800
|
||||
|
|
Loading…
Reference in New Issue