xref: /llvm-project/lldb/test/API/macosx/ctf/test.c (revision fd4399cb11f4069888bc7eac01f74493b5a2af48)
1 #include <stdbool.h>
2 #include <stdio.h>
3 
4 struct ForwardDecl;
5 
6 typedef int MyInt;
7 
8 void populate(MyInt i);
9 
10 typedef enum MyEnum {
11   eOne = 1,
12   eTwo =2,
13   eThree = 3,
14 } MyEnumT;
15 
16 typedef union MyUnion {
17     MyInt i;
18     const char* s;
19 } MyUnionT;
20 
21 typedef struct MyNestedStruct {
22   MyInt i;
23   const char* s;
24   volatile char c;
25   char a[4];
26   MyEnumT e;
27   MyUnionT u;
28   _Bool b;
29 } MyNestedStructT;
30 
31 typedef struct MyStruct {
32   MyNestedStructT n;
33   void (*f)(int);
34 } MyStructT;
35 
36 struct LargeStruct {
37   char buffer[9000];
38   int b;
39 };
40 
41 struct RecursiveStruct {
42   struct RecursiveStruct *n;
43 };
44 
45 MyStructT foo;
46 struct ForwardDecl *forward;
47 struct LargeStruct bar;
48 struct RecursiveStruct ke;
49 
populate(MyInt i)50 void populate(MyInt i) {
51   foo.n.i = i;
52   foo.n.s = "foo";
53   foo.n.c = 'c';
54   foo.n.a[0] = 'a';
55   foo.n.a[1] = 'b';
56   foo.n.a[2] = 'c';
57   foo.n.a[3] = 'd';
58   foo.n.e = eOne;
59   foo.n.b = false;
60   foo.f = NULL;
61   forward = NULL;
62   bar.b = i;
63   ke.n = NULL;
64 }
65 
main(int argc,char ** argv)66 int main(int argc, char** argv) {
67   populate(argc);
68   printf("foo is at address: %p\n", (void*)&foo); // Break here
69   return 0;
70 }
71