| 1 | #include <stdio.h> |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | // This simple program is to test the lldb Python API SBValue.GetChildAtIndex(). |
| 5 | |
| 6 | int g_my_int = 100; |
| 7 | |
| 8 | const char *days_of_week[7] = { "Sunday" , |
| 9 | "Monday" , |
| 10 | "Tuesday" , |
| 11 | "Wednesday" , |
| 12 | "Thursday" , |
| 13 | "Friday" , |
| 14 | "Saturday" }; |
| 15 | |
| 16 | const char *weekdays[5] = { "Monday" , |
| 17 | "Tuesday" , |
| 18 | "Wednesday" , |
| 19 | "Thursday" , |
| 20 | "Friday" }; |
| 21 | |
| 22 | const char **g_table[2] = { days_of_week, weekdays }; |
| 23 | |
| 24 | typedef int MyInt; |
| 25 | |
| 26 | struct MyStruct |
| 27 | { |
| 28 | int a; |
| 29 | int b; |
| 30 | }; |
| 31 | |
| 32 | struct MyBiggerStruct |
| 33 | { |
| 34 | int a; |
| 35 | int b; |
| 36 | int c; |
| 37 | }; |
| 38 | |
| 39 | struct Container |
| 40 | { |
| 41 | int discriminator; |
| 42 | union Data { |
| 43 | struct MyStruct small; |
| 44 | struct MyBiggerStruct big; |
| 45 | } data; |
| 46 | }; |
| 47 | |
| 48 | int main (int argc, char const *argv[]) |
| 49 | { |
| 50 | uint32_t uinthex = 0xE0A35F10; |
| 51 | int32_t sinthex = 0xE0A35F10; |
| 52 | |
| 53 | int i; |
| 54 | MyInt a = 12345; |
| 55 | struct MyStruct s = {11, 22}; |
| 56 | struct MyBiggerStruct f = { 33, 44, 55 }; |
| 57 | struct Container my_container; |
| 58 | my_container.data.big = f; |
| 59 | int *my_int_ptr = &g_my_int; |
| 60 | printf(format: "my_int_ptr points to location %p\n" , my_int_ptr); |
| 61 | int *fixed_int_ptr = (int*)(void*)0xAA; |
| 62 | int *another_fixed_int_ptr = (int*)(void*)0xAA; |
| 63 | int *a_null_int_ptr = NULL; |
| 64 | const char **str_ptr = days_of_week; |
| 65 | for (i = 0; i < 7; ++i) |
| 66 | printf(format: "%s\n" , str_ptr[i]); // Break at this line |
| 67 | // and do str_ptr_val.GetChildAtIndex(5, lldb.eNoDynamicValues, True). |
| 68 | |
| 69 | return 0; |
| 70 | } |
| 71 | |