From d381c9842b059d3eef123c76d336881da81aff97 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 5 Oct 2016 21:37:25 +0000 Subject: [PATCH] Add an empty IPI stream. With this, "llvm-pdbdump yaml -ipi-stream" prints out an IPI stream. Previously it crashed because it can't handle the case where IPI stream doesn't exist. llvm-svn: 283392 --- lld/COFF/PDB.cpp | 6 ++++++ lld/test/COFF/pdb.test | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp index 5d10395..2b9a39f 100644 --- a/lld/COFF/PDB.cpp +++ b/lld/COFF/PDB.cpp @@ -38,6 +38,8 @@ void coff::createPDB(StringRef Path) { ExitOnErr(Builder.getMsfBuilder().addStream(1)); ExitOnErr(Builder.getMsfBuilder().addStream(1)); ExitOnErr(Builder.getMsfBuilder().addStream(1)); + ExitOnErr(Builder.getMsfBuilder().addStream(1)); + ExitOnErr(Builder.getMsfBuilder().addStream(1)); // Add an Info stream. auto &InfoBuilder = Builder.getInfoBuilder(); @@ -55,6 +57,10 @@ void coff::createPDB(StringRef Path) { auto &TpiBuilder = Builder.getTpiBuilder(); TpiBuilder.setVersionHeader(pdb::PdbTpiV80); + // Add an empty IPI stream. + auto &IpiBuilder = Builder.getIpiBuilder(); + IpiBuilder.setVersionHeader(pdb::PdbTpiV80); + // Write to a file. ExitOnErr(Builder.commit(Path)); } diff --git a/lld/test/COFF/pdb.test b/lld/test/COFF/pdb.test index 57d64e8..83de503 100644 --- a/lld/test/COFF/pdb.test +++ b/lld/test/COFF/pdb.test @@ -1,31 +1,36 @@ # RUN: yaml2obj %s > %t.obj # RUN: lld-link /debug /pdb:%t.pdb /dll /out:%t.dll /entry:DllMain %t.obj # RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \ -# RUN: %t.pdb | FileCheck %s +# RUN: -ipi-stream %t.pdb | FileCheck %s # CHECK: MSF: # CHECK-NEXT: SuperBlock: # CHECK-NEXT: BlockSize: 4096 # CHECK-NEXT: FreeBlockMap: -# CHECK-NEXT: NumBlocks: 8 -# CHECK-NEXT: NumDirectoryBytes: 28 +# CHECK-NEXT: NumBlocks: 10 +# CHECK-NEXT: NumDirectoryBytes: 44 # CHECK-NEXT: Unknown1: 0 # CHECK-NEXT: BlockMapAddr: 3 # CHECK-NEXT: NumDirectoryBlocks: 1 -# CHECK-NEXT: DirectoryBlocks: [ 7 ] -# CHECK-NEXT: NumStreams: 3 -# CHECK-NEXT: FileSize: 32768 -# CHECK-NEXT: StreamSizes: [ 1, 48, 56 ] +# CHECK-NEXT: DirectoryBlocks: [ 9 ] +# CHECK-NEXT: NumStreams: 5 +# CHECK-NEXT: FileSize: 40960 +# CHECK-NEXT: StreamSizes: [ 1, 48, 56, 1, 56 ] # CHECK-NEXT: StreamMap: # CHECK-NEXT: - Stream: [ 4 ] # CHECK-NEXT: - Stream: [ 5 ] # CHECK-NEXT: - Stream: [ 6 ] +# CHECK-NEXT: - Stream: [ 7 ] +# CHECK-NEXT: - Stream: [ 8 ] # CHECK-NEXT: PdbStream: # CHECK-NEXT: Age: 1 # CHECK-NEXT: Guid: '{00000000-0000-0000-0000-000000000000}' # CHECK-NEXT: Signature: 0 # CHECK-NEXT: Version: VC70 # CHECK-NEXT: NamedStreams: +# CHECK-NEXT: IpiStream: +# CHECK-NEXT: Version: VC80 +# CHECK-NEXT: Records: --- !COFF header: -- 2.7.4