Home | History | Annotate | Download | only in breakpoint_ignore_count
      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 -i <count> breakpt-id" to set the number of times a
     13 // breakpoint is skipped before stopping.  Ignore count can also be set upon
     14 // breakpoint creation by 'breakpoint set ... -i <count>'.
     15 
     16 int a(int);
     17 int b(int);
     18 int c(int);
     19 
     20 int a(int val)
     21 {
     22     if (val <= 1)
     23         return b(val);
     24     else if (val >= 3)
     25         return c(val); // a(3) -> c(3) Find the call site of c(3).
     26 
     27     return val;
     28 }
     29 
     30 int b(int val)
     31 {
     32     return c(val);
     33 }
     34 
     35 int c(int val)
     36 {
     37     return val + 3; // Find the line number of function "c" here.
     38 }
     39 
     40 int main (int argc, char const *argv[])
     41 {
     42     int A1 = a(1);  // a(1) -> b(1) -> c(1)
     43     printf("a(1) returns %d\n", A1);
     44 
     45     int B2 = b(2);  // b(2) -> c(2) Find the call site of b(2).
     46     printf("b(2) returns %d\n", B2);
     47 
     48     int A3 = a(3);  // a(3) -> c(3) Find the call site of a(3).
     49     printf("a(3) returns %d\n", A3);
     50 
     51     int C1 = c(5); // Find the call site of c in main.
     52     printf ("c(5) returns %d\n", C1);
     53     return 0;
     54 }
     55