llvm-project
125 строк · 4.9 Кб
1Test the linker line tables on roughly the following example:
2
3==> foo.h <==
4void bar(void);
5inline void foo(void) {
6bar();
7}
8==> pdb_lines_1.c <==
9#include "foo.h"
10int main(void) {
11foo();
12return 42;
13}
14==> pdb_lines_2.c <==
15void bar(void) {
16}
17
18$ cl -c -Z7 pdb_lines*.c
19
20RUN: yaml2obj %S/Inputs/pdb_lines_1.yaml -o %t.pdb_lines_1.obj
21RUN: yaml2obj %S/Inputs/pdb_lines_2.yaml -o %t.pdb_lines_2.obj
22RUN: rm -f %t.exe %t.pdb
23RUN: lld-link -debug -entry:main -nodefaultlib -out:%t.exe -pdb:%t.pdb %t.pdb_lines_1.obj %t.pdb_lines_2.obj
24RUN: llvm-pdbutil pdb2yaml -modules -module-files -subsections=lines,fc %t.pdb | FileCheck %s
25
26CHECK-LABEL: DbiStream:
27CHECK-NEXT: VerHeader: V70
28CHECK-NEXT: Age: 1
29CHECK-NEXT: BuildNumber: 36363
30CHECK-NEXT: PdbDllVersion: 0
31CHECK-NEXT: PdbDllRbld: 0
32CHECK-NEXT: Flags: 0
33CHECK-NEXT: MachineType: Amd64
34CHECK-NEXT: Modules:
35
36CHECK-LABEL: - Module: {{.*}}pdb_lines_1.obj
37CHECK-NEXT: ObjFile: {{.*}}pdb_lines_1.obj
38CHECK-NEXT: SourceFiles:
39CHECK-NEXT: - '{{.*}}pdb_lines_1.c'
40CHECK-NEXT: - '{{.*}}foo.h'
41CHECK-NEXT: Subsections:
42CHECK-NEXT: - !Lines
43CHECK-NEXT: CodeSize: 19
44CHECK-NEXT: Flags: [ ]
45CHECK-NEXT: RelocOffset: 0
46CHECK-NEXT: RelocSegment: 1
47CHECK-NEXT: Blocks:
48CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
49CHECK-NEXT: Lines:
50CHECK-NEXT: - Offset: 0
51CHECK-NEXT: LineStart: 2
52CHECK-NEXT: IsStatement: true
53CHECK-NEXT: EndDelta: 0
54CHECK-NEXT: - Offset: 4
55CHECK-NEXT: LineStart: 3
56CHECK-NEXT: IsStatement: true
57CHECK-NEXT: EndDelta: 0
58CHECK-NEXT: - Offset: 9
59CHECK-NEXT: LineStart: 4
60CHECK-NEXT: IsStatement: true
61CHECK-NEXT: EndDelta: 0
62CHECK-NEXT: - Offset: 14
63CHECK-NEXT: LineStart: 5
64CHECK-NEXT: IsStatement: true
65CHECK-NEXT: EndDelta: 0
66CHECK-NEXT: Columns:
67CHECK-NEXT: - !Lines
68CHECK-NEXT: CodeSize: 14
69CHECK-NEXT: Flags: [ ]
70CHECK-NEXT: RelocOffset: 32
71CHECK-NEXT: RelocSegment: 1
72CHECK-NEXT: Blocks:
73CHECK-NEXT: - FileName: '{{.*}}foo.h'
74CHECK-NEXT: Lines:
75CHECK-NEXT: - Offset: 0
76CHECK-NEXT: LineStart: 2
77CHECK-NEXT: IsStatement: true
78CHECK-NEXT: EndDelta: 0
79CHECK-NEXT: - Offset: 4
80CHECK-NEXT: LineStart: 3
81CHECK-NEXT: IsStatement: true
82CHECK-NEXT: EndDelta: 0
83CHECK-NEXT: - Offset: 9
84CHECK-NEXT: LineStart: 4
85CHECK-NEXT: IsStatement: true
86CHECK-NEXT: EndDelta: 0
87CHECK-NEXT: Columns:
88CHECK-NEXT: - !FileChecksums
89CHECK-NEXT: Checksums:
90CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
91CHECK-NEXT: Kind: MD5
92CHECK-NEXT: Checksum: 4EB19DCD86C3BA2238A255C718572E7B
93CHECK-NEXT: - FileName: '{{.*}}foo.h'
94CHECK-NEXT: Kind: MD5
95CHECK-NEXT: Checksum: 061EB73ABB642532857A4F1D9CBAC323
96
97CHECK-LABEL: - Module: {{.*}}pdb_lines_2.obj
98CHECK-NEXT: ObjFile: {{.*}}pdb_lines_2.obj
99CHECK-NEXT: SourceFiles:
100CHECK-NEXT: - '{{.*}}pdb_lines_2.c'
101CHECK-NEXT: Subsections:
102CHECK-NEXT: - !Lines
103CHECK-NEXT: CodeSize: 1
104CHECK-NEXT: Flags: [ ]
105CHECK-NEXT: RelocOffset: 48
106CHECK-NEXT: RelocSegment: 1
107CHECK-NEXT: Blocks:
108CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
109CHECK-NEXT: Lines:
110CHECK-NEXT: - Offset: 0
111CHECK-NEXT: LineStart: 1
112CHECK-NEXT: IsStatement: true
113CHECK-NEXT: EndDelta: 0
114CHECK-NEXT: - Offset: 0
115CHECK-NEXT: LineStart: 2
116CHECK-NEXT: IsStatement: true
117CHECK-NEXT: EndDelta: 0
118CHECK-NEXT: Columns:
119CHECK-NEXT: - !FileChecksums
120CHECK-NEXT: Checksums:
121CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
122CHECK-NEXT: Kind: MD5
123CHECK-NEXT: Checksum: DF91CB3A2B8D917486574BB50CAC4CC7
124CHECK-NEXT: - Module: '* Linker *'
125CHECK-NEXT: ObjFile: ''
126