Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | // This is a regression test on debug info to make sure we don't hit a compile |
| 2 | // unit size issue with gdb. |
Dan Gohman | 2b62af2 | 2009-12-05 00:02:37 +0000 | [diff] [blame] | 3 | // RUN: %llvmgcc -S -O0 -g %s -o - | \ |
Dan Gohman | 2d65d35 | 2009-08-25 15:38:29 +0000 | [diff] [blame] | 4 | // RUN: llc --disable-fp-elim -o NoCompileUnit.s |
Chris Lattner | 670f451 | 2008-03-10 06:52:10 +0000 | [diff] [blame] | 5 | // RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o |
Dale Johannesen | b58f0a6 | 2008-06-10 18:01:54 +0000 | [diff] [blame] | 6 | // RUN: %link NoCompileUnit.o -o NoCompileUnit.exe |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 |
Duncan Sands | a524e0e | 2007-07-23 15:23:35 +0000 | [diff] [blame] | 8 | // RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \ |
| 9 | // RUN: tee NoCompileUnit.out | not grep {"low == high"} |
Daniel Dunbar | 5a7b8f0 | 2009-11-09 16:38:15 +0000 | [diff] [blame] | 10 | // XFAIL: alpha,arm |
Matthijs Kooijman | 2035efd | 2008-06-13 16:52:35 +0000 | [diff] [blame] | 11 | // XFAIL: * |
| 12 | // See PR2454 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 13 | |
| 14 | |
| 15 | class MamaDebugTest { |
| 16 | private: |
| 17 | int N; |
| 18 | |
| 19 | protected: |
| 20 | MamaDebugTest(int n) : N(n) {} |
| 21 | |
| 22 | int getN() const { return N; } |
| 23 | |
| 24 | }; |
| 25 | |
| 26 | class BabyDebugTest : public MamaDebugTest { |
| 27 | private: |
| 28 | |
| 29 | public: |
| 30 | BabyDebugTest(int n) : MamaDebugTest(n) {} |
| 31 | |
| 32 | static int doh; |
| 33 | |
| 34 | int doit() { |
| 35 | int N = getN(); |
| 36 | int Table[N]; |
| 37 | |
| 38 | int sum = 0; |
| 39 | |
| 40 | for (int i = 0; i < N; ++i) { |
| 41 | int j = i; |
| 42 | Table[i] = j; |
| 43 | } |
| 44 | for (int i = 0; i < N; ++i) { |
| 45 | int j = Table[i]; |
| 46 | sum += j; |
| 47 | } |
| 48 | |
| 49 | return sum; |
| 50 | } |
| 51 | |
| 52 | }; |
| 53 | |
| 54 | int BabyDebugTest::doh; |
| 55 | |
| 56 | |
| 57 | int main(int argc, const char *argv[]) { |
| 58 | BabyDebugTest BDT(20); |
| 59 | return BDT.doit(); |
| 60 | } |