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