diff options
Diffstat (limited to 'include/llvm/DebugInfo/PDB/Native')
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h (renamed from include/llvm/DebugInfo/PDB/Native/ModInfo.h) | 33 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h | 101 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/DbiStream.h | 4 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h | 9 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/ModInfoBuilder.h | 74 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h (renamed from include/llvm/DebugInfo/PDB/Native/ModStream.h) | 30 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h | 0 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h | 2 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h | 2 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/RawTypes.h | 6 | ||||
| -rw-r--r-- | include/llvm/DebugInfo/PDB/Native/StringTableBuilder.h | 1 |
11 files changed, 147 insertions, 115 deletions
diff --git a/include/llvm/DebugInfo/PDB/Native/ModInfo.h b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h index d26d0d618449..879cb4285cd7 100644 --- a/include/llvm/DebugInfo/PDB/Native/ModInfo.h +++ b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h @@ -1,4 +1,4 @@ -//===- ModInfo.h - PDB module information -----------------------*- C++ -*-===// +//===- DbiModuleDescriptor.h - PDB module information -----------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_MODINFO_H -#define LLVM_DEBUGINFO_PDB_RAW_MODINFO_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H +#define LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H #include "llvm/ADT/StringRef.h" #include "llvm/DebugInfo/PDB/Native/RawTypes.h" @@ -22,21 +22,21 @@ namespace llvm { namespace pdb { -class ModInfo { +class DbiModuleDescriptor { friend class DbiStreamBuilder; public: - ModInfo(); - ModInfo(const ModInfo &Info); - ~ModInfo(); + DbiModuleDescriptor(); + DbiModuleDescriptor(const DbiModuleDescriptor &Info); + ~DbiModuleDescriptor(); - static Error initialize(BinaryStreamRef Stream, ModInfo &Info); + static Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info); bool hasECInfo() const; uint16_t getTypeServerIndex() const; uint16_t getModuleStreamIndex() const; uint32_t getSymbolDebugInfoByteSize() const; - uint32_t getLineInfoByteSize() const; + uint32_t getC11LineInfoByteSize() const; uint32_t getC13LineInfoByteSize() const; uint32_t getNumberOfFiles() const; uint32_t getSourceFileNameIndex() const; @@ -54,19 +54,20 @@ private: }; struct ModuleInfoEx { - ModuleInfoEx(const ModInfo &Info) : Info(Info) {} + ModuleInfoEx(const DbiModuleDescriptor &Info) : Info(Info) {} ModuleInfoEx(const ModuleInfoEx &Ex) = default; - ModInfo Info; + DbiModuleDescriptor Info; std::vector<StringRef> SourceFiles; }; } // end namespace pdb -template <> struct VarStreamArrayExtractor<pdb::ModInfo> { - Error operator()(BinaryStreamRef Stream, uint32_t &Length, - pdb::ModInfo &Info) const { - if (auto EC = pdb::ModInfo::initialize(Stream, Info)) +template <> struct VarStreamArrayExtractor<pdb::DbiModuleDescriptor> { + typedef void ContextType; + static Error extract(BinaryStreamRef Stream, uint32_t &Length, + pdb::DbiModuleDescriptor &Info, void *Ctx) { + if (auto EC = pdb::DbiModuleDescriptor::initialize(Stream, Info)) return EC; Length = Info.getRecordLength(); return Error::success(); @@ -75,4 +76,4 @@ template <> struct VarStreamArrayExtractor<pdb::ModInfo> { } // end namespace llvm -#endif // LLVM_DEBUGINFO_PDB_RAW_MODINFO_H +#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H diff --git a/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h new file mode 100644 index 000000000000..8cc5db981f56 --- /dev/null +++ b/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h @@ -0,0 +1,101 @@ +//===- DbiModuleDescriptorBuilder.h - PDB module information ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H +#define LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h" +#include "llvm/DebugInfo/CodeView/SymbolRecord.h" +#include "llvm/DebugInfo/PDB/Native/RawTypes.h" +#include "llvm/Support/Error.h" +#include <cstdint> +#include <string> +#include <vector> + +namespace llvm { +class BinaryStreamWriter; + +namespace codeview { +class ModuleDebugFragmentRecordBuilder; +} + +namespace msf { +class MSFBuilder; +struct MSFLayout; +} +namespace pdb { + +class DbiModuleDescriptorBuilder { + friend class DbiStreamBuilder; + +public: + DbiModuleDescriptorBuilder(StringRef ModuleName, uint32_t ModIndex, + msf::MSFBuilder &Msf); + ~DbiModuleDescriptorBuilder(); + + DbiModuleDescriptorBuilder(const DbiModuleDescriptorBuilder &) = delete; + DbiModuleDescriptorBuilder & + operator=(const DbiModuleDescriptorBuilder &) = delete; + + void setObjFileName(StringRef Name); + void addSymbol(codeview::CVSymbol Symbol); + + void addC13Fragment(std::unique_ptr<codeview::ModuleDebugLineFragment> Lines); + void addC13Fragment( + std::unique_ptr<codeview::ModuleDebugInlineeLineFragment> Inlinees); + void setC13FileChecksums( + std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> Checksums); + + uint16_t getStreamIndex() const; + StringRef getModuleName() const { return ModuleName; } + StringRef getObjFileName() const { return ObjFileName; } + + ArrayRef<std::string> source_files() const { + return makeArrayRef(SourceFiles); + } + + uint32_t calculateSerializedLength() const; + + void finalize(); + Error finalizeMsfLayout(); + + Error commit(BinaryStreamWriter &ModiWriter, const msf::MSFLayout &MsfLayout, + WritableBinaryStreamRef MsfBuffer); + +private: + uint32_t calculateC13DebugInfoSize() const; + + void addSourceFile(StringRef Path); + msf::MSFBuilder &MSF; + + uint32_t SymbolByteSize = 0; + std::string ModuleName; + std::string ObjFileName; + std::vector<std::string> SourceFiles; + std::vector<codeview::CVSymbol> Symbols; + + std::unique_ptr<codeview::ModuleDebugFileChecksumFragment> ChecksumInfo; + std::vector<std::unique_ptr<codeview::ModuleDebugLineFragment>> LineInfo; + std::vector<std::unique_ptr<codeview::ModuleDebugInlineeLineFragment>> + Inlinees; + + std::vector<std::unique_ptr<codeview::ModuleDebugFragmentRecordBuilder>> + C13Builders; + + ModuleInfoHeader Layout; +}; + +} // end namespace pdb + +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTORBUILDER_H diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStream.h b/include/llvm/DebugInfo/PDB/Native/DbiStream.h index f49f5aaefaca..84ae57f2e23a 100644 --- a/include/llvm/DebugInfo/PDB/Native/DbiStream.h +++ b/include/llvm/DebugInfo/PDB/Native/DbiStream.h @@ -10,9 +10,9 @@ #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H -#include "llvm/DebugInfo/CodeView/ModuleSubstream.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" -#include "llvm/DebugInfo/PDB/Native/ModInfo.h" +#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h" #include "llvm/DebugInfo/PDB/Native/RawConstants.h" #include "llvm/DebugInfo/PDB/Native/RawTypes.h" #include "llvm/DebugInfo/PDB/Native/StringTable.h" diff --git a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h index 16426bd93847..bcac182e2145 100644 --- a/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h +++ b/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h @@ -31,7 +31,7 @@ struct coff_section; namespace pdb { class DbiStream; struct DbiStreamHeader; -class ModInfoBuilder; +class DbiModuleDescriptorBuilder; class PDBFile; class DbiStreamBuilder { @@ -57,8 +57,9 @@ public: uint32_t calculateSerializedLength() const; - Expected<ModInfoBuilder &> addModuleInfo(StringRef ModuleName); + Expected<DbiModuleDescriptorBuilder &> addModuleInfo(StringRef ModuleName); Error addModuleSourceFile(StringRef Module, StringRef File); + Expected<uint32_t> getSourceFileNameIndex(StringRef FileName); Error finalizeMsfLayout(); @@ -103,8 +104,8 @@ private: const DbiStreamHeader *Header; - StringMap<std::unique_ptr<ModInfoBuilder>> ModiMap; - std::vector<ModInfoBuilder *> ModiList; + StringMap<std::unique_ptr<DbiModuleDescriptorBuilder>> ModiMap; + std::vector<DbiModuleDescriptorBuilder *> ModiList; StringMap<uint32_t> SourceFileNames; diff --git a/include/llvm/DebugInfo/PDB/Native/ModInfoBuilder.h b/include/llvm/DebugInfo/PDB/Native/ModInfoBuilder.h deleted file mode 100644 index 605fd2483c3b..000000000000 --- a/include/llvm/DebugInfo/PDB/Native/ModInfoBuilder.h +++ /dev/null @@ -1,74 +0,0 @@ -//===- ModInfoBuilder.h - PDB module information ----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_DEBUGINFO_PDB_RAW_MODINFOBUILDER_H -#define LLVM_DEBUGINFO_PDB_RAW_MODINFOBUILDER_H - -#include "llvm/ADT/StringRef.h" -#include "llvm/DebugInfo/CodeView/SymbolRecord.h" -#include "llvm/DebugInfo/PDB/Native/RawTypes.h" -#include "llvm/Support/Error.h" -#include <cstdint> -#include <string> -#include <vector> - -namespace llvm { -class BinaryStreamWriter; - -namespace msf { -class MSFBuilder; -struct MSFLayout; -} -namespace pdb { - -class ModInfoBuilder { - friend class DbiStreamBuilder; - -public: - ModInfoBuilder(StringRef ModuleName, uint32_t ModIndex, msf::MSFBuilder &Msf); - - ModInfoBuilder(const ModInfoBuilder &) = delete; - ModInfoBuilder &operator=(const ModInfoBuilder &) = delete; - - void setObjFileName(StringRef Name); - void addSymbol(codeview::CVSymbol Symbol); - - uint16_t getStreamIndex() const; - StringRef getModuleName() const { return ModuleName; } - StringRef getObjFileName() const { return ObjFileName; } - - ArrayRef<std::string> source_files() const { - return makeArrayRef(SourceFiles); - } - - uint32_t calculateSerializedLength() const; - - void finalize(); - Error finalizeMsfLayout(); - - Error commit(BinaryStreamWriter &ModiWriter, const msf::MSFLayout &MsfLayout, - WritableBinaryStreamRef MsfBuffer); - -private: - void addSourceFile(StringRef Path); - msf::MSFBuilder &MSF; - - uint32_t SymbolByteSize = 0; - std::string ModuleName; - std::string ObjFileName; - std::vector<std::string> SourceFiles; - std::vector<codeview::CVSymbol> Symbols; - ModuleInfoHeader Layout; -}; - -} // end namespace pdb - -} // end namespace llvm - -#endif // LLVM_DEBUGINFO_PDB_RAW_MODINFOBUILDER_H diff --git a/include/llvm/DebugInfo/PDB/Native/ModStream.h b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h index b12d4ff375f3..2c95690ed580 100644 --- a/include/llvm/DebugInfo/PDB/Native/ModStream.h +++ b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h @@ -1,4 +1,4 @@ -//===- ModStream.h - PDB Module Info Stream Access ------------------------===// +//===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===// // // The LLVM Compiler Infrastructure // @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_PDB_RAW_MODSTREAM_H -#define LLVM_DEBUGINFO_PDB_RAW_MODSTREAM_H +#ifndef LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H +#define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H #include "llvm/ADT/iterator_range.h" #include "llvm/DebugInfo/CodeView/CVRecord.h" -#include "llvm/DebugInfo/CodeView/ModuleSubstream.h" +#include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/Support/BinaryStreamArray.h" @@ -22,13 +22,16 @@ namespace llvm { namespace pdb { class PDBFile; -class ModInfo; +class DbiModuleDescriptor; + +class ModuleDebugStreamRef { + typedef codeview::ModuleDebugFragmentArray::Iterator + LinesAndChecksumsIterator; -class ModStream { public: - ModStream(const ModInfo &Module, - std::unique_ptr<msf::MappedBlockStream> Stream); - ~ModStream(); + ModuleDebugStreamRef(const DbiModuleDescriptor &Module, + std::unique_ptr<msf::MappedBlockStream> Stream); + ~ModuleDebugStreamRef(); Error reload(); @@ -37,26 +40,25 @@ public: iterator_range<codeview::CVSymbolArray::Iterator> symbols(bool *HadError) const; - iterator_range<codeview::ModuleSubstreamArray::Iterator> - lines(bool *HadError) const; + llvm::iterator_range<LinesAndChecksumsIterator> linesAndChecksums() const; bool hasLineInfo() const; Error commit(); private: - const ModInfo &Mod; + const DbiModuleDescriptor &Mod; uint32_t Signature; std::unique_ptr<msf::MappedBlockStream> Stream; codeview::CVSymbolArray SymbolsSubstream; - BinaryStreamRef LinesSubstream; + BinaryStreamRef C11LinesSubstream; BinaryStreamRef C13LinesSubstream; BinaryStreamRef GlobalRefsSubstream; - codeview::ModuleSubstreamArray LineInfo; + codeview::ModuleDebugFragmentArray LinesAndChecksums; }; } } diff --git a/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/include/llvm/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.h diff --git a/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h b/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h index 8eeaf3e0ea49..b1d980679a45 100644 --- a/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h +++ b/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h @@ -10,7 +10,7 @@ #ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVECOMPILANDSYMBOL_H #define LLVM_DEBUGINFO_PDB_NATIVE_NATIVECOMPILANDSYMBOL_H -#include "llvm/DebugInfo/PDB/Native/ModInfo.h" +#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h" #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h" namespace llvm { diff --git a/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h b/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h index 60a55ee50cc4..18022f599bba 100644 --- a/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h +++ b/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h @@ -11,7 +11,7 @@ #define LLVM_DEBUGINFO_PDB_NATIVE_NATIVEENUMMODULES_H #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" -#include "llvm/DebugInfo/PDB/Native/ModInfo.h" +#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h" #include "llvm/DebugInfo/PDB/PDBSymbol.h" namespace llvm { namespace pdb { diff --git a/include/llvm/DebugInfo/PDB/Native/RawTypes.h b/include/llvm/DebugInfo/PDB/Native/RawTypes.h index 1b2631efce70..e1c6cf0021d5 100644 --- a/include/llvm/DebugInfo/PDB/Native/RawTypes.h +++ b/include/llvm/DebugInfo/PDB/Native/RawTypes.h @@ -200,7 +200,7 @@ struct FileInfoSubstreamHeader { }; struct ModInfoFlags { - /// uint16_t fWritten : 1; // True if ModInfo is dirty + /// uint16_t fWritten : 1; // True if DbiModuleDescriptor is dirty /// uint16_t fECEnabled : 1; // Is EC symbolic info present? (What is EC?) /// uint16_t unused : 6; // Reserved /// uint16_t iTSM : 8; // Type Server Index for this module @@ -231,8 +231,8 @@ struct ModuleInfoHeader { /// Size of local symbol debug info in above stream support::ulittle32_t SymBytes; - /// Size of line number debug info in above stream - support::ulittle32_t LineBytes; + /// Size of C11 line number info in above stream + support::ulittle32_t C11Bytes; /// Size of C13 line number info in above stream support::ulittle32_t C13Bytes; diff --git a/include/llvm/DebugInfo/PDB/Native/StringTableBuilder.h b/include/llvm/DebugInfo/PDB/Native/StringTableBuilder.h index dd0f40b1978d..9c4b12e33ba0 100644 --- a/include/llvm/DebugInfo/PDB/Native/StringTableBuilder.h +++ b/include/llvm/DebugInfo/PDB/Native/StringTableBuilder.h @@ -29,6 +29,7 @@ public: // If string S does not exist in the string table, insert it. // Returns the ID for S. uint32_t insert(StringRef S); + uint32_t getStringIndex(StringRef S); uint32_t finalize(); Error commit(BinaryStreamWriter &Writer) const; |
