blob: c1fa9aed894fbe6af8167fcf7310eae828ba597e [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 | \
Duncan Sandsa524e0e2007-07-23 15:23:35 +00004// RUN: llc --disable-fp-elim -o NoCompileUnit.s -f
Chris Lattner670f4512008-03-10 06:52:10 +00005// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
6// RUN: %compile_cxx NoCompileUnit.o -o NoCompileUnit.exe
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
Duncan Sandsa524e0e2007-07-23 15:23:35 +00008// RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \
9// RUN: tee NoCompileUnit.out | not grep {"low == high"}
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010// 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}