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