In the global DBI stream, there is a list of module descriptors, one for each compiland. These descriptors contain a StreamIndex field, and if it is set to something valid, this stream index contains much more debug info about the module, such as symbols and codeview line info.
Prior to this patch, we were not writing the CodeView line information portion of this stream. This patch adds support for it. The way to use the new functionality is as follows:
PdbFileBuilder Pdb; auto &Dbi = Pdb.getDbiBuilder(); auto &StringTable = Pdb.getStringTable(); auto &Module = Dbi.addModuleInfo("foo.obj"); StringTable.insert("foo.cpp"); auto &Source = Dbi.addModuleSourceFile("foo.obj", "foo.cpp"); auto Lines = llvm::make_unique<codeview::ModuleDebugLineFragment>(); auto Checksums = llvm::make_unique<codeview::ModuleDebugChecksumFragment>(); // All line contributions for foo.cpp // Line Number Name Offsets refer to the Dbi string. Lines->createBlock("foo.cpp", Dbi.getNameIndex("foo.cpp")); Lines->addLineInfo(CodeOffset, LineNumber); Lines->addLineInfo(CodeOffset2, LineNumber2); // All line contributions for foo.h Lines->createBlock("foo.h", Dbi.getNameIndex("foo.h")); Lines->addLineInfo(CodeOffset3, LineNumber3); // File checkum NameOffsets refer to the global string table. Checksums->addChecksum(StringTable.getNameIndex("foo.cpp"), FileChecksumKind::MD5, llvm::md5(getFileContents("foo.cpp"))); Module.setC13LineInfo(std::move(Lines)); Module.setC13ChecksumInfo(std::move(Checksums)); Pdb.commit("out.pdb");
Is k prefix hangarian?