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 int a(int); 12 int b(int); 13 int c(int); 14 const char *print_string = "aaaaaaaaaa\n"; 15 16 int a(int val) 17 { 18 int return_value = val; // basic break at the start of b 19 20 if (val <= 1) 21 { 22 return_value = b(val); // break here to stop in a before calling b 23 } 24 else if (val >= 3) 25 { 26 return_value = c(val); 27 } 28 29 return return_value; 30 } 31 32 int b(int val) 33 { 34 int rc = c(val); // thread step-out while stopped at "c(2)" 35 return rc; 36 } 37 38 int c(int val) 39 { 40 return val + 3; // Find the line number of function "c" here. 41 } 42 43 int complex (int first, int second, int third) 44 { 45 return first + second + third; // Step in targetting complex should stop here 46 } 47 48 int main (int argc, char const *argv[]) 49 { 50 int A1 = a(1); // frame select 2, thread step-out while stopped at "c(1)" 51 printf("a(1) returns %d\n", A1); 52 53 int B2 = b(2); 54 printf("b(2) returns %d\n", B2); 55 56 int A3 = a(3); // frame select 1, thread step-out while stopped at "c(3)" 57 printf("a(3) returns %d\n", A3); 58 59 int A4 = complex (a(1), b(2), c(3)); // Stop here to try step in targetting b. 60 61 int A5 = complex (a(2), b(3), c(4)); // Stop here to try step in targetting complex. 62 63 int A6 = complex (a(4), b(5), c(6)); // Stop here to step targetting b and hitting breakpoint. 64 65 int A7 = complex (a(5), b(6), c(7)); // Stop here to make sure bogus target steps over. 66 67 printf ("I am using print_string: %s.\n", print_string); 68 return 0; 69 } 70