[llvm] r344001 - [PDB] fix a bug in global stream name lookup.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 8 15:38:27 PDT 2018
Author: zturner
Date: Mon Oct 8 15:38:27 2018
New Revision: 344001
URL: http://llvm.org/viewvc/llvm-project?rev=344001&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp?rev=344001&r1=344000&r2=344001&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp Mon Oct 8 15:38:27 2018
@@ -57,13 +57,16 @@ GlobalsStream::findRecordsByName(StringR
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);
Modified: llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test?rev=344001&r1=344000&r2=344001&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test Mon Oct 8 15:38:27 2018
@@ -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
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
More information about the llvm-commits
mailing list