xref: /llvm-project/lldb/test/API/python_api/section/main.c (revision fdea9a4ec9b0d9585b8fe8a612686d9f44f40ddc)
1*99451b44SJordan Rupprecht #include <stdio.h>
2*99451b44SJordan Rupprecht #include <string.h>
3*99451b44SJordan Rupprecht 
4*99451b44SJordan Rupprecht // This simple program is to test the lldb Python API SBSection. It includes
5*99451b44SJordan Rupprecht // somes global data, and so the build process produces a DATA section, which
6*99451b44SJordan Rupprecht // the test code can use to query for the target byte size
7*99451b44SJordan Rupprecht 
8*99451b44SJordan Rupprecht char my_global_var_of_char_type = 'X';
9*99451b44SJordan Rupprecht 
main(int argc,char const * argv[])10*99451b44SJordan Rupprecht int main (int argc, char const *argv[])
11*99451b44SJordan Rupprecht {
12*99451b44SJordan Rupprecht     // this code just "does something" with the global so that it is not
13*99451b44SJordan Rupprecht     // optimised away
14*99451b44SJordan Rupprecht     if (argc > 1 && strlen(argv[1]))
15*99451b44SJordan Rupprecht     {
16*99451b44SJordan Rupprecht         my_global_var_of_char_type += argv[1][0];
17*99451b44SJordan Rupprecht     }
18*99451b44SJordan Rupprecht 
19*99451b44SJordan Rupprecht     return my_global_var_of_char_type;
20*99451b44SJordan Rupprecht }
21