Index: llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml =================================================================== --- llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml +++ /dev/null @@ -1,24 +0,0 @@ -DbiStream: - Modules: - - Module: 'Foo.obj' - ObjFile: 'Foo.obj' - Subsections: - - !CrossModuleExports - Exports: - - LocalId: 4852 - GlobalId: 9283 - - LocalId: 2147487875 - GlobalId: 9123 - - Module: 'Bar.obj' - ObjFile: 'Bar.obj' - Subsections: - - !CrossModuleExports - Exports: - - LocalId: 4265 - GlobalId: 6097 - - LocalId: 4297 - GlobalId: 4677 - - !CrossModuleImports - Imports: - - Module: 'Foo.obj' - Imports: [ 4852, 2147487875 ] Index: llvm/test/DebugInfo/PDB/Inputs/debug-subsections.yaml =================================================================== --- llvm/test/DebugInfo/PDB/Inputs/debug-subsections.yaml +++ llvm/test/DebugInfo/PDB/Inputs/debug-subsections.yaml @@ -1,6 +1,27 @@ ---- -DbiStream: - Modules: +DbiStream: + Modules: + - Module: 'Foo.obj' + ObjFile: 'Foo.obj' + Subsections: + - !CrossModuleExports + Exports: + - LocalId: 4852 + GlobalId: 9283 + - LocalId: 2147487875 + GlobalId: 9123 + - Module: 'Bar.obj' + ObjFile: 'Bar.obj' + Subsections: + - !CrossModuleExports + Exports: + - LocalId: 4265 + GlobalId: 6097 + - LocalId: 4297 + GlobalId: 4677 + - !CrossModuleImports + Imports: + - Module: 'Foo.obj' + Imports: [ 4852, 2147487875 ] - Module: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' ObjFile: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' SourceFiles: @@ -41,4 +62,3 @@ - FileName: 'f:\dd\externalapis\windows\10\sdk\inc\winerror.h' LineNum: 26950 Inlinee: 22767 -... Index: llvm/test/DebugInfo/PDB/cross-module-import-export.test =================================================================== --- llvm/test/DebugInfo/PDB/cross-module-import-export.test +++ /dev/null @@ -1,60 +0,0 @@ -; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/cross-module-import-export.yaml - -; RUN: llvm-pdbdump pdb2yaml -all -no-file-headers %t.pdb | FileCheck --check-prefix=YAML %s -; RUN: llvm-pdbdump raw -all %t.pdb | FileCheck --check-prefix=RAW %s - -YAML: Modules: -YAML-NEXT: - Module: Foo.obj -YAML-NEXT: ObjFile: Foo.obj -YAML-NEXT: Subsections: -YAML-NEXT: - !CrossModuleExports -YAML-NEXT: Exports: -YAML-NEXT: - LocalId: 4852 -YAML-NEXT: GlobalId: 9283 -YAML-NEXT: - LocalId: 2147487875 -YAML-NEXT: GlobalId: 9123 -YAML: - Module: Bar.obj -YAML-NEXT: ObjFile: Bar.obj -YAML-NEXT: Subsections: -YAML-NEXT: - !CrossModuleExports -YAML-NEXT: Exports: -YAML-NEXT: - LocalId: 4265 -YAML-NEXT: GlobalId: 6097 -YAML-NEXT: - LocalId: 4297 -YAML-NEXT: GlobalId: 4677 -YAML-NEXT: - !CrossModuleImports -YAML-NEXT: Imports: -YAML-NEXT: - Module: Foo.obj -YAML-NEXT: Imports: [ 4852, 2147487875 ] - - -RAW: DBI Stream { -RAW: Modules [ -RAW-NEXT: { -RAW-NEXT: Name: Foo.obj -RAW: LineInfo [ -RAW-NEXT: CrossModuleExports { -RAW-NEXT: Local: 0x12F4 -RAW-NEXT: Global: 0x2443 -RAW-NEXT: Local: 0x80001083 -RAW-NEXT: Global: 0x23A3 -RAW-NEXT: } -RAW-NEXT: ] -RAW-NEXT: } -RAW-NEXT: { -RAW-NEXT: Name: Bar.obj -RAW: LineInfo [ -RAW-NEXT: CrossModuleExports { -RAW-NEXT: Local: 0x10A9 -RAW-NEXT: Global: 0x17D1 -RAW-NEXT: Local: 0x10C9 -RAW-NEXT: Global: 0x1245 -RAW-NEXT: } -RAW-NEXT: CrossModuleImports { -RAW-NEXT: Module: Foo.obj -RAW-NEXT: Imports: [0x12F4, 0x80001083] -RAW-NEXT: } -RAW-NEXT: ] -RAW-NEXT: } -RAW-NEXT: ] -RAW-NEXT: } \ No newline at end of file Index: llvm/test/DebugInfo/PDB/pdb-minimal-construct.test =================================================================== --- llvm/test/DebugInfo/PDB/pdb-minimal-construct.test +++ llvm/test/DebugInfo/PDB/pdb-minimal-construct.test @@ -1,11 +1,11 @@ -; This testcase verifies that we can produce a minimal PDB, while -; serving as an example for how to construct a minimal PDB for other -; testcases. It takes as input a small fragment of hand-written yaml -; that specifies nothing about the PDB other than a definition of one -; symbol that it contains. Then it produces a PDB, and uses the -; resulting PDB to go back to yaml, and verify that the resulting yaml -; is identical. - -; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/one-symbol.yaml -; RUN: llvm-pdbdump pdb2yaml -minimal -dbi-module-syms -no-file-headers %t.pdb > %t.pdb.yaml -; RUN: diff -b %p/Inputs/one-symbol.yaml %t.pdb.yaml +; This testcase verifies that we can produce a minimal PDB, while +; serving as an example for how to construct a minimal PDB for other +; testcases. It takes as input a small fragment of hand-written yaml +; that specifies nothing about the PDB other than a definition of one +; symbol that it contains. Then it produces a PDB, and uses the +; resulting PDB to go back to yaml, and verify that the resulting yaml +; is identical. + +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/one-symbol.yaml +; RUN: llvm-pdbdump pdb2yaml -minimal -module-syms -no-file-headers %t.pdb > %t.pdb.yaml +; RUN: diff -b %p/Inputs/one-symbol.yaml %t.pdb.yaml Index: llvm/test/DebugInfo/PDB/pdb-yaml-symbols.test =================================================================== --- llvm/test/DebugInfo/PDB/pdb-yaml-symbols.test +++ llvm/test/DebugInfo/PDB/pdb-yaml-symbols.test @@ -1,4 +1,4 @@ -; RUN: llvm-pdbdump pdb2yaml -dbi-module-syms %p/Inputs/empty.pdb \ +; RUN: llvm-pdbdump pdb2yaml -module-syms %p/Inputs/empty.pdb \ ; RUN: | FileCheck -check-prefix=YAML %s Index: llvm/test/DebugInfo/PDB/pdbdump-debug-subsections.test =================================================================== --- /dev/null +++ llvm/test/DebugInfo/PDB/pdbdump-debug-subsections.test @@ -0,0 +1,162 @@ +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/debug-subsections.yaml + +; RUN: llvm-pdbdump pdb2yaml -all -no-file-headers %t.pdb | FileCheck --check-prefix=YAML %s +; RUN: llvm-pdbdump raw -subsections=all %t.pdb | FileCheck --check-prefix=RAW %s + +YAML: Modules: +YAML-NEXT: - Module: Foo.obj +YAML-NEXT: ObjFile: Foo.obj +YAML-NEXT: Subsections: +YAML-NEXT: - !CrossModuleExports +YAML-NEXT: Exports: +YAML-NEXT: - LocalId: 4852 +YAML-NEXT: GlobalId: 9283 +YAML-NEXT: - LocalId: 2147487875 +YAML-NEXT: GlobalId: 9123 +YAML: - Module: Bar.obj +YAML-NEXT: ObjFile: Bar.obj +YAML-NEXT: Subsections: +YAML-NEXT: - !CrossModuleExports +YAML-NEXT: Exports: +YAML-NEXT: - LocalId: 4265 +YAML-NEXT: GlobalId: 6097 +YAML-NEXT: - LocalId: 4297 +YAML-NEXT: GlobalId: 4677 +YAML-NEXT: - !CrossModuleImports +YAML-NEXT: Imports: +YAML-NEXT: - Module: Foo.obj +YAML-NEXT: Imports: [ 4852, 2147487875 ] +YAML: - Module: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' +YAML-NEXT: ObjFile: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' +YAML-NEXT: SourceFiles: +YAML-NEXT: - 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' +YAML-NEXT: Subsections: +YAML-NEXT: - !FileChecksums +YAML-NEXT: Checksums: +YAML-NEXT: - FileName: 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' +YAML-NEXT: Kind: MD5 +YAML-NEXT: Checksum: A0A5BD0D3ECD93FC29D19DE826FBF4BC +YAML-NEXT: - FileName: 'f:\dd\externalapis\windows\10\sdk\inc\winerror.h' +YAML-NEXT: Kind: MD5 +YAML-NEXT: Checksum: 1154D69F5B2650196E1FC34F4134E56B +YAML-NEXT: - !Lines +YAML-NEXT: CodeSize: 10 +YAML-NEXT: Flags: [ ] +YAML-NEXT: RelocOffset: 16 +YAML-NEXT: RelocSegment: 1 +YAML-NEXT: Blocks: +YAML-NEXT: - FileName: 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' +YAML-NEXT: Lines: +YAML-NEXT: - Offset: 0 +YAML-NEXT: LineStart: 5 +YAML-NEXT: IsStatement: true +YAML-NEXT: EndDelta: 0 +YAML-NEXT: - Offset: 3 +YAML-NEXT: LineStart: 6 +YAML-NEXT: IsStatement: true +YAML-NEXT: EndDelta: 0 +YAML-NEXT: - Offset: 8 +YAML-NEXT: LineStart: 7 +YAML-NEXT: IsStatement: true +YAML-NEXT: EndDelta: 0 +YAML-NEXT: Columns: +YAML-NEXT: - !InlineeLines +YAML-NEXT: HasExtraFiles: false +YAML-NEXT: Sites: +YAML-NEXT: - FileName: 'f:\dd\externalapis\windows\10\sdk\inc\winerror.h' +YAML-NEXT: LineNum: 26950 +YAML-NEXT: Inlinee: 22767 + + +RAW: DBI Stream { +RAW: Modules [ +RAW-NEXT: { +RAW-NEXT: Name: Foo.obj +RAW: Subsections [ +RAW-NEXT: CrossModuleExports { +RAW-NEXT: Local: 0x12F4 +RAW-NEXT: Global: 0x2443 +RAW-NEXT: Local: 0x80001083 +RAW-NEXT: Global: 0x23A3 +RAW-NEXT: } +RAW-NEXT: ] +RAW-NEXT: } +RAW-NEXT: { +RAW-NEXT: Name: Bar.obj +RAW: Subsections [ +RAW-NEXT: CrossModuleExports { +RAW-NEXT: Local: 0x10A9 +RAW-NEXT: Global: 0x17D1 +RAW-NEXT: Local: 0x10C9 +RAW-NEXT: Global: 0x1245 +RAW-NEXT: } +RAW-NEXT: CrossModuleImports { +RAW-NEXT: Module: Foo.obj +RAW-NEXT: Imports: [0x12F4, 0x80001083] +RAW-NEXT: } +RAW-NEXT: ] +RAW-NEXT: } +RAW-NEXT: { +RAW-NEXT: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj +RAW: Subsections [ +RAW-NEXT: FileChecksums { +RAW-NEXT: Checksum { +RAW-NEXT: FileName: d:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp +RAW-NEXT: Kind: MD5 (0x1) +RAW-NEXT: Checksum ( +RAW-NEXT: 0000: A0A5BD0D 3ECD93FC 29D19DE8 26FBF4BC |....>...)...&...| +RAW-NEXT: ) +RAW-NEXT: } +RAW-NEXT: Checksum { +RAW-NEXT: FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h +RAW-NEXT: Kind: MD5 (0x1) +RAW-NEXT: Checksum ( +RAW-NEXT: 0000: 1154D69F 5B265019 6E1FC34F 4134E56B |.T..[&P.n..OA4.k| +RAW-NEXT: ) +RAW-NEXT: } +RAW-NEXT: } +RAW-NEXT: Lines { +RAW-NEXT: Block { +RAW-NEXT: RelocSegment: 1 +RAW-NEXT: RelocOffset: 16 +RAW-NEXT: CodeSize: 10 +RAW-NEXT: HasColumns: No +RAW-NEXT: Lines { +RAW-NEXT: FileName: d:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp +RAW-NEXT: Line { +RAW-NEXT: Offset: 0 +RAW-NEXT: LineNumberStart: 5 +RAW-NEXT: EndDelta: 0 +RAW-NEXT: IsStatement: Yes +RAW-NEXT: } +RAW-NEXT: Line { +RAW-NEXT: Offset: 3 +RAW-NEXT: LineNumberStart: 6 +RAW-NEXT: EndDelta: 0 +RAW-NEXT: IsStatement: Yes +RAW-NEXT: } +RAW-NEXT: Line { +RAW-NEXT: Offset: 8 +RAW-NEXT: LineNumberStart: 7 +RAW-NEXT: EndDelta: 0 +RAW-NEXT: IsStatement: Yes +RAW-NEXT: } +RAW-NEXT: } +RAW-NEXT: } +RAW-NEXT: } +RAW-NEXT: InlineeLines { +RAW-NEXT: HasExtraFiles: No +RAW-NEXT: Lines [ +RAW-NEXT: Inlinee { +RAW-NEXT: FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h +RAW-NEXT: Function { +RAW-NEXT: Index: 0x58ef (unknown function) +RAW-NEXT: } +RAW-NEXT: SourceLine: 26950 +RAW-NEXT: } +RAW-NEXT: ] +RAW-NEXT: } +RAW-NEXT: ] +RAW-NEXT: } +RAW-NEXT: ] +RAW-NEXT:} Index: llvm/test/DebugInfo/PDB/pdbdump-headers.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-headers.test +++ llvm/test/DebugInfo/PDB/pdbdump-headers.test @@ -1,7 +1,7 @@ ; RUN: llvm-pdbdump raw -headers -string-table -tpi-records -tpi-record-bytes -module-syms \ ; RUN: -sym-record-bytes -globals -publics -module-files \ ; RUN: -stream-summary -stream-blocks -ipi-records -ipi-record-bytes \ -; RUN: -section-contribs -section-map -section-headers -line-info \ +; RUN: -section-contribs -section-map -section-headers -subsections=all \ ; RUN: -tpi-hash -fpo -page-stats %p/Inputs/empty.pdb | FileCheck -check-prefix=EMPTY %s ; RUN: llvm-pdbdump raw -all %p/Inputs/empty.pdb | FileCheck -check-prefix=ALL %s ; RUN: llvm-pdbdump raw -headers -modules -module-files \ @@ -484,7 +484,7 @@ ; EMPTY-NEXT: ) ; EMPTY-NEXT: } ; EMPTY-NEXT: ] -; EMPTY-NEXT: LineInfo [ +; EMPTY-NEXT: Subsections [ ; EMPTY-NEXT: FileChecksums { ; EMPTY-NEXT: Checksum { ; EMPTY-NEXT: FileName: d:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp @@ -757,7 +757,7 @@ ; EMPTY-NEXT: ) ; EMPTY-NEXT: } ; EMPTY-NEXT: ] -; EMPTY-NEXT: LineInfo [ +; EMPTY-NEXT: Subsections [ ; EMPTY-NEXT: ] ; EMPTY-NEXT: } ; EMPTY-NEXT: ] Index: llvm/test/DebugInfo/PDB/pdbdump-readwrite.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-readwrite.test +++ llvm/test/DebugInfo/PDB/pdbdump-readwrite.test @@ -1,5 +1,5 @@ -RUN: llvm-pdbdump pdb2yaml -dbi-module-info -dbi-module-source-info \ -RUN: -dbi-stream -pdb-stream -string-table -tpi-stream -stream-directory \ +RUN: llvm-pdbdump pdb2yaml -modules -module-files -dbi-stream \ +RUN: -pdb-stream -string-table -tpi-stream -stream-directory \ RUN: -stream-metadata %p/Inputs/empty.pdb > %t.1 RUN: llvm-pdbdump yaml2pdb -pdb=%t.2 %t.1 Index: llvm/test/DebugInfo/PDB/pdbdump-source-names.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-source-names.test +++ llvm/test/DebugInfo/PDB/pdbdump-source-names.test @@ -7,10 +7,10 @@ # pass if alignment is implemented correctly. RUN: llvm-pdbdump yaml2pdb -pdb=%T/source-names-1.pdb %p/Inputs/source-names-1.yaml -RUN: llvm-pdbdump pdb2yaml -dbi-module-source-info %T/source-names-1.pdb \ +RUN: llvm-pdbdump pdb2yaml -module-files %T/source-names-1.pdb \ RUN: | FileCheck -check-prefix=CHECK1 %s RUN: llvm-pdbdump yaml2pdb -pdb=%T/source-names-2.pdb %p/Inputs/source-names-2.yaml -RUN: llvm-pdbdump pdb2yaml -dbi-module-source-info %T/source-names-2.pdb \ +RUN: llvm-pdbdump pdb2yaml -module-files %T/source-names-2.pdb \ RUN: | FileCheck -check-prefix=CHECK2 %s CHECK1: SourceFiles: Index: llvm/test/DebugInfo/PDB/pdbdump-write.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-write.test +++ llvm/test/DebugInfo/PDB/pdbdump-write.test @@ -11,10 +11,10 @@ ; (for example if we don't write the entire stream) ; ; RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory \ -; RUN: -pdb-stream -tpi-stream -dbi-module-syms %p/Inputs/empty.pdb > %t.1 +; RUN: -pdb-stream -tpi-stream -module-syms %p/Inputs/empty.pdb > %t.1 ; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2 %t.1 ; RUN: llvm-pdbdump pdb2yaml -pdb-stream -tpi-stream \ -; RUN: -dbi-module-syms -no-file-headers %p/Inputs/empty.pdb > %t.3 +; RUN: -module-syms -no-file-headers %p/Inputs/empty.pdb > %t.3 ; RUN: llvm-pdbdump pdb2yaml -pdb-stream -tpi-stream \ -; RUN: -dbi-module-syms -no-file-headers %t.2 > %t.4 +; RUN: -module-syms -no-file-headers %t.2 > %t.4 ; RUN: diff %t.3 %t.4 Index: llvm/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-yaml-lineinfo-write.test +++ /dev/null @@ -1,71 +0,0 @@ -; This testcase verifies that we can produce a PDB with line -; information. It does this by describing some line information -; manually in YAML, creating a PDB out of it, then dumping then -; line information from the resulting PDB. - -; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/simple-line-info.yaml -; RUN: llvm-pdbdump raw -line-info %t.pdb | FileCheck -check-prefix=LINES %s - -LINES: Modules [ -LINES-NEXT: { -LINES-NEXT: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj -LINES: LineInfo [ -LINES-NEXT: FileChecksums { -LINES-NEXT: Checksum { -LINES-NEXT: FileName: d:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp -LINES-NEXT: Kind: MD5 (0x1) -LINES-NEXT: Checksum ( -LINES-NEXT: 0000: A0A5BD0D 3ECD93FC 29D19DE8 26FBF4BC |....>...)...&...| -LINES-NEXT: ) -LINES-NEXT: } -LINES-NEXT: Checksum { -LINES-NEXT: FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h -LINES-NEXT: Kind: MD5 (0x1) -LINES-NEXT: Checksum ( -LINES-NEXT: 0000: 1154D69F 5B265019 6E1FC34F 4134E56B |.T..[&P.n..OA4.k| -LINES-NEXT: ) -LINES-NEXT: } -LINES-NEXT: } -LINES-NEXT: Lines { -LINES-NEXT: Block { -LINES-NEXT: RelocSegment: 1 -LINES-NEXT: RelocOffset: 16 -LINES-NEXT: CodeSize: 10 -LINES-NEXT: HasColumns: No -LINES-NEXT: Lines { -LINES-NEXT: FileName: d:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp -LINES-NEXT: Line { -LINES-NEXT: Offset: 0 -LINES-NEXT: LineNumberStart: 5 -LINES-NEXT: EndDelta: 0 -LINES-NEXT: IsStatement: Yes -LINES-NEXT: } -LINES-NEXT: Line { -LINES-NEXT: Offset: 3 -LINES-NEXT: LineNumberStart: 6 -LINES-NEXT: EndDelta: 0 -LINES-NEXT: IsStatement: Yes -LINES-NEXT: } -LINES-NEXT: Line { -LINES-NEXT: Offset: 8 -LINES-NEXT: LineNumberStart: 7 -LINES-NEXT: EndDelta: 0 -LINES-NEXT: IsStatement: Yes -LINES-NEXT: } -LINES-NEXT: } -LINES-NEXT: } -LINES-NEXT: } -LINES-NEXT: InlineeLines { -LINES-NEXT: HasExtraFiles: No -LINES-NEXT: Lines [ -LINES-NEXT: Inlinee { -LINES-NEXT: FileName: f:\dd\externalapis\windows\10\sdk\inc\winerror.h -LINES-NEXT: Function { -LINES-NEXT: Index: 0x58ef (unknown function) -LINES-NEXT: } -LINES-NEXT: SourceLine: 26950 -LINES-NEXT: } -LINES-NEXT: ] -LINES-NEXT: } -LINES-NEXT: ] -LINES-NEXT: } Index: llvm/test/DebugInfo/PDB/pdbdump-yaml-lineinfo.test =================================================================== --- llvm/test/DebugInfo/PDB/pdbdump-yaml-lineinfo.test +++ /dev/null @@ -1,60 +0,0 @@ -; RUN: llvm-pdbdump pdb2yaml -dbi-module-lines %p/Inputs/empty.pdb \ -; RUN: | FileCheck -check-prefix=YAML %s - - -YAML: --- -YAML: MSF: -YAML: SuperBlock: -YAML: BlockSize: 4096 -YAML: FreeBlockMap: 2 -YAML: NumBlocks: 25 -YAML: NumDirectoryBytes: 136 -YAML: Unknown1: 0 -YAML: BlockMapAddr: 24 -YAML: NumDirectoryBlocks: 1 -YAML: DirectoryBlocks: [ 23 ] -YAML: NumStreams: 0 -YAML: FileSize: 102400 -YAML: DbiStream: -YAML: VerHeader: V70 -YAML: Age: 1 -YAML: BuildNumber: 35840 -YAML: PdbDllVersion: 31101 -YAML: PdbDllRbld: 0 -YAML: Flags: 1 -YAML: MachineType: x86 -YAML: Modules: -YAML: - Module: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' -YAML: ObjFile: 'd:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj' -YAML: SourceFiles: -YAML: - 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' -YAML: Subsections: -YAML: - !Lines -YAML: CodeSize: 10 -YAML: Flags: [ ] -YAML: RelocOffset: 16 -YAML: RelocSegment: 1 -YAML: Blocks: -YAML: - FileName: 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' -YAML: Lines: -YAML: - Offset: 0 -YAML: LineStart: 5 -YAML: IsStatement: true -YAML: EndDelta: 0 -YAML: - Offset: 3 -YAML: LineStart: 6 -YAML: IsStatement: true -YAML: EndDelta: 0 -YAML: - Offset: 8 -YAML: LineStart: 7 -YAML: IsStatement: true -YAML: EndDelta: 0 -YAML: Columns: -YAML: - !FileChecksums -YAML: Checksums: -YAML: - FileName: 'd:\src\llvm\test\debuginfo\pdb\inputs\empty.cpp' -YAML: Kind: MD5 -YAML: Checksum: A0A5BD0D3ECD93FC29D19DE826FBF4BC -YAML: - Module: '* Linker *' -YAML: ObjFile: '' -YAML: ... \ No newline at end of file Index: llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp =================================================================== --- llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp +++ llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp @@ -89,7 +89,8 @@ : C13DebugFragmentVisitor(F), P(P), IPI(IPI) {} Error handleLines() override { - if (Lines.empty()) + if (Lines.empty() || + !opts::checkModuleSubsection(opts::ModuleSubsection::Lines)) return Error::success(); DictScope DD(P, "Lines"); @@ -132,7 +133,8 @@ } Error handleFileChecksums() override { - if (!Checksums.hasValue()) + if (!Checksums.hasValue() || + !opts::checkModuleSubsection(opts::ModuleSubsection::FileChecksums)) return Error::success(); DictScope DD(P, "FileChecksums"); @@ -149,7 +151,8 @@ } Error handleInlineeLines() override { - if (InlineeLines.empty()) + if (InlineeLines.empty() || + !opts::checkModuleSubsection(opts::ModuleSubsection::InlineeLines)) return Error::success(); DictScope D(P, "InlineeLines"); @@ -177,6 +180,10 @@ } Error handleCrossModuleExports() override { + if (CrossExports.empty() || + !opts::checkModuleSubsection(opts::ModuleSubsection::CrossScopeExports)) + return Error::success(); + for (const auto &M : CrossExports) { DictScope D(P, "CrossModuleExports"); for (const auto &E : M) { @@ -188,6 +195,10 @@ } Error handleCrossModuleImports() override { + if (CrossImports.empty() || + !opts::checkModuleSubsection(opts::ModuleSubsection::CrossScopeImports)) + return Error::success(); + for (const auto &M : CrossImports) { DictScope D(P, "CrossModuleImports"); for (const auto &ImportGroup : M) { @@ -755,8 +766,10 @@ } Error LLVMOutputStyle::dumpDbiStream() { - bool DumpModules = opts::raw::DumpModules || opts::raw::DumpModuleSyms || - opts::raw::DumpModuleFiles || opts::raw::DumpLineInfo; + bool DumpModules = opts::shared::DumpModules || + opts::shared::DumpModuleSyms || + opts::shared::DumpModuleFiles || + !opts::shared::DumpModuleSubsections.empty(); if (!opts::raw::DumpHeaders && !DumpModules) return Error::success(); if (!File.hasPDBDbiStream()) { @@ -806,7 +819,7 @@ P.printNumber("Symbol Byte Size", Modi.getSymbolDebugInfoByteSize()); P.printNumber("Type Server Index", Modi.getTypeServerIndex()); P.printBoolean("Has EC Info", Modi.hasECInfo()); - if (opts::raw::DumpModuleFiles) { + if (opts::shared::DumpModuleFiles) { std::string FileListName = to_string(Modules.getSourceFileCount(I)) + " Contributing Source Files"; ListScope LL(P, FileListName); @@ -815,8 +828,9 @@ } bool HasModuleDI = (Modi.getModuleStreamIndex() < File.getNumStreams()); bool ShouldDumpSymbols = - (opts::raw::DumpModuleSyms || opts::raw::DumpSymRecordBytes); - if (HasModuleDI && (ShouldDumpSymbols || opts::raw::DumpLineInfo)) { + (opts::shared::DumpModuleSyms || opts::raw::DumpSymRecordBytes); + if (HasModuleDI && + (ShouldDumpSymbols || !opts::shared::DumpModuleSubsections.empty())) { auto ModStreamData = MappedBlockStream::createIndexedStream( File.getMsfLayout(), File.getMsfBuffer(), Modi.getModuleStreamIndex(), File.getAllocator()); @@ -837,7 +851,7 @@ bool HadError = false; for (auto S : ModS.symbols(&HadError)) { DictScope LL(P, ""); - if (opts::raw::DumpModuleSyms) { + if (opts::shared::DumpModuleSyms) { if (auto EC = SD.dump(S)) { llvm::consumeError(std::move(EC)); HadError = true; @@ -852,8 +866,8 @@ raw_error_code::corrupt_file, "DBI stream contained corrupt symbol record"); } - if (opts::raw::DumpLineInfo) { - ListScope SS(P, "LineInfo"); + if (!opts::shared::DumpModuleSubsections.empty()) { + ListScope SS(P, "Subsections"); auto ExpectedTypes = initializeTypeDatabase(StreamIPI); if (!ExpectedTypes) return ExpectedTypes.takeError(); Index: llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp =================================================================== --- llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp +++ llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp @@ -44,33 +44,30 @@ opts::pdb2yaml::PdbStream = true; opts::pdb2yaml::StringTable = true; opts::pdb2yaml::DbiStream = true; - opts::pdb2yaml::DbiModuleInfo = true; - opts::pdb2yaml::DbiModuleSyms = true; - opts::pdb2yaml::DbiModuleSourceFileInfo = true; - opts::pdb2yaml::DbiModuleSourceLineInfo = true; + // opts::pdb2yaml::DbiModuleSourceLineInfo = true; opts::pdb2yaml::TpiStream = true; opts::pdb2yaml::IpiStream = true; } if (opts::pdb2yaml::StreamDirectory) opts::pdb2yaml::StreamMetadata = true; - if (opts::pdb2yaml::DbiModuleSyms) - opts::pdb2yaml::DbiModuleInfo = true; + if (opts::shared::DumpModuleSyms) + opts::shared::DumpModules = true; - if (opts::pdb2yaml::DbiModuleSourceLineInfo) - opts::pdb2yaml::DbiModuleSourceFileInfo = true; + // if (opts::pdb2yaml::DbiModuleSourceLineInfo) + // opts::pdb2yaml::DbiModuleSourceFileInfo = true; - if (opts::pdb2yaml::DbiModuleSourceFileInfo) - opts::pdb2yaml::DbiModuleInfo = true; + if (opts::shared::DumpModuleFiles) + opts::shared::DumpModules = true; - if (opts::pdb2yaml::DbiModuleInfo) + if (opts::shared::DumpModules) opts::pdb2yaml::DbiStream = true; // Some names from the module source file info get pulled from the string // table, so if we're writing module source info, we have to write the string // table as well. - if (opts::pdb2yaml::DbiModuleSourceLineInfo) - opts::pdb2yaml::StringTable = true; + // if (opts::pdb2yaml::DbiModuleSourceLineInfo) + // opts::pdb2yaml::StringTable = true; if (auto EC = dumpFileHeaders()) return EC; @@ -124,8 +121,8 @@ } Error YAMLOutputStyle::dumpStringTable() { - bool RequiresStringTable = opts::pdb2yaml::DbiModuleSourceFileInfo || - opts::pdb2yaml::DbiModuleSourceLineInfo; + bool RequiresStringTable = opts::shared::DumpModuleFiles || + !opts::shared::DumpModuleSubsections.empty(); bool RequestedStringTable = opts::pdb2yaml::StringTable; if (!RequiresStringTable && !RequestedStringTable) return Error::success(); @@ -191,6 +188,24 @@ return Error::success(); } +static opts::ModuleSubsection convertSubsectionKind(DebugSubsectionKind K) { + switch (K) { + case DebugSubsectionKind::CrossScopeExports: + return opts::ModuleSubsection::CrossScopeExports; + case DebugSubsectionKind::CrossScopeImports: + return opts::ModuleSubsection::CrossScopeImports; + case DebugSubsectionKind::FileChecksums: + return opts::ModuleSubsection::FileChecksums; + case DebugSubsectionKind::InlineeLines: + return opts::ModuleSubsection::InlineeLines; + case DebugSubsectionKind::Lines: + return opts::ModuleSubsection::Lines; + default: + return opts::ModuleSubsection::Unknown; + } + llvm_unreachable("Unreachable!"); +} + Error YAMLOutputStyle::dumpDbiStream() { if (!opts::pdb2yaml::DbiStream) return Error::success(); @@ -208,7 +223,7 @@ Obj.DbiStream->PdbDllRbld = DS.getPdbDllRbld(); Obj.DbiStream->PdbDllVersion = DS.getPdbDllVersion(); Obj.DbiStream->VerHeader = DS.getDbiVersion(); - if (opts::pdb2yaml::DbiModuleInfo) { + if (opts::shared::DumpModules) { const auto &Modules = DS.modules(); for (uint32_t I = 0; I < Modules.getModuleCount(); ++I) { DbiModuleDescriptor MI = Modules.getModuleDescriptor(I); @@ -218,7 +233,7 @@ DMI.Mod = MI.getModuleName(); DMI.Obj = MI.getObjFileName(); - if (opts::pdb2yaml::DbiModuleSourceFileInfo) { + if (opts::shared::DumpModuleFiles) { auto Files = Modules.source_files(I); DMI.SourceFiles.assign(Files.begin(), Files.end()); } @@ -238,13 +253,17 @@ auto ExpectedST = File.getStringTable(); if (!ExpectedST) return ExpectedST.takeError(); - if (opts::pdb2yaml::DbiModuleSourceLineInfo && + if (!opts::shared::DumpModuleSubsections.empty() && ModS.hasDebugSubsections()) { auto ExpectedChecksums = ModS.findChecksumsSubsection(); if (!ExpectedChecksums) return ExpectedChecksums.takeError(); for (const auto &SS : ModS.subsections()) { + opts::ModuleSubsection OptionKind = convertSubsectionKind(SS.kind()); + if (!opts::checkModuleSubsection(OptionKind)) + continue; + auto Converted = CodeViewYAML::YAMLDebugSubsection::fromCodeViewSubection( ExpectedST->getStringTable(), *ExpectedChecksums, SS); @@ -254,7 +273,7 @@ } } - if (opts::pdb2yaml::DbiModuleSyms) { + if (opts::shared::DumpModuleSyms) { DMI.Modi.emplace(); DMI.Modi->Signature = ModS.signature(); Index: llvm/tools/llvm-pdbdump/llvm-pdbdump.h =================================================================== --- llvm/tools/llvm-pdbdump/llvm-pdbdump.h +++ llvm/tools/llvm-pdbdump/llvm-pdbdump.h @@ -27,6 +27,25 @@ namespace opts { +enum class ModuleSubsection { + Unknown, + Lines, + FileChecksums, + InlineeLines, + CrossScopeImports, + CrossScopeExports, + All +}; + +bool checkModuleSubsection(ModuleSubsection Kind); + +template +bool checkModuleSubsection(ModuleSubsection K1, ModuleSubsection K2, + Ts &&... Rest) { + return checkModuleSubsection(K1) || + checkModuleSubsection(K2, std::forward(Rest)...); +} + namespace pretty { enum class ClassDefinitionFormat { None, Layout, All }; @@ -96,13 +115,8 @@ extern llvm::cl::opt DumpTpiRecords; extern llvm::cl::opt DumpIpiRecords; extern llvm::cl::opt DumpIpiRecordBytes; -extern llvm::cl::opt DumpModules; -extern llvm::cl::opt DumpModuleFiles; -extern llvm::cl::opt DumpModuleLines; -extern llvm::cl::opt DumpModuleSyms; extern llvm::cl::opt DumpPublics; extern llvm::cl::opt DumpSectionContribs; -extern llvm::cl::opt DumpLineInfo; extern llvm::cl::opt DumpSectionMap; extern llvm::cl::opt DumpSymRecordBytes; extern llvm::cl::opt DumpSectionHeaders; @@ -123,14 +137,17 @@ extern llvm::cl::opt StringTable; extern llvm::cl::opt PdbStream; extern llvm::cl::opt DbiStream; -extern llvm::cl::opt DbiModuleInfo; -extern llvm::cl::opt DbiModuleSyms; -extern llvm::cl::opt DbiModuleSourceFileInfo; -extern llvm::cl::opt DbiModuleSourceLineInfo; extern llvm::cl::opt TpiStream; extern llvm::cl::opt IpiStream; extern llvm::cl::list InputFilename; } + +namespace shared { +extern llvm::cl::opt DumpModules; +extern llvm::cl::opt DumpModuleFiles; +extern llvm::cl::list DumpModuleSubsections; +extern llvm::cl::opt DumpModuleSyms; +} } #endif Index: llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp =================================================================== --- llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp +++ llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp @@ -269,7 +269,6 @@ cl::OptionCategory MsfOptions("MSF Container Options"); cl::OptionCategory TypeOptions("Type Record Options"); -cl::OptionCategory FileOptions("Module & File Options"); cl::OptionCategory SymbolOptions("Symbol Options"); cl::OptionCategory MiscOptions("Miscellaneous Options"); @@ -323,20 +322,9 @@ cl::desc("dump CodeView type record raw bytes from IPI stream"), cl::cat(TypeOptions), cl::sub(RawSubcommand)); -// MODULE & FILE OPTIONS -cl::opt DumpModules("modules", cl::desc("dump compiland information"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); -cl::opt DumpModuleFiles("module-files", cl::desc("dump file information"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); -cl::opt DumpLineInfo("line-info", - cl::desc("dump file and line information"), - cl::cat(FileOptions), cl::sub(RawSubcommand)); - // SYMBOL OPTIONS cl::opt DumpGlobals("globals", cl::desc("dump globals stream data"), cl::cat(SymbolOptions), cl::sub(RawSubcommand)); -cl::opt DumpModuleSyms("module-syms", cl::desc("dump module symbols"), - cl::cat(SymbolOptions), cl::sub(RawSubcommand)); cl::opt DumpPublics("publics", cl::desc("dump Publics stream data"), cl::cat(SymbolOptions), cl::sub(RawSubcommand)); cl::opt @@ -381,11 +369,9 @@ cl::opt All("all", cl::desc("Dump everything we know how to dump."), cl::sub(PdbToYamlSubcommand), cl::init(false)); -cl::opt - NoFileHeaders("no-file-headers", - cl::desc("Do not dump MSF file headers (you will not be able " - "to generate a fresh PDB from the resulting YAML)"), - cl::sub(PdbToYamlSubcommand), cl::init(false)); +cl::opt NoFileHeaders("no-file-headers", + cl::desc("Do not dump MSF file headers"), + cl::sub(PdbToYamlSubcommand), cl::init(false)); cl::opt Minimal("minimal", cl::desc("Don't write fields with default values"), cl::sub(PdbToYamlSubcommand), cl::init(false)); @@ -406,29 +392,8 @@ cl::sub(PdbToYamlSubcommand), cl::init(false)); cl::opt DbiStream("dbi-stream", - cl::desc("Dump the DBI Stream (Stream 2)"), + cl::desc("Dump the DBI Stream Headers (Stream 2)"), cl::sub(PdbToYamlSubcommand), cl::init(false)); -cl::opt - DbiModuleInfo("dbi-module-info", - cl::desc("Dump DBI Module Information (implies -dbi-stream)"), - cl::sub(PdbToYamlSubcommand), cl::init(false)); - -cl::opt DbiModuleSyms( - "dbi-module-syms", - cl::desc("Dump DBI Module Information (implies -dbi-module-info)"), - cl::sub(PdbToYamlSubcommand), cl::init(false)); - -cl::opt DbiModuleSourceFileInfo( - "dbi-module-source-info", - cl::desc( - "Dump DBI Module Source File Information (implies -dbi-module-info)"), - cl::sub(PdbToYamlSubcommand), cl::init(false)); - -cl::opt - DbiModuleSourceLineInfo("dbi-module-lines", - cl::desc("Dump DBI Module Source Line Information " - "(implies -dbi-module-source-info)"), - cl::sub(PdbToYamlSubcommand), cl::init(false)); cl::opt TpiStream("tpi-stream", cl::desc("Dump the TPI Stream (Stream 3)"), @@ -443,6 +408,39 @@ cl::sub(PdbToYamlSubcommand)); } +namespace shared { +cl::OptionCategory FileOptions("Module & File Options"); + +// MODULE & FILE OPTIONS +cl::opt DumpModules("modules", cl::desc("dump compiland information"), + cl::cat(FileOptions), cl::sub(RawSubcommand), + cl::sub(PdbToYamlSubcommand)); +cl::opt DumpModuleFiles("module-files", cl::desc("dump file information"), + cl::cat(FileOptions), cl::sub(RawSubcommand), + cl::sub(PdbToYamlSubcommand)); +cl::list DumpModuleSubsections( + "subsections", cl::ZeroOrMore, cl::CommaSeparated, + cl::desc("dump subsections from each module's debug stream"), + cl::values( + clEnumValN( + ModuleSubsection::CrossScopeExports, "cme", + "Cross module exports (DEBUG_S_CROSSSCOPEEXPORTS subsection)"), + clEnumValN( + ModuleSubsection::CrossScopeImports, "cmi", + "Cross module imports (DEBUG_S_CROSSSCOPEIMPORTS subsection)"), + clEnumValN(ModuleSubsection::FileChecksums, "fc", + "File checksums (DEBUG_S_CHECKSUMS subsection)"), + clEnumValN(ModuleSubsection::InlineeLines, "ilines", + "Inlinee lines (DEBUG_S_INLINEELINES subsection)"), + clEnumValN(ModuleSubsection::Lines, "lines", + "Lines (DEBUG_S_LINES subsection)"), + clEnumValN(ModuleSubsection::All, "all", "All known subsections")), + cl::cat(FileOptions), cl::sub(RawSubcommand), cl::sub(PdbToYamlSubcommand)); +cl::opt DumpModuleSyms("module-syms", cl::desc("dump module symbols"), + cl::cat(FileOptions), cl::sub(RawSubcommand), + cl::sub(PdbToYamlSubcommand)); +} + namespace analyze { cl::opt StringTable("hash-collisions", cl::desc("Find hash collisions"), cl::sub(AnalyzeSubcommand), cl::init(false)); @@ -463,6 +461,13 @@ static ExitOnError ExitOnErr; +bool opts::checkModuleSubsection(opts::ModuleSubsection MS) { + return any_of(opts::shared::DumpModuleSubsections, + [=](opts::ModuleSubsection M) { + return M == MS || M == opts::ModuleSubsection::All; + }); +} + static void yamlToPdb(StringRef Path) { BumpPtrAllocator Allocator; ErrorOr> ErrorOrBuffer = @@ -879,12 +884,23 @@ } } + if ((opts::RawSubcommand && opts::raw::RawAll) || + (opts::PdbToYamlSubcommand && opts::pdb2yaml::All)) { + opts::shared::DumpModules = true; + opts::shared::DumpModuleFiles = true; + opts::shared::DumpModuleSyms = true; + opts::shared::DumpModuleSubsections.push_back(opts::ModuleSubsection::All); + if (llvm::is_contained(opts::shared::DumpModuleSubsections, + opts::ModuleSubsection::All)) { + opts::shared::DumpModuleSubsections.reset(); + opts::shared::DumpModuleSubsections.push_back( + opts::ModuleSubsection::All); + } + } + if (opts::RawSubcommand) { if (opts::raw::RawAll) { opts::raw::DumpHeaders = true; - opts::raw::DumpModules = true; - opts::raw::DumpModuleFiles = true; - opts::raw::DumpModuleSyms = true; opts::raw::DumpGlobals = true; opts::raw::DumpPublics = true; opts::raw::DumpSectionHeaders = true; @@ -896,7 +912,6 @@ opts::raw::DumpIpiRecords = true; opts::raw::DumpSectionMap = true; opts::raw::DumpSectionContribs = true; - opts::raw::DumpLineInfo = true; opts::raw::DumpFpo = true; opts::raw::DumpStringTable = true; }