003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/Native
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
DebugInfo
/
PDB
/
Native
/
📁
..
📄
DbiModuleDescriptor.h
(2.11 KB)
📄
DbiModuleDescriptorBuilder.h
(3.13 KB)
📄
DbiModuleList.h
(4 KB)
📄
DbiStream.h
(4.33 KB)
📄
DbiStreamBuilder.h
(4.21 KB)
📄
EnumTables.h
(674 B)
📄
Formatters.h
(1.77 KB)
📄
GSIStreamBuilder.h
(4.71 KB)
📄
GlobalsStream.h
(2.89 KB)
📄
Hash.h
(785 B)
📄
HashTable.h
(10.24 KB)
📄
ISectionContribVisitor.h
(865 B)
📄
InfoStream.h
(1.94 KB)
📄
InfoStreamBuilder.h
(2.11 KB)
📄
InjectedSourceStream.h
(1.3 KB)
📄
ModuleDebugStream.h
(2.79 KB)
📄
NamedStreamMap.h
(1.95 KB)
📄
NativeCompilandSymbol.h
(1.24 KB)
📄
NativeEnumGlobals.h
(1.18 KB)
📄
NativeEnumInjectedSources.h
(1.34 KB)
📄
NativeEnumLineNumbers.h
(1.28 KB)
📄
NativeEnumModules.h
(1 KB)
📄
NativeEnumTypes.h
(1.41 KB)
📄
NativeExeSymbol.h
(1.16 KB)
📄
NativeFunctionSymbol.h
(1.5 KB)
📄
NativeLineNumber.h
(1.77 KB)
📄
NativePublicSymbol.h
(1.46 KB)
📄
NativeRawSymbol.h
(9.86 KB)
📄
NativeSession.h
(5.12 KB)
📄
NativeSourceFile.h
(1.33 KB)
📄
NativeSymbolEnumerator.h
(1.68 KB)
📄
NativeTypeArray.h
(1.41 KB)
📄
NativeTypeBuiltin.h
(1.41 KB)
📄
NativeTypeEnum.h
(2.56 KB)
📄
NativeTypeFunctionSig.h
(2.31 KB)
📄
NativeTypePointer.h
(2.08 KB)
📄
NativeTypeTypedef.h
(1.29 KB)
📄
NativeTypeUDT.h
(2.51 KB)
📄
NativeTypeVTShape.h
(1.46 KB)
📄
PDBFile.h
(4.4 KB)
📄
PDBFileBuilder.h
(3.54 KB)
📄
PDBStringTable.h
(1.81 KB)
📄
PDBStringTableBuilder.h
(2.06 KB)
📄
PublicsStream.h
(1.77 KB)
📄
RawConstants.h
(3.03 KB)
📄
RawError.h
(1.5 KB)
📄
RawTypes.h
(11.91 KB)
📄
SymbolCache.h
(6.94 KB)
📄
SymbolStream.h
(1.12 KB)
📄
TpiHashing.h
(1.93 KB)
📄
TpiStream.h
(2.72 KB)
📄
TpiStreamBuilder.h
(2.45 KB)
Editing: SymbolCache.h
//==- SymbolCache.h - Cache of native symbols and ids ------------*- C++ -*-==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_DEBUGINFO_PDB_NATIVE_SYMBOLCACHE_H #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/DebugInfo/PDB/Native/NativeSourceFile.h" #include <memory> #include <vector> namespace llvm { namespace pdb { class DbiStream; class PDBFile; class SymbolCache { NativeSession &Session; DbiStream *Dbi = nullptr; /// Cache of all stable symbols, indexed by SymIndexId. Just because a /// symbol has been parsed does not imply that it will be stable and have /// an Id. Id allocation is an implementation, with the only guarantee /// being that once an Id is allocated, the symbol can be assumed to be /// cached. std::vector<std::unique_ptr<NativeRawSymbol>> Cache; /// For type records from the TPI stream which have been paresd and cached, /// stores a mapping to SymIndexId of the cached symbol. DenseMap<codeview::TypeIndex, SymIndexId> TypeIndexToSymbolId; /// For field list members which have been parsed and cached, stores a mapping /// from (IndexOfClass, MemberIndex) to the corresponding SymIndexId of the /// cached symbol. DenseMap<std::pair<codeview::TypeIndex, uint32_t>, SymIndexId> FieldListMembersToSymbolId; /// List of SymIndexIds for each compiland, indexed by compiland index as they /// 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); return Id; } template <typename ConcreteSymbolT, typename CVRecordT, typename... Args> SymIndexId createSymbolForType(codeview::TypeIndex TI, codeview::CVType CVT, Args &&... ConstructorArgs) { CVRecordT Record; if (auto EC = codeview::TypeDeserializer::deserializeAs<CVRecordT>(CVT, Record)) { consumeError(std::move(EC)); return 0; } return createSymbol<ConcreteSymbolT>( TI, std::move(Record), std::forward<Args>(ConstructorArgs)...); } SymIndexId createSymbolForModifiedType(codeview::TypeIndex ModifierTI, codeview::CVType CVT); 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); template <typename ConcreteSymbolT, typename... Args> SymIndexId createSymbol(Args &&... ConstructorArgs) { SymIndexId Id = Cache.size(); // Initial construction must not access the cache, since it must be done // atomically. auto Result = std::make_unique<ConcreteSymbolT>( Session, Id, std::forward<Args>(ConstructorArgs)...); Result->SymbolId = Id; NativeRawSymbol *NRS = static_cast<NativeRawSymbol *>(Result.get()); Cache.push_back(std::move(Result)); // After the item is in the cache, we can do further initialization which // is then allowed to access the cache. NRS->initialize(); return Id; } std::unique_ptr<IPDBEnumSymbols> createTypeEnumerator(codeview::TypeLeafKind Kind); std::unique_ptr<IPDBEnumSymbols> createTypeEnumerator(std::vector<codeview::TypeLeafKind> Kinds); std::unique_ptr<IPDBEnumSymbols> createGlobalsEnumerator(codeview::SymbolKind Kind); SymIndexId findSymbolByTypeIndex(codeview::TypeIndex TI); template <typename ConcreteSymbolT, typename... Args> SymIndexId getOrCreateFieldListMember(codeview::TypeIndex FieldListTI, uint32_t Index, Args &&... ConstructorArgs) { SymIndexId SymId = Cache.size(); std::pair<codeview::TypeIndex, uint32_t> Key{FieldListTI, Index}; auto Result = FieldListMembersToSymbolId.try_emplace(Key, SymId); if (Result.second) SymId = createSymbol<ConcreteSymbolT>(std::forward<Args>(ConstructorArgs)...); else SymId = Result.first->second; return SymId; } 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; std::unique_ptr<PDBSymbol> getSymbolById(SymIndexId SymbolId) const; NativeRawSymbol &getNativeSymbolById(SymIndexId SymbolId) const; template <typename ConcreteT> 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 } // namespace llvm #endif
Upload File
Create Folder