pdbdump calls DbiStreamBuilder::commit through PDBFileBuilder::commit
without calling DbiStreamBuilder::finalize. Because `finalize` initializes
`Header` member, `Header` remained nullptr which caused a crash bug.
Differential Revision: https://reviews.llvm.org/D23143
llvm-svn: 277681
Expected<std::unique_ptr<DbiStream>> build(PDBFile &File,
const msf::WritableStream &Buffer);
Error commit(const msf::MSFLayout &Layout,
- const msf::WritableStream &Buffer) const;
+ const msf::WritableStream &Buffer);
private:
Error finalize();
}
Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
- const msf::WritableStream &Buffer) const {
+ const msf::WritableStream &Buffer) {
+ if (auto EC = finalize())
+ return EC;
+
auto InfoS =
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamDBI);
--- /dev/null
+; RUN: llvm-pdbdump pdb2yaml -dbi-module-info -dbi-module-source-info \
+; RUN: -dbi-stream -pdb-stream -stream-directory -stream-metadata \
+; RUN: %p/Inputs/empty.pdb > %t.1
+; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2 %t.1