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