1// RUN: %clang %target_itanium_abi_host_triple -arch x86_64 %s -o %t.out -g -fsanitize=safe-stack
2// RUN: %test_debuginfo %s %t.out
3// UNSUPPORTED: system-darwin
4// REQUIRES: !asan, compiler-rt
5// Zorg configures the ASAN stage2 bots to not build the
6// safestack compiler-rt. Only run this test on
7// non-asanified configurations.
8// XFAIL: !system-darwin && gdb-clang-incompatibility
9struct S {
10 int a[8];
11};
12
13int f(struct S s, unsigned i);
14
15int main(int argc, const char **argv) {
16 struct S s = {.a: {0, 1, 2, 3, 4, 5, 6, 7}};
17 // DEBUGGER: break 17
18 f(s, i: 4);
19 // DEBUGGER: break 19
20 return 0;
21}
22
23int f(struct S s, unsigned i) {
24 // DEBUGGER: break 24
25 return s.a[i];
26}
27
28// DEBUGGER: r
29// DEBUGGER: p s
30// CHECK: a =
31// DEBUGGER: p s.a[0]
32// CHECK: = 0
33// DEBUGGER: p s.a[1]
34// CHECK: = 1
35// DEBUGGER: p s.a[7]
36// CHECK: = 7
37// DEBUGGER: c
38// DEBUGGER: p s
39// CHECK: a =
40// DEBUGGER: p s.a[0]
41// CHECK: = 0
42// DEBUGGER: p s.a[1]
43// CHECK: = 1
44// DEBUGGER: p s.a[7]
45// DEBUGGER: c
46// DEBUGGER: p s
47// CHECK: a =
48// DEBUGGER: p s.a[0]
49// CHECK: = 0
50// DEBUGGER: p s.a[1]
51// CHECK: = 1
52// DEBUGGER: p s.a[7]
53

source code of cross-project-tests/debuginfo-tests/llgdb-tests/safestack.c