68 using LVModules = std::vector<LVScope *>;
74 std::shared_ptr<llvm::pdb::InputFile> TypeServer;
75 std::shared_ptr<LazyRandomTypeCollection> PrecompHeader;
79 std::unique_ptr<MemoryBuffer> MemBuffer;
80 std::unique_ptr<llvm::pdb::IPDBSession> Session;
81 std::unique_ptr<llvm::pdb::NativeSession> PdbSession;
85 std::unique_ptr<AppendingTypeTableBuilder> Builder;
86 std::unique_ptr<BinaryItemStream<CVType>> ItemStream;
87 std::unique_ptr<BinaryStreamReader> ReaderPrecomp;
88 std::vector<CVType> TypeArray;
93 std::unique_ptr<MemoryBuffer> BinaryBuffer;
94 std::unique_ptr<llvm::object::Binary> BinaryExecutable;
101 bool IsComdat)
override;
105 bool isObj()
const {
return Input.isObj(); }
106 bool isPdb()
const {
return Input.isPdb(); }
112 int32_t CurrentModule = -1;
114 using RelocMapTy = DenseMap<
const llvm::object::coff_section *,
115 std::vector<llvm::object::RelocationRef>>;
120 LazyRandomTypeCollection &types() {
121 return TypeServer ? TypeServer->types()
122 : (PrecompHeader ? *PrecompHeader :
Input.types());
124 LazyRandomTypeCollection &ids() {
125 return TypeServer ? TypeServer->ids()
126 : (PrecompHeader ? *PrecompHeader :
Input.ids());
129 LVLogicalVisitor LogicalVisitor;
132 getFileNameForFileOffset(uint32_t FileOffset,
133 const llvm::pdb::SymbolGroup *SG =
nullptr);
134 void printRelocatedField(StringRef Label,
135 const llvm::object::coff_section *CoffSection,
136 uint32_t RelocOffset, uint32_t Offset,
137 StringRef *RelocSym);
139 Error printFileNameForOffset(StringRef Label, uint32_t FileOffset,
140 const llvm::pdb::SymbolGroup *SG =
nullptr);
142 Error loadPrecompiledObject(PrecompRecord &Precomp, CVTypeArray &CVTypesObj);
143 Error loadTypeServer(TypeServer2Record &TS);
144 Error traverseTypes(llvm::pdb::PDBFile &Pdb, LazyRandomTypeCollection &Types,
145 LazyRandomTypeCollection &Ids);
147 Error collectInlineeInfo(DebugInlineeLinesSubsectionRef &Lines,
148 const llvm::pdb::SymbolGroup *SG =
nullptr);
150 void cacheRelocations();
151 Error resolveSymbol(
const llvm::object::coff_section *CoffSection,
152 uint64_t Offset, llvm::object::SymbolRef &Sym);
153 Error resolveSymbolName(
const llvm::object::coff_section *CoffSection,
155 Error traverseTypeSection(StringRef SectionName,
156 const llvm::object::SectionRef &Section);
157 Error traverseSymbolSection(StringRef SectionName,
158 const llvm::object::SectionRef &Section);
159 Error traverseInlineeLines(StringRef Subsection);
161 DebugChecksumsSubsectionRef CVFileChecksumTable;
162 DebugStringTableSubsectionRef CVStringTable;
164 Error traverseSymbolsSubsection(StringRef Subsection,
165 const llvm::object::SectionRef &Section,
166 StringRef SectionContents);
171 Error initializeFileAndStringTables(BinaryStreamReader &Reader);
173 Error createLines(
const FixedStreamArray<LineNumberEntry> &LineNumbers,
174 LVAddress Addendum, uint32_t Segment, uint32_t Begin,
175 uint32_t Size, uint32_t NameIndex,
176 const llvm::pdb::SymbolGroup *SG =
nullptr);
177 Error createScopes(llvm::object::COFFObjectFile &Obj);
178 Error createScopes(llvm::pdb::PDBFile &Pdb);
182 Error createScopes()
override;
183 void sortScopes()
override;
191 Input(&Obj), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
195 Input(&
Pdb), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
206 return Modi >= Modules.size() ? nullptr : Modules[Modi];
220 LogicalVisitor.printRecords(
OS);
223#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)