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(); }
116 int32_t CurrentModule = -1;
118 using RelocMapTy = DenseMap<
const llvm::object::coff_section *,
119 std::vector<llvm::object::RelocationRef>>;
124 LazyRandomTypeCollection &types() {
125 return TypeServer ? TypeServer->types()
126 : (PrecompHeader ? *PrecompHeader :
Input.types());
128 LazyRandomTypeCollection &ids() {
129 return TypeServer ? TypeServer->ids()
130 : (PrecompHeader ? *PrecompHeader :
Input.ids());
133 LVLogicalVisitor LogicalVisitor;
136 getFileNameForFileOffset(uint32_t FileOffset,
137 const llvm::pdb::SymbolGroup *SG =
nullptr);
138 void printRelocatedField(StringRef Label,
139 const llvm::object::coff_section *CoffSection,
140 uint32_t RelocOffset, uint32_t Offset,
141 StringRef *RelocSym);
143 Error printFileNameForOffset(StringRef Label, uint32_t FileOffset,
144 const llvm::pdb::SymbolGroup *SG =
nullptr);
146 Error loadPrecompiledObject(PrecompRecord &Precomp, CVTypeArray &CVTypesObj);
147 Error loadTypeServer(TypeServer2Record &TS);
148 Error traverseTypes(llvm::pdb::PDBFile &Pdb, LazyRandomTypeCollection &Types,
149 LazyRandomTypeCollection &Ids);
151 Error collectInlineeInfo(DebugInlineeLinesSubsectionRef &Lines,
152 const llvm::pdb::SymbolGroup *SG =
nullptr);
154 void cacheRelocations();
155 Error resolveSymbol(
const llvm::object::coff_section *CoffSection,
156 uint64_t Offset, llvm::object::SymbolRef &Sym);
157 Error resolveSymbolName(
const llvm::object::coff_section *CoffSection,
159 Error traverseTypeSection(StringRef SectionName,
160 const llvm::object::SectionRef &Section);
161 Error traverseSymbolSection(StringRef SectionName,
162 const llvm::object::SectionRef &Section);
163 Error traverseInlineeLines(StringRef Subsection);
165 DebugChecksumsSubsectionRef CVFileChecksumTable;
166 DebugStringTableSubsectionRef CVStringTable;
168 Error traverseSymbolsSubsection(StringRef Subsection,
169 const llvm::object::SectionRef &Section,
170 StringRef SectionContents);
175 Error initializeFileAndStringTables(BinaryStreamReader &Reader);
177 Error createLines(
const FixedStreamArray<LineNumberEntry> &LineNumbers,
178 LVAddress Addendum, uint32_t Segment, uint32_t Begin,
179 uint32_t Size, uint32_t NameIndex,
180 const llvm::pdb::SymbolGroup *SG =
nullptr);
181 Error createScopes(llvm::object::COFFObjectFile &Obj);
182 Error createScopes(llvm::pdb::PDBFile &Pdb);
186 Error createScopes()
override;
187 void sortScopes()
override;
195 Input(&Obj), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
199 Input(&
Pdb), ExePath(ExePath), LogicalVisitor(this,
W, Input) {}
210 return Modi >= Modules.size() ? nullptr : Modules[Modi];
224 LogicalVisitor.printRecords(
OS);
227#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)