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 test the lldb Python API SBSymbolContext. 11 // When stopped on a frame, we can get the symbol context using the SBFrame API 12 // SBFrame.GetSymbolContext(). 13 14 int a(int); 15 int b(int); 16 int c(int); 17 18 int a(int val) 19 { 20 if (val <= 1) 21 return b(val); 22 else if (val >= 3) 23 return c(val); 24 25 return val; 26 } 27 28 int b(int val) 29 { 30 return c(val); 31 } 32 33 int c(int val) 34 { 35 return val + 3; // Find the line number of function "c" here. 36 } 37 38 int main (int argc, char const *argv[]) 39 { 40 int A1 = a(1); // a(1) -> b(1) -> c(1) 41 printf("a(1) returns %d\n", A1); 42 43 int B2 = b(2); // b(2) -> c(2) 44 printf("b(2) returns %d\n", B2); 45 46 int A3 = a(3); // a(3) -> c(3) 47 printf("a(3) returns %d\n", A3); 48 49 return 0; 50 } 51