Fix LDRi12 immediate operand, which was changed to be the second operand in $addrmode...
[oota-llvm.git] / test / FrontendC++ / 2006-11-06-StackTrace.cpp
1 // This is a regression test on debug info to make sure that we can get a
2 // meaningful stack trace from a C++ program.
3 // RUN: %llvmgcc -S -O0 -g %s -o - | \
4 // RUN:    llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic
5 // RUN: %compile_c %t.s -o %t.o
6 // RUN: %link %t.o -o %t.exe
7 // RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in 
8 // RN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \
9 // RN:   grep {#0  DeepStack::deepest.*(this=.*,.*x=33)}
10 // RN: gdb -q -batch -n -x %t.in %t.exe | \
11 // RN:   grep {#7  0x.* in main.*(argc=\[12\],.*argv=.*)}
12
13 // Only works on ppc (but not apple-darwin9), x86 and x86_64.  Should
14 // generalize?
15 // XAIL: alpha,arm,powerpc-apple-darwin9
16
17 #include <stdlib.h>
18
19 class DeepStack {
20   int seedVal;
21 public:
22   DeepStack(int seed) : seedVal(seed) {}
23
24   int shallowest( int x ) { return shallower(x + 1); }
25   int shallower ( int x ) { return shallow(x + 2); }
26   int shallow   ( int x ) { return deep(x + 3); }
27   int deep      ( int x ) { return deeper(x + 4); }
28   int deeper    ( int x ) { return deepest(x + 6); }
29   int deepest   ( int x ) { return x + 7; }
30
31   int runit() { return shallowest(seedVal); }
32 };
33
34 int main ( int argc, char** argv) {
35
36   DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) );
37   return DS9.runit();
38 }