blob: 993ceb484c72cb32cbb380169840575e88b9a794 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001// This is a regression test on debug info to make sure we don't hit a compile
2// unit size issue with gdb.
3// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
4// RUN: llc --disable-fp-elim -o Output/NoCompileUnit.s -f
5// RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o
6// RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe
7// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
8// RUN: gdb -q -batch -n -x %t2 Output/NoCompileUnit.exe | \
9// RUN: tee Output/NoCompileUnit.out | not grep {"low == high"}
10// XFAIL: alpha|ia64|arm
11
12
13class MamaDebugTest {
14private:
15 int N;
16
17protected:
18 MamaDebugTest(int n) : N(n) {}
19
20 int getN() const { return N; }
21
22};
23
24class BabyDebugTest : public MamaDebugTest {
25private:
26
27public:
28 BabyDebugTest(int n) : MamaDebugTest(n) {}
29
30 static int doh;
31
32 int doit() {
33 int N = getN();
34 int Table[N];
35
36 int sum = 0;
37
38 for (int i = 0; i < N; ++i) {
39 int j = i;
40 Table[i] = j;
41 }
42 for (int i = 0; i < N; ++i) {
43 int j = Table[i];
44 sum += j;
45 }
46
47 return sum;
48 }
49
50};
51
52int BabyDebugTest::doh;
53
54
55int main(int argc, const char *argv[]) {
56 BabyDebugTest BDT(20);
57 return BDT.doit();
58}