[TableGen] Fix validateOperandClass for non Phyical Reg (#118146)
[llvm-project.git] / lldb / test / API / python_api / target / main.c
blob0949c1550a9f960486548f544d513fd96ef96ad6
1 #include <stdio.h>
3 // This simple program is to test the lldb Python API SBTarget.
4 //
5 // When stopped on breakpoint 1, and then 2, we can get the line entries using
6 // SBFrame API SBFrame.GetLineEntry(). We'll get the start addresses for the
7 // two line entries; with the start address (of SBAddress type), we can then
8 // resolve the symbol context using the SBTarget API
9 // SBTarget.ResolveSymbolContextForAddress().
11 // The two symbol context should point to the same symbol, i.e., 'a' function.
13 char my_global_var_of_char_type = 'X'; // Test SBTarget.FindGlobalVariables(...).
15 int a(int);
16 int b(int);
17 int c(int);
19 int a(int val)
21 if (val <= 1) // Find the line number for breakpoint 1 here.
22 val = b(val);
23 else if (val >= 3)
24 val = c(val);
26 return val; // Find the line number for breakpoint 2 here.
29 int b(int val)
31 return c(val);
34 int c(int val)
36 return val + 3;
39 int main (int argc, char const *argv[], char** env)
41 // Set a break at entry to main.
42 int A1 = a(1); // a(1) -> b(1) -> c(1)
43 printf("a(1) returns %d\n", A1);
45 int B2 = b(2); // b(2) -> c(2)
46 printf("b(2) returns %d\n", B2);
48 int A3 = a(3); // a(3) -> c(3)
49 printf("a(3) returns %d\n", A3);
51 for (int i = 1; i < argc; i++) {
52 printf("arg: %s\n", argv[i]);
55 while (*env)
56 printf("env: %s\n", *env++);
58 return 0;