1 //===-- main.c --------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 #include <stdio.h> 9 10 // This simple program is to demonstrate the capability of the lldb command 11 // "breakpoint modify -i <count> breakpt-id" to set the number of times a 12 // breakpoint is skipped before stopping. Ignore count can also be set upon 13 // breakpoint creation by 'breakpoint set ... -i <count>'. 14 15 int a(int); 16 int b(int); 17 int c(int); 18 19 int a(int val) 20 { 21 if (val <= 1) 22 return b(val); 23 else if (val >= 3) 24 return c(val); // a(3) -> c(3) Find the call site of c(3). 25 26 return val; 27 } 28 29 int b(int val) 30 { 31 return c(val); 32 } 33 34 int c(int val) 35 { 36 return val + 3; // Find the line number of function "c" here. 37 } 38 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) Find the call site of b(2). 45 printf("b(2) returns %d\n", B2); 46 47 int A3 = a(3); // a(3) -> c(3) Find the call site of a(3). 48 printf("a(3) returns %d\n", A3); 49 50 int C1 = c(5); // Find the call site of c in main. 51 printf ("c(5) returns %d\n", C1); 52 return 0; 53 } 54