Skip to content

Commit cfb4e78

Browse files
committed
Revert "[llvm-pdbutil] Add options to only dump symbol record at specified offset and its parents or children with spcified depth."
This reverts commit a3b7cb0. symbol-offset.test fails under MSAN: [ 1] ; RUN: llvm-pdbutil yaml2pdb %p/Inputs/symbol-offset.yaml --pdb=%t.pdb [FAIL] llvm-pdbutil yaml2pdb <REDACTED>/llvm/test/tools/llvm-pdbutil/Inputs/symbol-offset.yaml --pdb=<REDACTED>/tmp/symbol-offset.test/symbol-offset.test.tmp.pdb ==9283==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x55f975e5eb91 in __libcpp_tls_set <REDACTED>/include/c++/v1/__threading_support:428:12 #1 0x55f975e5eb91 in set_pointer <REDACTED>/include/c++/v1/thread:196:5 #2 0x55f975e5eb91 in void* std::__msan::__thread_proxy<std::__msan::tuple<std::__msan::unique_ptr<std::__msan::__thread_struct, std::__msan::default_delete<std::__msan::__thread_struct> >, llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()::operator()() const::'lambda'()> >(void*) <REDACTED>/include/c++/v1/thread:285:27 #3 0x7f74a1e55b54 in start_thread (<REDACTED>/libpthread.so.0+0xbb54) (BuildId: 64752de50ebd1a108f4b3f8d0d7e1a13) #4 0x7f74a1dc9f7e in clone (<REDACTED>/libc.so.6+0x13cf7e) (BuildId: 7cfed7708e5ab7fcb286b373de21ee76)
1 parent dcb2ddd commit cfb4e78

File tree

10 files changed

+8
-516
lines changed

10 files changed

+8
-516
lines changed

llvm/include/llvm/DebugInfo/CodeView/CVSymbolVisitor.h

-8
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,12 @@ class SymbolVisitorCallbacks;
1818

