1 | //----------------------------------------------------------------------------// |
---|---|
2 | // Struct loading declarations. |
3 | |
4 | struct StructFirstMember { int i; }; |
5 | struct StructBehindPointer { int i; }; |
6 | struct StructBehindRef { int i; }; |
7 | struct StructMember { int i; }; |
8 | |
9 | StructBehindRef struct_instance; |
10 | |
11 | struct SomeStruct { |
12 | StructFirstMember *first; |
13 | StructBehindPointer *ptr; |
14 | StructMember member; |
15 | StructBehindRef &ref = struct_instance; |
16 | }; |
17 | |
18 | struct OtherStruct { |
19 | int member_int; |
20 | }; |
21 | |
22 | //----------------------------------------------------------------------------// |
23 | // Class loading declarations. |
24 | |
25 | struct ClassMember { int i; }; |
26 | struct StaticClassMember { int i; }; |
27 | struct UnusedClassMember { int i; }; |
28 | struct UnusedClassMemberPtr { int i; }; |
29 | |
30 | namespace NS { |
31 | class ClassInNamespace { |
32 | int i; |
33 | }; |
34 | class ClassWeEnter { |
35 | public: |
36 | int dummy; // Prevent bug where LLDB always completes first member. |
37 | ClassMember member; |
38 | static StaticClassMember static_member; |
39 | UnusedClassMember unused_member; |
40 | UnusedClassMemberPtr *unused_member_ptr; |
41 | int enteredFunction() { |
42 | return member.i; // Location: class function |
43 | } |
44 | }; |
45 | StaticClassMember ClassWeEnter::static_member; |
46 | }; |
47 | |
48 | //----------------------------------------------------------------------------// |
49 | // Function we can stop in. |
50 | |
51 | int functionWithOtherStruct() { |
52 | OtherStruct other_struct_var; |
53 | other_struct_var.member_int++; // Location: other struct function |
54 | return other_struct_var.member_int; |
55 | } |
56 | |
57 | int functionWithMultipleLocals() { |
58 | SomeStruct struct_var; |
59 | OtherStruct other_struct_var; |
60 | NS::ClassInNamespace namespace_class; |
61 | other_struct_var.member_int++; // Location: multiple locals function |
62 | return other_struct_var.member_int; |
63 | } |
64 | |
65 | int main(int argc, char **argv) { |
66 | NS::ClassWeEnter c; |
67 | c.enteredFunction(); |
68 | |
69 | functionWithOtherStruct(); |
70 | functionWithMultipleLocals(); |
71 | return 0; |
72 | } |
73 |