1 // RUN: %clang -fblocks %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=address
2 // RUN: %test_debuginfo %s %t.out
3 // FIXME: Remove system-darwin when we build BlocksRuntime everywhere.
4 // REQUIRES: !asan, system-darwin
5 // Zorg configures the ASAN stage2 bots to not build the asan
6 // compiler-rt. Only run this test on non-asanified configurations.
7 void b();
8 struct S {
9 int a[8];
10 };
11
f(struct S s,unsigned i)12 int f(struct S s, unsigned i) {
13 // DEBUGGER: break 17
14 // DEBUGGER: r
15 // DEBUGGER: p s
16 // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)
17 return s.a[i];
18 }
19
main(int argc,const char ** argv)20 int main(int argc, const char **argv) {
21 struct S s = {{0, 1, 2, 3, 4, 5, 6, 7}};
22 if (f(s, 4) == 4) {
23 // DEBUGGER: break 27
24 // DEBUGGER: c
25 // DEBUGGER: p s
26 // CHECK: a = ([0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7)
27 b();
28 }
29 return 0;
30 }
31
c()32 void c() {}
33
b()34 void b() {
35 // DEBUGGER: break 40
36 // DEBUGGER: c
37 // DEBUGGER: p x
38 // CHECK: 42
39 __block int x = 42;
40 c();
41 }
42