xref: /llvm-project/lldb/test/API/tools/lldb-dap/variables/main.cpp (revision 40a361acf5ce255054c5b2e5f67a24325bfe0398)
1 
2 #define BUFFER_SIZE 16
3 struct PointType {
4   int x;
5   int y;
6   int buffer[BUFFER_SIZE];
7 };
8 #include <vector>
9 int g_global = 123;
10 static int s_global = 234;
11 int test_indexedVariables();
main(int argc,char const * argv[])12 int main(int argc, char const *argv[]) {
13   static float s_local = 2.25;
14   PointType pt = {11, 22, {0}};
15   for (int i = 0; i < BUFFER_SIZE; ++i)
16     pt.buffer[i] = i;
17   int x = s_global - g_global - pt.y; // breakpoint 1
18   {
19     int x = 42;
20     {
21       int x = 72;
22       s_global = x; // breakpoint 2
23     }
24   }
25   return test_indexedVariables(); // breakpoint 3
26 }
27 
test_indexedVariables()28 int test_indexedVariables() {
29   int small_array[5] = {1, 2, 3, 4, 5};
30   int large_array[200];
31   std::vector<int> small_vector;
32   std::vector<int> large_vector;
33   small_vector.assign(5, 0);
34   large_vector.assign(200, 0);
35   return 0; // breakpoint 4
36 }
37