1 // REQUIRES: lld 2 3 // RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gno-pubnames 4 // RUN: ld.lld %t.o -o %t 5 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ 6 // RUN: FileCheck --check-prefix=CONTEXT %s 7 // RUN: lldb-test symbols --name=foo --find=variable %t | \ 8 // RUN: FileCheck --check-prefix=NAME %s 9 // RUN: lldb-test symbols --regex --name=foo --find=variable %t | \ 10 // RUN: FileCheck --check-prefix=REGEX %s 11 // RUN: lldb-test symbols --name=not_there --find=variable %t | \ 12 // RUN: FileCheck --check-prefix=EMPTY %s 13 // 14 // RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx 15 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ 16 // RUN: FileCheck --check-prefix=CONTEXT %s 17 // RUN: lldb-test symbols --name=foo --find=variable %t | \ 18 // RUN: FileCheck --check-prefix=NAME %s 19 // RUN: lldb-test symbols --regex --name=foo --find=variable %t | \ 20 // RUN: FileCheck --check-prefix=REGEX %s 21 // RUN: lldb-test symbols --name=not_there --find=variable %t | \ 22 // RUN: FileCheck --check-prefix=EMPTY %s 23 // 24 // RUN: %clang %s -g -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames 25 // RUN: ld.lld %t.o -o %t 26 // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES 27 // RUN: lldb-test symbols --name=foo --find=variable --context=context %t | \ 28 // RUN: FileCheck --check-prefix=CONTEXT %s 29 // RUN: lldb-test symbols --name=foo --find=variable %t | \ 30 // RUN: FileCheck --check-prefix=NAME %s 31 // RUN: lldb-test symbols --regex --name=foo --find=variable %t | \ 32 // RUN: FileCheck --check-prefix=REGEX %s 33 // RUN: lldb-test symbols --name=not_there --find=variable %t | \ 34 // RUN: FileCheck --check-prefix=EMPTY %s 35 36 // NAMES: Name: .debug_names 37 38 // EMPTY: Found 0 variables: 39 // NAME: Found 4 variables: 40 // CONTEXT: Found 1 variables: 41 // REGEX: Found 5 variables: 42 int foo; 43 // NAME-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-basic-variable.cpp:[[@LINE-1]] 44 // REGEX-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-basic-variable.cpp:[[@LINE-2]] 45 namespace bar { 46 int context; 47 long foo; 48 // NAME-DAG: name = "foo", type = {{.*}} (long), {{.*}} decl = find-basic-variable.cpp:[[@LINE-1]] 49 // CONTEXT-DAG: name = "foo", type = {{.*}} (long), {{.*}} decl = find-basic-variable.cpp:[[@LINE-2]] 50 // REGEX-DAG: name = "foo", type = {{.*}} (long), {{.*}} decl = find-basic-variable.cpp:[[@LINE-3]] 51 namespace baz { 52 static short foo; 53 // NAME-DAG: name = "foo", type = {{.*}} (short), {{.*}} decl = find-basic-variable.cpp:[[@LINE-1]] 54 // REGEX-DAG: name = "foo", type = {{.*}} (short), {{.*}} decl = find-basic-variable.cpp:[[@LINE-2]] 55 } 56 } 57 58 struct sbar { 59 static int foo; 60 // NAME-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-basic-variable.cpp:[[@LINE-1]] 61 // REGEX-DAG: name = "foo", type = {{.*}} (int), {{.*}} decl = find-basic-variable.cpp:[[@LINE-2]] 62 }; 63 int sbar::foo; 64 65 int foobar; 66 // REGEX-DAG: name = "foobar", type = {{.*}} (int), {{.*}} decl = find-basic-variable.cpp:[[@LINE-1]] 67 68 int fbar() { 69 static int foo; 70 return foo + bar::baz::foo; 71 } 72 73 int Foo; 74 75 struct ssbar { 76 int foo; 77 }; 78 79 extern "C" void _start(sbar, ssbar) {} 80