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=type %t | \
6// RUN: FileCheck --check-prefix=NAME %s
7// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
8// RUN: FileCheck --check-prefix=CONTEXT %s
9// RUN: lldb-test symbols --name=not_there --find=type %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=type %t | \
14// RUN: FileCheck --check-prefix=NAME %s
15// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
16// RUN: FileCheck --check-prefix=CONTEXT %s
17// RUN: lldb-test symbols --name=not_there --find=type %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=type %t | \
24// RUN: FileCheck --check-prefix=NAME %s
25// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
26// RUN: FileCheck --check-prefix=CONTEXT %s
27// RUN: lldb-test symbols --name=not_there --find=type %t | \
28// RUN: FileCheck --check-prefix=EMPTY %s
29
30// NAMES: Name: .debug_names
31
32// EMPTY: Found 0 types:
33// NAME: Found 4 types:
34// CONTEXT: Found 1 types:
35struct foo { };
36// NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
37
38namespace bar {
39int context;
40struct foo {};
41// NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
42// CONTEXT-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-2]]
43namespace baz {
44struct foo {};
45// NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
46}
47}
48
49struct sbar {
50 struct foo {};
51// NAME-DAG: name = "foo", {{.*}} decl = find-basic-type.cpp:[[@LINE-1]]
52};
53
54struct foobar {};
55
56struct Foo {};
57
58extern "C" void _start(foo, bar::foo, bar::baz::foo, sbar::foo, foobar, Foo) {}
59

source code of lldb/test/Shell/SymbolFile/DWARF/x86/find-basic-type.cpp