1 | #include <stdio.h> |
2 | |
3 | // This simple program is to demonstrate the capability of the lldb command |
4 | // "breakpoint modify -c 'val == 3' breakpt-id" to break within c(int val) only |
5 | // when the value of the arg is 3. |
6 | |
7 | int a(int); |
8 | int b(int); |
9 | int c(int); |
10 | |
11 | int a(int val) |
12 | { |
13 | if (val <= 1) |
14 | return b(val); |
15 | else if (val >= 3) |
16 | return c(val); // Find the line number of c's parent call here. |
17 | |
18 | return val; |
19 | } |
20 | |
21 | int b(int val) |
22 | { |
23 | return c(val); |
24 | } |
25 | |
26 | int c(int val) |
27 | { |
28 | return val + 3; // Find the line number of function "c" here. |
29 | } |
30 | |
31 | int main (int argc, char const *argv[]) |
32 | { |
33 | int A1 = a(val: 1); // a(1) -> b(1) -> c(1) |
34 | printf(format: "a(1) returns %d\n" , A1); |
35 | |
36 | int B2 = b(val: 2); // b(2) -> c(2) |
37 | printf(format: "b(2) returns %d\n" , B2); |
38 | |
39 | int A3 = a(val: 3); // a(3) -> c(3) |
40 | printf(format: "a(3) returns %d\n" , A3); |
41 | |
42 | for (int i = 0; i < 2; ++i) |
43 | printf(format: "Loop\n" ); |
44 | |
45 | return 0; |
46 | } |
47 | |