xref: /llvm-project/lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-namespace.cpp (revision 8a64d80a959bf2844df33f9112e456f33de7b468)
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=namespace %t | \
6 // RUN:   FileCheck --check-prefix=FOO %s
7 // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
8 // RUN:   FileCheck --check-prefix=CONTEXT %s
9 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
10 // RUN:   FileCheck --check-prefix=EMPTY %s
11 //
12 // RUN: %clang %s -g -c -o %t --target=x86_64-apple-macosx
13 // RUN: lldb-test symbols --name=foo --find=namespace %t | \
14 // RUN:   FileCheck --check-prefix=FOO %s
15 // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
16 // RUN:   FileCheck --check-prefix=CONTEXT %s
17 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
18 // RUN:   FileCheck --check-prefix=EMPTY %s
19 
20 // RUN: %clang %s -c -o %t.o --target=x86_64-pc-linux -gdwarf-5 -gpubnames
21 // RUN: ld.lld %t.o -o %t
22 // RUN: llvm-readobj --sections %t | FileCheck %s --check-prefix NAMES
23 // RUN: lldb-test symbols --name=foo --find=namespace %t | \
24 // RUN:   FileCheck --check-prefix=FOO %s
25 // RUN: lldb-test symbols --name=foo --find=namespace --context=context %t | \
26 // RUN:   FileCheck --check-prefix=CONTEXT %s
27 // RUN: lldb-test symbols --name=not_there --find=namespace %t | \
28 // RUN:   FileCheck --check-prefix=EMPTY %s
29 
30 // NAMES: Name: .debug_names
31 
32 // FOO: Found namespace: foo
33 
34 // CONTEXT: Found namespace: bar::foo
35 
36 // EMPTY: Namespace not found.
37 
38 namespace foo {
39 int X;
40 }
41 
42 namespace bar {
43 int context;
44 namespace foo {
45 int X;
46 }
47 } // namespace bar
48 
_start()49 extern "C" void _start() {}
50