forked from OSchip/llvm-project
76 lines
2.3 KiB
Plaintext
76 lines
2.3 KiB
Plaintext
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 = 0002: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 = 0002: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 = 0002: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 = 0002: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 = 0002: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 = 0002: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 = 0002: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 *`:
|