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