72 using LVModules = std::vector<LVScope *>;
78 std::shared_ptr<llvm::pdb::InputFile> TypeServer;
79 std::shared_ptr<LazyRandomTypeCollection> PrecompHeader;
83 std::unique_ptr<MemoryBuffer> MemBuffer;
84 std::unique_ptr<llvm::pdb::IPDBSession> Session;
85 std::unique_ptr<llvm::pdb::NativeSession> PdbSession;
89 std::unique_ptr<AppendingTypeTableBuilder> Builder;
90 std::unique_ptr<BinaryItemStream<CVType>> ItemStream;
91 std::unique_ptr<BinaryStreamReader> ReaderPrecomp;
92 std::vector<CVType> TypeArray;
97 std::unique_ptr<MemoryBuffer> BinaryBuffer;
98 std::unique_ptr<llvm::object::Binary> BinaryExecutable;
105 bool IsComdat)
override;
109 bool isObj()
const {
return Input.isObj(); }
110 bool isPdb()
const {
return Input.isPdb(); }
111 StringRef
getFileName() {
return Input.getFilePath(); }
117 int32_t CurrentModule = -1;
119 using RelocMapTy = DenseMap<
const llvm::object::coff_section *,
120 std::vector<llvm::object::RelocationRef>>;
125 LazyRandomTypeCollection &types() {
126 return TypeServer ? TypeServer->types()
127 : (PrecompHeader ? *PrecompHeader : Input.types());
129 LazyRandomTypeCollection &ids() {
130 return TypeServer ? TypeServer->ids()
131 : (PrecompHeader ? *PrecompHeader : Input.ids());
134 LVLogicalVisitor LogicalVisitor;
137 getFileNameForFileOffset(uint32_t FileOffset,
138 const llvm::pdb::SymbolGroup *SG =
nullptr);
139 void printRelocatedField(StringRef Label,
140 const llvm::object::coff_section *CoffSection,
141 uint32_t RelocOffset, uint32_t
Offset,
142 StringRef *RelocSym);
144 Error printFileNameForOffset(StringRef Label, uint32_t FileOffset,
145 const llvm::pdb::SymbolGroup *SG =
nullptr);
147 Error loadPrecompiledObject(PrecompRecord &Precomp,
CVTypeArray &CVTypesObj);
148 Error loadTypeServer(TypeServer2Record &TS);
149 Error traverseTypes(llvm::pdb::PDBFile &
Pdb, LazyRandomTypeCollection &Types,
150 LazyRandomTypeCollection &Ids);
152 Error collectInlineeInfo(DebugInlineeLinesSubsectionRef &Lines,
153 const llvm::pdb::SymbolGroup *SG =
nullptr);
155 void cacheRelocations();
156 Error resolveSymbol(
const llvm::object::coff_section *CoffSection,
157 uint64_t
Offset, llvm::object::SymbolRef &Sym);
158 Error resolveSymbolName(
const llvm::object::coff_section *CoffSection,
160 Error traverseTypeSection(StringRef SectionName,
161 const llvm::object::SectionRef &Section);
162 Error traverseSymbolSection(StringRef SectionName,
163 const llvm::object::SectionRef &Section);
164 Error traverseInlineeLines(StringRef Subsection);
166 DebugChecksumsSubsectionRef CVFileChecksumTable;
167 DebugStringTableSubsectionRef CVStringTable;
169 Error traverseSymbolsSubsection(StringRef Subsection,
170 const llvm::object::SectionRef &Section,
171 StringRef SectionContents);
176 Error initializeFileAndStringTables(BinaryStreamReader &Reader);
178 Error createLines(
const FixedStreamArray<LineNumberEntry> &LineNumbers,
179 LVAddress Addendum, uint32_t Segment, uint32_t Begin,
180 uint32_t
Size, uint32_t NameIndex,
181 const llvm::pdb::SymbolGroup *SG =
nullptr);
184 Error processModule();
196 Input(&Obj), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
200 Input(&
Pdb), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
211 return Modi >= Modules.size() ? nullptr : Modules[Modi];
225 LogicalVisitor.printRecords(
OS);
228#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)