1#include <stdbool.h>
2#include <stdio.h>
3
4struct ForwardDecl;
5
6typedef int MyInt;
7
8void populate(MyInt i);
9
10typedef enum MyEnum {
11 eOne = 1,
12 eTwo =2,
13 eThree = 3,
14} MyEnumT;
15
16typedef union MyUnion {
17 MyInt i;
18 const char* s;
19} MyUnionT;
20
21typedef 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
31typedef struct MyStruct {
32 MyNestedStructT n;
33 void (*f)(int);
34} MyStructT;
35
36struct LargeStruct {
37 char buffer[9000];
38 int b;
39};
40
41struct RecursiveStruct {
42 struct RecursiveStruct *n;
43};
44
45MyStructT foo;
46struct ForwardDecl *forward;
47struct LargeStruct bar;
48struct RecursiveStruct ke;
49
50void 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
66int main(int argc, char** argv) {
67 populate(i: argc);
68 printf(format: "foo is at address: %p\n", (void*)&foo); // Break here
69 return 0;
70}
71

source code of lldb/test/API/macosx/ctf/test.c