1919
class CVSymbolVisitor {
2020
public:
21-
struct FilterOptions {
22-
llvm::Optional<uint32_t> SymbolOffset;
23-
llvm::Optional<uint32_t> ParentRecursiveDepth;
24-
llvm::Optional<uint32_t> ChildRecursiveDepth;
25-
};
26-
2721
CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
2822

2923
Error visitSymbolRecord(CVSymbol &Record);
3024
Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
3125
Error visitSymbolStream(const CVSymbolArray &Symbols);
3226
Error visitSymbolStream(const CVSymbolArray &Symbols, uint32_t InitialOffset);
33-
Error visitSymbolStreamFiltered(const CVSymbolArray &Symbols,
34-
const FilterOptions &Filter);
3527

3628
private:
3729
SymbolVisitorCallbacks &Callbacks;

llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ Error iterateSymbolGroups(InputFile &Input, const PrintScope &HeaderScope,
180180
AutoIndent Indent(HeaderScope);
181181

182182
FilterOptions Filters = HeaderScope.P.getFilters();
183-
if (Filters.DumpModi) {
184-
uint32_t Modi = Filters.DumpModi.getValue();
183+
if (Filters.NumOccurrences) {
184+
uint32_t Modi = Filters.DumpModi;
185185
SymbolGroup SG(&Input, Modi);
186186
return iterateOneModule(Input, withLabelWidth(HeaderScope, NumDigits(Modi)),
187187
SG, Modi, Callback);

llvm/include/llvm/DebugInfo/PDB/Native/LinePrinter.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ struct FilterOptions {
3030
std::list<std::string> IncludeCompilands;
3131
uint32_t PaddingThreshold;
3232
uint32_t SizeThreshold;
33-
llvm::Optional<uint32_t> DumpModi;
34-
llvm::Optional<uint32_t> ParentRecurseDepth;
35-
llvm::Optional<uint32_t> ChildrenRecurseDepth;
36-
llvm::Optional<uint32_t> SymbolOffset;
33+
uint32_t DumpModi;
34+
uint32_t NumOccurrences;
3735
bool JustMyCode;
3836
};
3937

llvm/include/llvm/Support/BinaryStreamArray.h

-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ class VarStreamArray {
111111

112112
bool valid() const { return Stream.valid(); }
113113

114-
bool isOffsetValid(uint32_t Offset) const { return at(Offset) != end(); }
115-
116114
uint32_t skew() const { return Skew; }
117115
Iterator end() const { return Iterator(E); }
118116

llvm/lib/DebugInfo/CodeView/CVSymbolVisitor.cpp

-72
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "llvm/DebugInfo/CodeView/CodeView.h"
1212
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
13-
#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
1413
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
1514
#include "llvm/Support/BinaryStreamArray.h"
1615
#include "llvm/Support/ErrorHandling.h"
@@ -84,74 +83,3 @@ Error CVSymbolVisitor::visitSymbolStream(const CVSymbolArray &Symbols,
8483
}
8584
return Error::success();
8685
}
87-
88-
Error CVSymbolVisitor::visitSymbolStreamFiltered(const CVSymbolArray &Symbols,
89-
const FilterOptions &Filter) {
90-
if (!Filter.SymbolOffset)
91-
return visitSymbolStream(Symbols);
92-
uint32_t SymbolOffset = *Filter.SymbolOffset;
93-
uint32_t ParentRecurseDepth =
94-
Filter.ParentRecursiveDepth ? *Filter.ParentRecursiveDepth : 0;
95-
uint32_t ChildrenRecurseDepth =
96-
Filter.ChildRecursiveDepth ? *Filter.ChildRecursiveDepth : 0;
97-
if (!Symbols.isOffsetValid(SymbolOffset))
98-
return createStringError(inconvertibleErrorCode(), "Invalid symbol offset");
99-
CVSymbol Sym = *Symbols.at(SymbolOffset);
100-
uint32_t SymEndOffset =
101-
symbolOpensScope(Sym.kind()) ? getScopeEndOffset(Sym) : 0;
102-
103-
std::vector<uint32_t> ParentOffsets;
104-
std::vector<uint32_t> ParentEndOffsets;
105-
uint32_t ChildrenDepth = 0;
106-
for (auto Begin = Symbols.begin(), End = Symbols.end(); Begin != End;
107-
++Begin) {
108-
uint32_t BeginOffset = Begin.offset();
109-
CVSymbol BeginSym = *Begin;
110-
if (BeginOffset < SymbolOffset) {
111-
if (symbolOpensScope(Begin->kind())) {
112-
uint32_t EndOffset = getScopeEndOffset(BeginSym);
113-
if (SymbolOffset < EndOffset) {
114-
ParentOffsets.push_back(BeginOffset);
115-
ParentEndOffsets.push_back(EndOffset);
116-
}
117-
}
118-
} else if (BeginOffset == SymbolOffset) {
119-
// Found symbol at offset. Visit its parent up to ParentRecurseDepth.
120-
if (ParentRecurseDepth >= ParentOffsets.size())
121-
ParentRecurseDepth = ParentOffsets.size();
122-
uint32_t StartIndex = ParentOffsets.size() - ParentRecurseDepth;
123-
while (StartIndex < ParentOffsets.size()) {
124-
if (!Symbols.isOffsetValid(ParentOffsets[StartIndex]))
125-
break;
126-
CVSymbol Parent = *Symbols.at(ParentOffsets[StartIndex]);
127-
if (auto EC = visitSymbolRecord(Parent, ParentOffsets[StartIndex]))
128-
return EC;
129-
++StartIndex;
130-
}
131-
if (auto EC = visitSymbolRecord(Sym, SymbolOffset))
132-
return EC;
133-
} else if (BeginOffset <= SymEndOffset) {
134-
if (ChildrenRecurseDepth) {
135-
// Visit children.
136-
if (symbolEndsScope(Begin->kind()))
137-
--ChildrenDepth;
138-
if (ChildrenDepth < ChildrenRecurseDepth ||
139-
BeginOffset == SymEndOffset) {
140-
if (auto EC = visitSymbolRecord(BeginSym, BeginOffset))
141-
return EC;
142-
}
143-
if (symbolOpensScope(Begin->kind()))
144-
++ChildrenDepth;
145-
}
146-
} else {
147-
// Visit parents' ends.
148-
if (ParentRecurseDepth && BeginOffset == ParentEndOffsets.back()) {
149-
if (auto EC = visitSymbolRecord(BeginSym, BeginOffset))
150-
return EC;
151-
ParentEndOffsets.pop_back();
152-
--ParentRecurseDepth;
153-
}
154-
}
155-
}
156-
return Error::success();
157-
}

llvm/lib/DebugInfo/PDB/Native/InputFile.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ bool llvm::pdb::shouldDumpSymbolGroup(uint32_t Idx, const SymbolGroup &Group,
579579
return false;
580580

581581
// If the arg was not specified on the command line, always dump all modules.
582-
if (!Filters.DumpModi)
582+
if (Filters.NumOccurrences == 0)
583583
return true;
584584

585585
// Otherwise, only dump if this is the same module specified.

llvm/test/tools/llvm-pdbutil/Inputs/symbol-offset.yaml

-204
This file was deleted.

0 commit comments

Comments
 (0)