brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · cdb2aa2 Raw
71 lines · c
1#include <stdio.h>2#include <stdint.h>3 4// This simple program is to test the lldb Python API SBValue.GetChildAtIndex().5 6int g_my_int = 100;7 8const char *days_of_week[7] = { "Sunday",9                                "Monday",10                                "Tuesday",11                                "Wednesday",12                                "Thursday",13                                "Friday",14                                "Saturday" };15 16const char *weekdays[5] = { "Monday",17                            "Tuesday",18                            "Wednesday",19                            "Thursday",20                            "Friday" };21 22const char **g_table[2] = { days_of_week, weekdays };23 24typedef int MyInt;25  26struct MyStruct27{28  int a;29  int b;30};31 32struct MyBiggerStruct33{34  int a;35  int b;36  int c;37};38 39struct Container40{41  int discriminator;42  union Data {43    struct MyStruct small;44    struct MyBiggerStruct big;45  } data;46};47  48int 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("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("%s\n", str_ptr[i]); // Break at this line67                                    // and do str_ptr_val.GetChildAtIndex(5, lldb.eNoDynamicValues, True).68 69    return 0;70}71