1*2cf69684SPavel Labath // This tests a crash which occured under very specific circumstances. The
2*2cf69684SPavel Labath // interesting aspects of this test are:
3*2cf69684SPavel Labath // - we print a global variable from one compile unit
4*2cf69684SPavel Labath // - we are stopped in a member function of a class in a namespace
5*2cf69684SPavel Labath // - that namespace is also present in a third file, which also has a global
6*2cf69684SPavel Labath //   variable
7*2cf69684SPavel Labath 
8*2cf69684SPavel Labath // UNSUPPORTED: system-darwin, system-windows
9*2cf69684SPavel Labath 
10*2cf69684SPavel Labath // RUN: %clang_host -c -gsplit-dwarf %s -o %t1.o -DONE
11*2cf69684SPavel Labath // RUN: %clang_host -c -gsplit-dwarf %s -o %t2.o -DTWO
12*2cf69684SPavel Labath // RUN: %clang_host -c -gsplit-dwarf %s -o %t3.o -DTHREE
13*2cf69684SPavel Labath // RUN: %clang_host %t1.o %t2.o %t3.o -o %t
14*2cf69684SPavel Labath // RUN: %lldb %t -o "br set -n foo" -o run -o "p bool_in_first_cu" -o exit \
15*2cf69684SPavel Labath // RUN:   | FileCheck %s
16*2cf69684SPavel Labath 
17*2cf69684SPavel Labath // CHECK: (lldb) p bool_in_first_cu
18*2cf69684SPavel Labath // CHECK: (bool) $0 = true
19*2cf69684SPavel Labath 
20*2cf69684SPavel Labath 
21*2cf69684SPavel Labath #if defined(ONE)
22*2cf69684SPavel Labath bool bool_in_first_cu = true;
23*2cf69684SPavel Labath #elif defined(TWO)
24*2cf69684SPavel Labath bool bool_in_second_cu = true;
25*2cf69684SPavel Labath 
26*2cf69684SPavel Labath namespace NS {
27*2cf69684SPavel Labath void f() {}
28*2cf69684SPavel Labath }
29*2cf69684SPavel Labath #elif defined(THREE)
30*2cf69684SPavel Labath namespace NS {
31*2cf69684SPavel Labath struct S {
32*2cf69684SPavel Labath   void foo() {}
33*2cf69684SPavel Labath };
34*2cf69684SPavel Labath }
35*2cf69684SPavel Labath 
36*2cf69684SPavel Labath int main() { NS::S().foo(); }
37*2cf69684SPavel Labath #endif
38