xref: /llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/asan-deque.cpp (revision 48326df4b5c7d6406ffa20897154c1ce08a4fffb)
1 // RUN: %clangxx -arch x86_64 %target_itanium_abi_host_triple -O1 -g %s -o %t.out -fsanitize=address
2 // RUN: %test_debuginfo %s %t.out
3 // REQUIRES: !asan, compiler-rt, system-darwin
4 //           Zorg configures the ASAN stage2 bots to not build the asan
5 //           compiler-rt. Only run this test on non-asanified configurations.
6 //           gdb is used on non-darwin; some configs pretty print std::deque,
7 //           some don't.
8 // UNSUPPORTED: apple-lldb-pre-1000
9 // XFAIL: !system-darwin && gdb-clang-incompatibility
10 #include <deque>
11 
12 struct A {
13   int a;
AA14   A(int a) : a(a) {}
15 };
16 
17 using log_t = std::deque<A>;
18 
escape(log_t & log)19 static void __attribute__((noinline, optnone)) escape(log_t &log) {
20   static volatile log_t *sink;
21   sink = &log;
22 }
23 
main()24 int main() {
25   log_t log;
26   log.push_back(1234);
27   log.push_back(56789);
28   escape(log);
29   // DEBUGGER: break 28
30   while (!log.empty()) {
31     auto record = log.front();
32     log.pop_front();
33     escape(log);
34     // DEBUGGER: break 33
35   }
36 }
37 
38 // DEBUGGER: r
39 
40 // (at line 28)
41 // DEBUGGER: p log
42 // CHECK: 1234
43 // CHECK: 56789
44 
45 // DEBUGGER: c
46 
47 // (at line 33)
48 // DEBUGGER: p log
49 // CHECK: 56789
50