diff options
Diffstat (limited to 'llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h')
-rw-r--r-- | llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h b/llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h index 4adf3b394c2e..90fd19a7a2fb 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/SymbolCache.h @@ -10,11 +10,15 @@ #define LLVM_DEBUGINFO_PDB_NATIVE_SYMBOLCACHE_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/IntervalMap.h" +#include "llvm/DebugInfo/CodeView/Line.h" +#include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/DebugInfo/CodeView/TypeDeserializer.h" #include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" +#include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h" #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h" -#include "llvm/Support/Allocator.h" +#include "llvm/DebugInfo/PDB/Native/NativeSourceFile.h" #include <memory> #include <vector> @@ -49,9 +53,36 @@ class SymbolCache { /// appear in the PDB file. std::vector<SymIndexId> Compilands; + /// List of source files, indexed by unique source file index. + mutable std::vector<std::unique_ptr<NativeSourceFile>> SourceFiles; + mutable DenseMap<uint32_t, SymIndexId> FileNameOffsetToId; + /// Map from global symbol offset to SymIndexId. DenseMap<uint32_t, SymIndexId> GlobalOffsetToSymbolId; + /// Map from segment and code offset to SymIndexId. + DenseMap<std::pair<uint32_t, uint32_t>, SymIndexId> AddressToFunctionSymId; + DenseMap<std::pair<uint32_t, uint32_t>, SymIndexId> AddressToPublicSymId; + + /// Map from virtual address to module index. + using IMap = + IntervalMap<uint64_t, uint16_t, 8, IntervalMapHalfOpenInfo<uint64_t>>; + IMap::Allocator IMapAllocator; + IMap AddrToModuleIndex; + + Expected<ModuleDebugStreamRef> getModuleDebugStream(uint32_t Index) const; + + struct LineTableEntry { + uint64_t Addr; + codeview::LineInfo Line; + uint32_t ColumnNumber; + uint32_t FileNameIndex; + bool IsTerminalEntry; + }; + + std::vector<LineTableEntry> findLineTable(uint16_t Modi) const; + mutable DenseMap<uint16_t, std::vector<LineTableEntry>> LineTable; + SymIndexId createSymbolPlaceholder() { SymIndexId Id = Cache.size(); Cache.push_back(nullptr); @@ -78,6 +109,11 @@ class SymbolCache { SymIndexId createSimpleType(codeview::TypeIndex TI, codeview::ModifierOptions Mods); + std::unique_ptr<PDBSymbol> findFunctionSymbolBySectOffset(uint32_t Sect, + uint32_t Offset); + std::unique_ptr<PDBSymbol> findPublicSymbolBySectOffset(uint32_t Sect, + uint32_t Offset); + public: SymbolCache(NativeSession &Session, DbiStream *Dbi); @@ -128,6 +164,12 @@ public: SymIndexId getOrCreateGlobalSymbolByOffset(uint32_t Offset); + std::unique_ptr<PDBSymbol> + findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type); + + std::unique_ptr<IPDBEnumLineNumbers> + findLineNumbersByVA(uint64_t VA, uint32_t Length) const; + std::unique_ptr<PDBSymbolCompiland> getOrCreateCompiland(uint32_t Index); uint32_t getNumCompilands() const; @@ -139,6 +181,13 @@ public: ConcreteT &getNativeSymbolById(SymIndexId SymbolId) const { return static_cast<ConcreteT &>(getNativeSymbolById(SymbolId)); } + + std::unique_ptr<IPDBSourceFile> getSourceFileById(SymIndexId FileId) const; + SymIndexId + getOrCreateSourceFile(const codeview::FileChecksumEntry &Checksum) const; + + void parseSectionContribs(); + Optional<uint16_t> getModuleIndexForAddr(uint64_t Addr) const; }; } // namespace pdb |