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=function --function-flags=base %t | \ 6 // RUN: FileCheck --check-prefix=BASE %s 7 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ 8 // RUN: FileCheck --check-prefix=METHOD %s 9 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \ 10 // RUN: FileCheck --check-prefix=FULL %s 11 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \ 12 // RUN: FileCheck --check-prefix=FULL-MANGLED %s 13 // RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ 14 // RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s 15 // RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ 16 // RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s 17 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ 18 // RUN: FileCheck --check-prefix=CONTEXT %s 19 // RUN: lldb-test symbols --name=not_there --find=function %t | \ 20 // RUN: FileCheck --check-prefix=EMPTY %s 21 // 22 // RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx 23 // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ 24 // RUN: FileCheck --check-prefix=BASE %s 25 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ 26 // RUN: FileCheck --check-prefix=METHOD %s 27 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \ 28 // RUN: FileCheck --check-prefix=FULL %s 29 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \ 30 // RUN: FileCheck --check-prefix=FULL-MANGLED %s 31 // RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ 32 // RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s 33 // RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ 34 // RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s 35 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ 36 // RUN: FileCheck --check-prefix=CONTEXT %s 37 // RUN: lldb-test symbols --name=not_there --find=function %t | \ 38 // RUN: FileCheck --check-prefix=EMPTY %s 39 40 // RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames 41 // RUN: ld.lld %t.o -o %t 42 // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES 43 // RUN: lldb-test symbols --name=foo --find=function --function-flags=base %t | \ 44 // RUN: FileCheck --check-prefix=BASE %s 45 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method %t | \ 46 // RUN: FileCheck --check-prefix=METHOD %s 47 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t | \ 48 // RUN: FileCheck --check-prefix=FULL %s 49 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full %t | \ 50 // RUN: FileCheck --check-prefix=FULL-MANGLED %s 51 // RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function --function-flags=full %t | \ 52 // RUN: FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s 53 // RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function --function-flags=full %t | \ 54 // RUN: FileCheck --check-prefix=FULL-MANGLED-METHOD %s 55 // RUN: lldb-test symbols --name=foo --context=context --find=function --function-flags=base %t | \ 56 // RUN: FileCheck --check-prefix=CONTEXT %s 57 // RUN: lldb-test symbols --name=not_there --find=function %t | \ 58 // RUN: FileCheck --check-prefix=EMPTY %s 59 60 // NAMES: Name: .debug_names 61 62 // BASE: Found 4 functions: 63 // BASE-DAG: name = "foo()", mangled = "_Z3foov" 64 // BASE-DAG: name = "foo(int)", mangled = "_Z3fooi" 65 // BASE-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" 66 // BASE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" 67 68 // METHOD: Found 3 functions: 69 // METHOD-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv" 70 // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" 71 // METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = "_ZZ5ffbarvEN4sbaz3fooEv" 72 73 // FULL: Found 0 functions: 74 75 // FULL-MANGLED: Found 1 functions: 76 // FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi" 77 78 // FULL-MANGLED-NAMESPACE: Found 1 functions: 79 // FULL-MANGLED-NAMESPACE-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv" 80 81 // FULL-MANGLED-METHOD: Found 1 functions: 82 // FULL-MANGLED-METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi" 83 84 // CONTEXT: Found 1 functions: 85 // CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv" 86 87 // EMPTY: Found 0 functions: 88 89 void foo() {} 90 void foo(int) {} 91 92 namespace bar { 93 int context; 94 void foo() {} 95 namespace baz { 96 void foo() {} 97 } // namespace baz 98 } // namespace bar 99 100 struct foo {}; 101 void fbar(struct foo) {} 102 103 void Foo() {} 104 105 struct sbar { 106 void foo(); 107 static void foo(int); 108 }; 109 void sbar::foo() {} 110 void sbar::foo(int) {} 111 112 void ffbar() { 113 struct sbaz { 114 void foo() {} 115 }; 116 sbaz a; 117 a.foo(); 118 } 119 120 extern "C" void _start() {} 121