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

source code of lldb/test/Shell/SymbolFile/DWARF/split-dwarf-expression-eval-bug.cpp