1#include <stdio.h>
2
3// This simple program is to test the lldb Python API related to frames.
4
5int a(int, char);
6int b(int, char);
7int c(int, char);
8
9int a(int val, char ch)
10{
11 int my_val = val;
12 char my_ch = ch;
13 printf(format: "a(val=%d, ch='%c')\n", val, ch);
14 if (val <= 1)
15 return b(val+1, ch+1);
16 else if (val >= 3)
17 return c(val+1, ch+1);
18
19 return val;
20}
21
22int b(int val, char ch)
23{
24 int my_val = val;
25 char my_ch = ch;
26 printf(format: "b(val=%d, ch='%c')\n", val, ch);
27 return c(val+1, ch+1);
28}
29
30int c(int val, char ch)
31{
32 int my_val = val;
33 char my_ch = ch;
34 printf(format: "c(val=%d, ch='%c')\n", val, ch);
35 return val + 3 + ch;
36}
37
38int main (int argc, char const *argv[])
39{
40 int A1 = a(val: 1, ch: 'A'); // a(1, 'A') -> b(2, 'B') -> c(3, 'C')
41 printf(format: "a(1, 'A') returns %d\n", A1);
42
43 int B2 = b(val: 2, ch: 'B'); // b(2, 'B') -> c(3, 'C')
44 printf(format: "b(2, 'B') returns %d\n", B2);
45
46 int A3 = a(val: 3, ch: 'A'); // a(3, 'A') -> c(4, 'B')
47 printf(format: "a(3, 'A') returns %d\n", A3);
48
49 return 0;
50}
51

source code of lldb/test/API/python_api/frame/main.c