50 lines · cpp
1// RUN: %clangxx -arch x86_64 %target_itanium_abi_host_triple -O1 -g %s -o %t.out -fsanitize=address2// RUN: %test_debuginfo %s %t.out3// REQUIRES: !asan, compiler-rt, system-darwin4// Zorg configures the ASAN stage2 bots to not build the asan5// 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-10009// XFAIL: !system-darwin && gdb-clang-incompatibility10#include <deque>11 12struct A {13 int a;14 A(int a) : a(a) {}15};16 17using log_t = std::deque<A>;18 19static void __attribute__((noinline, optnone)) escape(log_t &log) {20 static volatile log_t *sink;21 sink = &log;22}23 24int main() {25 log_t log;26 log.push_back(1234);27 log.push_back(56789);28 escape(log);29 // DEBUGGER: break 2830 while (!log.empty()) {31 auto record = log.front();32 log.pop_front();33 escape(log);34 // DEBUGGER: break 3335 }36}37 38// DEBUGGER: r39 40// (at line 28)41// DEBUGGER: p log42// CHECK: 123443// CHECK: 5678944 45// DEBUGGER: c46 47// (at line 33)48// DEBUGGER: p log49// CHECK: 5678950