1 | // REQUIRES: lld |
2 | |
3 | // RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -gno-pubnames %s |
4 | // RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -gno-pubnames %S/Inputs/find-variable-file-2.cpp |
5 | // RUN: ld.lld %t-1.o %t-2.o -o %t |
6 | // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ |
7 | // RUN: FileCheck --check-prefix=ONE %s |
8 | // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ |
9 | // RUN: FileCheck --check-prefix=TWO %s |
10 | |
11 | // Run the same test with split-dwarf. This is interesting because the two |
12 | // split compile units will have the same offset (0). |
13 | // RUN: %clang -g -c -o %t-1.o --target=x86_64-pc-linux -gsplit-dwarf %s |
14 | // RUN: %clang -g -c -o %t-2.o --target=x86_64-pc-linux -gsplit-dwarf %S/Inputs/find-variable-file-2.cpp |
15 | // RUN: ld.lld %t-1.o %t-2.o -o %t |
16 | // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ |
17 | // RUN: FileCheck --check-prefix=ONE %s |
18 | // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ |
19 | // RUN: FileCheck --check-prefix=TWO %s |
20 | |
21 | // RUN: %clang -c -o %t-1.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %s |
22 | // RUN: %clang -c -o %t-2.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames %S/Inputs/find-variable-file-2.cpp |
23 | // RUN: ld.lld %t-1.o %t-2.o -o %t |
24 | // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES |
25 | // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ |
26 | // RUN: FileCheck --check-prefix=ONE %s |
27 | // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ |
28 | // RUN: FileCheck --check-prefix=TWO %s |
29 | |
30 | // Run the same test with split dwarf and pubnames to check whether we can find |
31 | // the compile unit using the name index if it is split. |
32 | // RUN: %clang -c -o %t-1.o --target=x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -gpubnames %s |
33 | // RUN: %clang -c -o %t-2.o --target=x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -gpubnames %S/Inputs/find-variable-file-2.cpp |
34 | // RUN: %clang -c -o %t-3.o --target=x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -gpubnames %S/Inputs/find-variable-file-3.cpp |
35 | // RUN: ld.lld %t-1.o %t-2.o %t-3.o -o %t |
36 | // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES |
37 | // RUN: lldb-test symbols --file=find-variable-file.cpp --find=variable %t | \ |
38 | // RUN: FileCheck --check-prefix=ONE %s |
39 | // RUN: lldb-test symbols --file=find-variable-file-2.cpp --find=variable %t | \ |
40 | // RUN: FileCheck --check-prefix=TWO %s |
41 | // RUN: lldb-test symbols --file=find-variable-file-3.cpp --find=variable \ |
42 | // RUN: --name=notexists %t |
43 | |
44 | // NAMES: Name: .debug_names |
45 | |
46 | // ONE: Found 1 variables: |
47 | namespace one { |
48 | int foo; |
49 | // ONE-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-variable-file.cpp:[[@LINE-1]] |
50 | } // namespace one |
51 | |
52 | extern "C" void _start() {} |
53 | |
54 | // TWO: Found 1 variables: |
55 | // TWO-DAG: name = "foo", {{.*}} decl = find-variable-file-2.cpp:2 |
56 | |