diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/GlobalsStream.cpp | 13 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-global-lookup.test | 12 |
2 files changed, 20 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); diff --git a/llvm/test/DebugInfo/PDB/pdbdump-global-lookup.test b/llvm/test/DebugInfo/PDB/pdbdump-global-lookup.test index 37309f20520..18a6f18101c 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-global-lookup.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-global-lookup.test @@ -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 |