1// This is a regression test that checks whether lldb can inspect the variables
2// in this program without triggering an ASan exception.
3
4__attribute__((noinline, optnone)) int use(int x) { return x; }
5
6volatile int sink;
7
8struct S1 {
9 int f1;
10 int *f2;
11};
12
13struct S2 {
14 char a = 0;
15 char b = 0;
16 int pad = 0;
17 S2(int x) {
18 a = x & 0xff;
19 b = x & 0xff00;
20 }
21};
22
23int main() {
24 S1 v1;
25 v1.f1 = sink;
26 v1.f2 = nullptr;
27 sink++; //% self.expect("frame variable v1", substrs=["S1"])
28 S2 v2(v1.f1);
29 sink += use(x: v2.a); //% self.expect("frame variable v2", substrs=["S2"])
30 sink += use(x: v2.pad); //% self.expect("frame variable v2", substrs=["S2"])
31 return 0;
32}
33

source code of lldb/test/API/functionalities/optimized_code/main.cpp