3 // This simple program is to test the lldb Python API SBTarget.
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(...).
21 if (val
<= 1) // Find the line number for breakpoint 1 here.
26 return val
; // Find the line number for breakpoint 2 here.
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
]);
56 printf("env: %s\n", *env
++);