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

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of lldb/test/API/tools/lldb-dap/variables/main.cpp