Lines Matching full:pdb

1 //===- PDB.cpp ------------------------------------------------------------===//
9 #include "PDB.h"
35 #include "llvm/DebugInfo/PDB/GenericError.h"
36 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h"
37 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
38 #include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h"
39 #include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
40 #include "llvm/DebugInfo/PDB/Native/InfoStream.h"
41 #include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h"
42 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
43 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
44 #include "llvm/DebugInfo/PDB/Native/PDBFileBuilder.h"
45 #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h"
46 #include "llvm/DebugInfo/PDB/Native/TpiHashing.h"
47 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
48 #include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h"
49 #include "llvm/DebugInfo/PDB/PDB.h"
70 using llvm::pdb::StringTableFixup;
87 /// Emit the basic PDB structure: initial streams, headers, etc.
96 /// Link CodeView from each object file in the symbol table into the PDB.
99 /// Add every live, defined public symbol to the PDB.
102 /// Link info for each import file in the symbol table into the PDB.
107 /// Link CodeView from a single object file into the target (output) PDB.
116 // in the PDB.
127 // Callback to copy and relocate debug symbols during PDB file writing.
139 /// Add the section map and section contributions to the PDB.
142 /// Write the PDB to disk and store the Guid generated for it in *Guid.
145 // Print statistics regarding the final PDB
153 pdb::DbiModuleDescriptorBuilder &mod);
155 pdb::PDBFileBuilder builder;
193 /// need to be added to the global PDB string table, and all references to
195 /// global PDB string table.
200 /// PDB.
211 /// applied to the symbols during PDB writing.
242 // PDB to work without additional configuration:
267 // Since PDB's are more of a Windows thing, we make this conservative and only in pdbMakeAbsolute()
281 static void addTypeInfo(pdb::TpiStreamBuilder &tpiBuilder, in addTypeInfo()
284 tpiBuilder.setVersionHeader(pdb::PdbTpiV80); in addTypeInfo()
288 auto hash = pdb::hashTypeRecord(type); in addTypeInfo()
296 pdb::PDBFileBuilder &builder) { in addGHashTypeInfo()
298 builder.getTpiBuilder().setVersionHeader(pdb::PdbTpiV80); in addGHashTypeInfo()
299 builder.getIpiBuilder().setVersionHeader(pdb::PdbTpiV80); in addGHashTypeInfo()
354 // to the PDB file's ID stream index space, but we need to convert this to a in translateIdSymbols()
387 warn(formatv("procedure symbol record for `{0}` in {1} refers to PDB " in translateIdSymbols()
491 static void addGlobalSymbol(pdb::GSIStreamBuilder &builder, uint16_t modIndex, in addGlobalSymbol()
577 // "real" symbols in a PDB. in writeSymbolRecord()
607 alignTo(sym.length(), alignOf(CodeViewContainer::Pdb)); in analyzeSymbolSubsection()
623 // later during PDB writing. in analyzeSymbolSubsection()
649 // Visit all live .debug$S sections a second time, and write them to the PDB. in writeAllModuleSymbolRecords()
685 alignTo(sym.length(), alignOf(CodeViewContainer::Pdb)); in writeAllModuleSymbolRecords()
717 static pdb::SectionContrib createSectionContrib(COFFLinkerContext &ctx, in createSectionContrib()
720 pdb::SectionContrib sc; in createSectionContrib()
722 sc.ISect = os ? os->sectionIndex : llvm::pdb::kInvalidStreamIndex; in createSectionContrib()
757 // be relocated later during PDB writing. in handleDebugS()
842 /// require only relocation and type index remapping to add to the PDB.
920 pdb::DbiStreamBuilder &dbiBuilder = linker.builder.getDbiBuilder(); in finish()
945 // when it is added to the PDB. The string table indices for the FPO program in finish()
946 // must also be rewritten to use the PDB string table. in finish()
963 // indices, and add the record to the PDB. in finish()
983 // Make a new file checksum table that refers to offsets in the PDB-wide in finish()
1027 // server PDB. Type server PDBs do not contain symbols, so stop here. in addDebugSymbols()
1034 pdb::DbiStreamBuilder &dbiBuilder = builder.getDbiBuilder(); in addDebugSymbols()
1070 // path to the object into the PDB. If this is a plain object, we make its
1074 pdb::DbiStreamBuilder &dbiBuilder = builder.getDbiBuilder(); in createModuleDBI()
1094 pdb::SectionContrib sc = createSectionContrib(ctx, secChunk, modi); in createModuleDBI()
1103 // the PDB first, so that we can get the map from object file type and item in addDebug()
1104 // indices to PDB type and item indices. If we are using ghashes, types have in addDebug()
1128 static pdb::BulkPublic createPublic(COFFLinkerContext &ctx, Defined *def) { in createPublic()
1129 pdb::BulkPublic pub; in createPublic()
1149 // Add all object files to the PDB. Merge .debug$T sections into IpiData and
1153 llvm::TimeTraceScope timeScope("Add objects to PDB"); in addObjectsToPDB()
1209 std::vector<pdb::BulkPublic> publics; in addPublicsToPDB()
1219 // results in bloated PDB files. These symbols generally are not helpful in addPublicsToPDB()
1257 print(ctx.typeServerSourceMappings.size(), "PDB type server dependencies"); in printStats()
1263 print(pdbStrTab.size(), "Output PDB strings"); in printStats()
1430 StringRef path, pdb::DbiModuleDescriptorBuilder &mod) { in addCommonLinkerModuleSymbols()
1452 ebs.Fields.push_back("pdb"); in addCommonLinkerModuleSymbols()
1458 ons, bAlloc, CodeViewContainer::Pdb)); in addCommonLinkerModuleSymbols()
1460 cs, bAlloc, CodeViewContainer::Pdb)); in addCommonLinkerModuleSymbols()
1462 ebs, bAlloc, CodeViewContainer::Pdb)); in addCommonLinkerModuleSymbols()
1466 pdb::DbiModuleDescriptorBuilder &mod, in addLinkerModuleCoffGroup()
1488 cgs, bAlloc(), CodeViewContainer::Pdb)); in addLinkerModuleCoffGroup()
1491 static void addLinkerModuleSectionSymbol(pdb::DbiModuleDescriptorBuilder &mod, in addLinkerModuleSectionSymbol()
1501 sym, bAlloc(), CodeViewContainer::Pdb)); in addLinkerModuleSectionSymbol()
1504 // PDB, due to each function being in its own section in addLinkerModuleSectionSymbol()
1514 // Add all import files as modules to the PDB.
1521 std::map<std::string, llvm::pdb::DbiModuleDescriptorBuilder *> dllToModuleDbi; in addImportFilesToPDB()
1534 llvm::pdb::DbiModuleDescriptorBuilder *&mod = dllToModuleDbi[dll]; in addImportFilesToPDB()
1536 pdb::DbiStreamBuilder &dbiBuilder = builder.getDbiBuilder(); in addImportFilesToPDB()
1543 llvm::pdb::DbiModuleDescriptorBuilder &firstMod = in addImportFilesToPDB()
1546 pdb::SectionContrib sc = in addImportFilesToPDB()
1547 createSectionContrib(ctx, nullptr, llvm::pdb::kInvalidStreamIndex); in addImportFilesToPDB()
1580 ons, bAlloc, CodeViewContainer::Pdb)); in addImportFilesToPDB()
1582 cs, bAlloc, CodeViewContainer::Pdb)); in addImportFilesToPDB()
1585 ts, bAlloc, CodeViewContainer::Pdb); in addImportFilesToPDB()
1594 CodeViewContainer::Pdb); in addImportFilesToPDB()
1599 pdb::SectionContrib sc = in addImportFilesToPDB()
1605 // Creates a PDB file.
1609 llvm::TimeTraceScope timeScope("PDB file"); in createPDB()
1612 PDBLinker pdb(ctx); in createPDB() local
1614 pdb.initialize(buildId); in createPDB()
1615 pdb.addObjectsToPDB(); in createPDB()
1616 pdb.addImportFilesToPDB(); in createPDB()
1617 pdb.addSections(sectionTable); in createPDB()
1618 pdb.addNatvisFiles(); in createPDB()
1619 pdb.addNamedStreams(); in createPDB()
1620 pdb.addPublicsToPDB(); in createPDB()
1623 llvm::TimeTraceScope timeScope("Commit PDB file to disk"); in createPDB()
1626 pdb.commit(&guid); in createPDB()
1631 pdb.printStats(); in createPDB()
1647 // Signature is set to a hash of the PDB contents when the PDB is done. in initialize()
1652 // PDB, TPI, DBI and IPI. in initialize()
1653 for (int i = 0; i < (int)pdb::kSpecialStreamCount; ++i) in initialize()
1658 infoBuilder.setVersion(pdb::PdbRaw_ImplVer::PdbImplVC70); in initialize()
1662 pdb::DbiStreamBuilder &dbiBuilder = builder.getDbiBuilder(); in initialize()
1664 dbiBuilder.setVersionHeader(pdb::PdbDbiV70); in initialize()
1674 llvm::TimeTraceScope timeScope("PDB output sections"); in addSections()
1677 pdb::DbiStreamBuilder &dbiBuilder = builder.getDbiBuilder(); in addSections()
1689 pdb::SectionContrib sc = in addSections()
1698 pdb::SectionContrib sc = in addSections()
1699 createSectionContrib(ctx, nullptr, llvm::pdb::kInvalidStreamIndex); in addSections()
1710 dbiBuilder.addDbgStream(pdb::DbgHeaderType::SectionHdr, sectionTable)); in addSections()
1714 // Print an error and continue if PDB writing fails. This is done mainly so in commit()
1716 // when trying to figure out why a PDB file is too large. in commit()
1725 error("failed to write PDB file " + Twine(ctx.config.pdbPath)); in commit()