14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_CODEVIEWREADER_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_CODEVIEWREADER_H
39class LazyRandomTypeCollection;
47namespace logicalview {
52class LVScopeCompileUnit;
57class LVSymbolVisitorDelegate;
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(); }
117 int32_t CurrentModule = -1;
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,
139 void printRelocatedField(StringRef Label,
142 StringRef *RelocSym);
144 Error printFileNameForOffset(StringRef Label,
uint32_t FileOffset,
147 Error loadPrecompiledObject(PrecompRecord &Precomp,
CVTypeArray &CVTypesObj);
148 Error loadTypeServer(TypeServer2Record &TS);
150 LazyRandomTypeCollection &Ids);
152 Error collectInlineeInfo(DebugInlineeLinesSubsectionRef &Lines,
155 void cacheRelocations();
160 Error traverseTypeSection(StringRef SectionName,
162 Error traverseSymbolSection(StringRef SectionName,
164 Error traverseInlineeLines(StringRef Subsection);
166 DebugChecksumsSubsectionRef CVFileChecksumTable;
167 DebugStringTableSubsectionRef CVStringTable;
169 Error traverseSymbolsSubsection(StringRef Subsection,
171 StringRef SectionContents);
176 Error initializeFileAndStringTables(BinaryStreamReader &Reader);
178 Error createLines(
const FixedStreamArray<LineNumberEntry> &LineNumbers,
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)
Lightweight arrays that are backed by an arbitrary BinaryStream.
static Expected< StringRef > getFileName(const DebugStringTableSubsectionRef &Strings, const DebugChecksumsSubsectionRef &Checksums, uint32_t FileID)
DenseMap< uint64_t, uint64_t > RelocMap
mir Rename Register Operands
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
Represents either an error or a value T.
Lightweight error class with error context and mandatory checking.
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
ArrayRef< uint8_t > data() const
void addModule(LVScope *Scope)
void getLinkageName(const llvm::object::coff_section *CoffSection, uint32_t RelocOffset, uint32_t Offset, StringRef *RelocSym)
void print(raw_ostream &OS) const
LVCodeViewReader()=delete
void printRecords(raw_ostream &OS) const override
static std::string formatRegisterId(RegisterId Register, CPUType CPU)
std::string getRegisterName(LVSmall Opcode, ArrayRef< uint64_t > Operands) override
LVCodeViewReader(StringRef Filename, StringRef FileFormatName, llvm::object::COFFObjectFile &Obj, ScopedPrinter &W, StringRef ExePath)
LVCodeViewReader & operator=(const LVCodeViewReader &)=delete
LVScope * getScopeForModule(uint32_t Modi)
Error createScopes() override
static StringRef getSymbolKindName(SymbolKind Kind)
LVCodeViewReader(StringRef Filename, StringRef FileFormatName, llvm::pdb::PDBFile &Pdb, ScopedPrinter &W, StringRef ExePath)
LVCodeViewReader(const LVCodeViewReader &)=delete
~LVCodeViewReader()=default
bool isSystemEntry(LVElement *Element, StringRef Name) const override
void sortScopes() override
std::string FileFormatName
This class is the base class for all object file types.
This is a value type class that represents a single section in the list of sections in the object fil...
This is a value type class that represents a single symbol in the list of symbols in the object file.
This class implements an extremely fast bulk output stream that can only output to a stream.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
VarStreamArray< CVType > CVTypeArray
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static size_t length(const codeview::CVType &Item)
static ArrayRef< uint8_t > bytes(const codeview::CVType &Item)