blob: 416cab02fd26c66abfcc58a42632dc8776f13f78 [file] [log] [blame]
Test the linker line tables on roughly the following example:
==> foo.h <==
void bar(void);
inline void foo(void) {
bar();
}
==> pdb_lines_1.c <==
#include "foo.h"
int main(void) {
foo();
return 42;
}
==> pdb_lines_2.c <==
void bar(void) {
}
$ cl -c -Z7 pdb_lines*.c
RUN: yaml2obj %S/Inputs/pdb_lines_1.yaml -o %t.pdb_lines_1.obj
RUN: yaml2obj %S/Inputs/pdb_lines_2.yaml -o %t.pdb_lines_2.obj
RUN: rm -f %t.exe %t.pdb
RUN: lld-link -debug -entry:main -nodefaultlib -out:%t.exe -pdb:%t.pdb %t.pdb_lines_1.obj %t.pdb_lines_2.obj
RUN: llvm-pdbutil pdb2yaml -modules -module-files -subsections=lines,fc %t.pdb | FileCheck %s
CHECK-LABEL: DbiStream:
CHECK-NEXT: VerHeader: V70
CHECK-NEXT: Age: 1
CHECK-NEXT: BuildNumber: 36363
CHECK-NEXT: PdbDllVersion: 0
CHECK-NEXT: PdbDllRbld: 0
CHECK-NEXT: Flags: 0
CHECK-NEXT: MachineType: Amd64
CHECK-NEXT: Modules:
CHECK-LABEL: - Module: {{.*}}pdb_lines_1.obj
CHECK-NEXT: ObjFile: {{.*}}pdb_lines_1.obj
CHECK-NEXT: SourceFiles:
CHECK-NEXT: - '{{.*}}pdb_lines_1.c'
CHECK-NEXT: - '{{.*}}foo.h'
CHECK-NEXT: Subsections:
CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 19
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 0
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
CHECK-NEXT: Lines:
CHECK-NEXT: - Offset: 0
CHECK-NEXT: LineStart: 2
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 4
CHECK-NEXT: LineStart: 3
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 9
CHECK-NEXT: LineStart: 4
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 14
CHECK-NEXT: LineStart: 5
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: Columns:
CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 14
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 32
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}foo.h'
CHECK-NEXT: Lines:
CHECK-NEXT: - Offset: 0
CHECK-NEXT: LineStart: 2
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 4
CHECK-NEXT: LineStart: 3
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 9
CHECK-NEXT: LineStart: 4
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: Columns:
CHECK-NEXT: - !FileChecksums
CHECK-NEXT: Checksums:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
CHECK-NEXT: Kind: MD5
CHECK-NEXT: Checksum: 4EB19DCD86C3BA2238A255C718572E7B
CHECK-NEXT: - FileName: '{{.*}}foo.h'
CHECK-NEXT: Kind: MD5
CHECK-NEXT: Checksum: 061EB73ABB642532857A4F1D9CBAC323
CHECK-LABEL: - Module: {{.*}}pdb_lines_2.obj
CHECK-NEXT: ObjFile: {{.*}}pdb_lines_2.obj
CHECK-NEXT: SourceFiles:
CHECK-NEXT: - '{{.*}}pdb_lines_2.c'
CHECK-NEXT: Subsections:
CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 1
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 48
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
CHECK-NEXT: Lines:
CHECK-NEXT: - Offset: 0
CHECK-NEXT: LineStart: 1
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: - Offset: 0
CHECK-NEXT: LineStart: 2
CHECK-NEXT: IsStatement: true
CHECK-NEXT: EndDelta: 0
CHECK-NEXT: Columns:
CHECK-NEXT: - !FileChecksums
CHECK-NEXT: Checksums:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
CHECK-NEXT: Kind: MD5
CHECK-NEXT: Checksum: DF91CB3A2B8D917486574BB50CAC4CC7
CHECK-NEXT: - Module: '* Linker *'
CHECK-NEXT: ObjFile: ''