Index: include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h =================================================================== --- include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h +++ include/llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h @@ -36,7 +36,7 @@ PDBFileBuilder(const PDBFileBuilder &) = delete; PDBFileBuilder &operator=(const PDBFileBuilder &) = delete; - Error initialize(const msf::SuperBlock &Super); + Error initialize(uint32_t BlockSize); msf::MSFBuilder &getMsfBuilder(); InfoStreamBuilder &getInfoBuilder(); Index: lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp +++ lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp @@ -31,18 +31,11 @@ PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator) : Allocator(Allocator) {} -Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) { - auto ExpectedMsf = - MSFBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks); +Error PDBFileBuilder::initialize(uint32_t BlockSize) { + auto ExpectedMsf = MSFBuilder::create(Allocator, BlockSize); if (!ExpectedMsf) return ExpectedMsf.takeError(); - - auto &MsfResult = *ExpectedMsf; - if (auto EC = MsfResult.setBlockMapAddr(Super.BlockMapAddr)) - return EC; - Msf = llvm::make_unique(std::move(MsfResult)); - Msf->setFreePageMap(Super.FreeBlockMapBlock); - Msf->setUnknown1(Super.Unknown1); + Msf = llvm::make_unique(std::move(*ExpectedMsf)); return Error::success(); } @@ -189,4 +182,4 @@ } return Buffer.commit(); -} \ No newline at end of file +} Index: test/DebugInfo/PDB/pdbdump-readwrite.test =================================================================== --- test/DebugInfo/PDB/pdbdump-readwrite.test +++ test/DebugInfo/PDB/pdbdump-readwrite.test @@ -3,39 +3,75 @@ RUN: -stream-metadata %p/Inputs/empty.pdb > %t.1 RUN: llvm-pdbdump yaml2pdb -pdb=%t.2 %t.1 -RUN: llvm-pdbdump raw -headers -tpi-records %p/Inputs/empty.pdb | FileCheck %s -RUN: llvm-pdbdump raw -headers -tpi-records %t.2 | FileCheck %s +RUN: llvm-pdbdump raw -headers -tpi-records %p/Inputs/empty.pdb \ +RUN: | FileCheck -check-prefix=CHECK1 %s +RUN: llvm-pdbdump raw -headers -tpi-records %t.2 \ +RUN: | FileCheck -check-prefix=CHECK2 %s -CHECK: FileHeaders { -CHECK-NEXT: BlockSize: 4096 -CHECK-NEXT: FreeBlockMap: 2 -CHECK-NEXT: NumBlocks: 25 -CHECK-NEXT: NumDirectoryBytes: -CHECK-NEXT: Unknown1: 0 -CHECK-NEXT: BlockMapAddr: -CHECK-NEXT: NumDirectoryBlocks: 1 -CHECK-NEXT: DirectoryBlocks: -CHECK-NEXT: NumStreams: -CHECK-NEXT: } -CHECK: PDB Stream { -CHECK-NEXT: Version: 20000404 -CHECK-NEXT: Signature: 0x54E507E2 -CHECK-NEXT: Age: 1 -CHECK-NEXT: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} -CHECK-NEXT: } -CHECK: Type Info Stream (TPI) { -CHECK-NEXT: TPI Version: 20040203 -CHECK-NEXT: Record count: 75 -CHECK: DBI Stream { -CHECK-NEXT: Dbi Version: 19990903 -CHECK-NEXT: Age: 1 -CHECK-NEXT: Incremental Linking: Yes -CHECK-NEXT: Has CTypes: No -CHECK-NEXT: Is Stripped: No -CHECK-NEXT: Machine Type: x86 -CHECK-NEXT: Symbol Record Stream Index: -CHECK-NEXT: Public Symbol Stream Index: -CHECK-NEXT: Global Symbol Stream Index: -CHECK-NEXT: Toolchain Version: 12.0 -CHECK-NEXT: mspdb120.dll version: 12.0.31101 -CHECK-NEXT: } +CHECK1: FileHeaders { +CHECK1-NEXT: BlockSize: 4096 +CHECK1-NEXT: FreeBlockMap: 2 +CHECK1-NEXT: NumBlocks: 25 +CHECK1-NEXT: NumDirectoryBytes: +CHECK1-NEXT: Unknown1: 0 +CHECK1-NEXT: BlockMapAddr: +CHECK1-NEXT: NumDirectoryBlocks: 1 +CHECK1-NEXT: DirectoryBlocks: +CHECK1-NEXT: NumStreams: +CHECK1-NEXT: } +CHECK1: PDB Stream { +CHECK1-NEXT: Version: 20000404 +CHECK1-NEXT: Signature: 0x54E507E2 +CHECK1-NEXT: Age: 1 +CHECK1-NEXT: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +CHECK1-NEXT: } +CHECK1: Type Info Stream (TPI) { +CHECK1-NEXT: TPI Version: 20040203 +CHECK1-NEXT: Record count: 75 +CHECK1: DBI Stream { +CHECK1-NEXT: Dbi Version: 19990903 +CHECK1-NEXT: Age: 1 +CHECK1-NEXT: Incremental Linking: Yes +CHECK1-NEXT: Has CTypes: No +CHECK1-NEXT: Is Stripped: No +CHECK1-NEXT: Machine Type: x86 +CHECK1-NEXT: Symbol Record Stream Index: +CHECK1-NEXT: Public Symbol Stream Index: +CHECK1-NEXT: Global Symbol Stream Index: +CHECK1-NEXT: Toolchain Version: 12.0 +CHECK1-NEXT: mspdb120.dll version: 12.0.31101 +CHECK1-NEXT: } + +CHECK2: FileHeaders { +CHECK2-NEXT: BlockSize: 4096 +CHECK2-NEXT: FreeBlockMap: 1 +CHECK2-NEXT: NumBlocks: 10 +CHECK2-NEXT: NumDirectoryBytes: +CHECK2-NEXT: Unknown1: 0 +CHECK2-NEXT: BlockMapAddr: +CHECK2-NEXT: NumDirectoryBlocks: 1 +CHECK2-NEXT: DirectoryBlocks: +CHECK2-NEXT: NumStreams: +CHECK2-NEXT: } +CHECK2: PDB Stream { +CHECK2-NEXT: Version: 20000404 +CHECK2-NEXT: Signature: 0x54E507E2 +CHECK2-NEXT: Age: 1 +CHECK2-NEXT: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +CHECK2-NEXT: } +CHECK2: Type Info Stream (TPI) { +CHECK2-NEXT: TPI Version: 20040203 +CHECK2-NEXT: Record count: 75 +CHECK2: DBI Stream { +CHECK2-NEXT: Dbi Version: 19990903 +CHECK2-NEXT: Age: 1 +CHECK2-NEXT: Incremental Linking: Yes +CHECK2-NEXT: Has CTypes: No +CHECK2-NEXT: Is Stripped: No +CHECK2-NEXT: Machine Type: x86 +CHECK2-NEXT: Symbol Record Stream Index: +CHECK2-NEXT: Public Symbol Stream Index: +CHECK2-NEXT: Global Symbol Stream Index: +CHECK2-NEXT: Toolchain Version: 12.0 +CHECK2-NEXT: mspdb120.dll version: 12.0.31101 +CHECK2-NEXT: } Index: tools/llvm-pdbdump/llvm-pdbdump.cpp =================================================================== --- tools/llvm-pdbdump/llvm-pdbdump.cpp +++ tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -331,7 +331,7 @@ llvm::make_unique(std::move(*OutFileOrError)); PDBFileBuilder Builder(Allocator); - ExitOnErr(Builder.initialize(YamlObj.Headers->SuperBlock)); + ExitOnErr(Builder.initialize(YamlObj.Headers->SuperBlock.BlockSize)); // Add each of the reserved streams. We ignore stream metadata in the // yaml, because we will reconstruct our own view of the streams. For // example, the YAML may say that there were 20 streams in the original