pdb-scopes.test
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Consider this program:
$ cat a.c
void g(int x) {}
void f(int x);
int main(int argc) {
if (argc) {
int x = 42;
f(x);
} else {
int y = 13;
f(y);
}
}
$ cat b.c
extern void g();
void f(int x) {
if (x) {
int y = x + 3;
g(y);
} else {
int w = x + 4;
g(w);
}
}
This program is interesting because there are two TUs, and each TU has nested
scopes. Make sure we get the right parent and end offsets.
RUN: yaml2obj %S/Inputs/pdb-scopes-a.yaml -o %t-a.obj
RUN: yaml2obj %S/Inputs/pdb-scopes-b.yaml -o %t-b.obj
RUN: lld-link %t-a.obj %t-b.obj -debug -entry:main -nodefaultlib -out:%t.exe -pdb:%t.pdb
RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
CHECK-LABEL: Mod 0000 | `{{.*}}pdb-scopes.test.tmp-a.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `g`
CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 5
CHECK: debug start = 4, debug end = 4, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_GPROC32 [size = 44] `main`
CHECK: parent = 0, end = 384, addr = 0001:0016, code size = 58
CHECK: debug start = 8, debug end = 53, flags = none
CHECK: 276 | S_REGREL32 [size = 20] `argc`
CHECK: 296 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 336
CHECK: code size = 17, addr = 0001:0031
CHECK: 320 | S_REGREL32 [size = 16] `x`
CHECK: 336 | S_END [size = 4]
CHECK: 340 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 380
CHECK: code size = 17, addr = 0001:0050
CHECK: 364 | S_REGREL32 [size = 16] `y`
CHECK: 380 | S_END [size = 4]
CHECK: 384 | S_END [size = 4]
CHECK-LABEL: Mod 0001 | `{{.*}}pdb-scopes.test.tmp-b.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `f`
CHECK: parent = 0, end = 284, addr = 0001:0080, code size = 62
CHECK: debug start = 8, debug end = 57, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 236
CHECK: code size = 20, addr = 0001:0095
CHECK: 220 | S_REGREL32 [size = 16] `y`
CHECK: 236 | S_END [size = 4]
CHECK: 240 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 280
CHECK: code size = 20, addr = 0001:0117
CHECK: 264 | S_REGREL32 [size = 16] `w`
CHECK: 280 | S_END [size = 4]
CHECK: 284 | S_END [size = 4]
CHECK-LABEL: Mod 0002 | `* Linker *`: