brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · b39b8d0 Raw
55 lines · c
1#include <stdio.h>2 3// This simple program is to demonstrate the capability of the lldb command4// "breakpoint modify -i <count> breakpt-id" to set the number of times a5// breakpoint is skipped before stopping.  Ignore count can also be set upon6// breakpoint creation by 'breakpoint set ... -i <count>'.7 8int a(int);9int b(int);10int c(int);11 12int a(int val)13{14    if (val <= 1)15        return b(val);16    else if (val >= 3)17        return c(val); // a(3) -> c(3) Find the call site of c(3).18 19    return val;20}21 22int b(int val)23{24    return c(val);25}26 27int c(int val)28{29    return val + 3; // Find the line number of function "c" here.30}31 32void spin_a_bit () {33  for (unsigned int i = 0; i < 10; i++) {34    printf("Set a breakpoint here, with i = %d.\n", i);35  }36}37 38int main (int argc, char const *argv[])39{40    int A1 = a(1);  // a(1) -> b(1) -> c(1) // Stop here at start of main41    printf("a(1) returns %d\n", A1);42    43    int B2 = b(2);  // b(2) -> c(2) Find the call site of b(2).44    printf("b(2) returns %d\n", B2);45    46    int A3 = a(3);  // a(3) -> c(3) Find the call site of a(3).47    printf("a(3) returns %d\n", A3);48    49    int C1 = c(5); // Find the call site of c in main.50    printf ("c(5) returns %d\n", C1);51 52    spin_a_bit();53    return 0;54}55