1ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//===-- main.c --------------------------------------------------*- C++ -*-===//
2ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//
3ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//                     The LLVM Compiler Infrastructure
4ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//
5ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen// This file is distributed under the University of Illinois Open Source
6ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen// License. See LICENSE.TXT for details.
7ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//
8ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen//===----------------------------------------------------------------------===//
9ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen#include <stdio.h>
10ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
11ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen// This simple program is to test the lldb Python API related to events.
12ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
13ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint a(int);
14ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint b(int);
15ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint c(int);
16ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
17ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint a(int val)
18ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen{
19ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    if (val <= 1)
20ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen        return b(val);
21ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    else if (val >= 3)
22ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen        return c(val);
23ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
24ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    return val;
25ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen}
26ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
27ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint b(int val)
28ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen{
29ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    return c(val);
30ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen}
31ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
32ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint c(int val)
33ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen{
34ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    return val + 3; // Find the line number of function "c" here.
35ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen}
36ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
37ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chenint main (int argc, char const *argv[])
38ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen{
39ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    int A1 = a(1);  // a(1) -> b(1) -> c(1)
40ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    printf("a(1) returns %d\n", A1);
41ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
42ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    int B2 = b(2);  // b(2) -> c(2)
43ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    printf("b(2) returns %d\n", B2);
44ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
45ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    int A3 = a(3);  // a(3) -> c(3)
46ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    printf("a(3) returns %d\n", A3);
47ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen
48ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen    return 0;
49ca4c7243ecd0a8dd1aea3009e512cd442c6c1233Johnny Chen}
50