Reid Spencer | ea30338 | 2006-11-07 07:31:37 +0000 | [diff] [blame] | 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 Output/%s.ll |
| 4 | // RUN: llvm-as < Output/%s.ll | llc -o Output/%s.s |
| 5 | // RUN: gcc -g Output/%s.s -o Output/%s.exe |
| 6 | // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) | gdb Output/%s.exe | grep '#0 DeepStack::deepest (this=.*,x=33)' |
| 7 | |
| 8 | #include <stdlib.h> |
| 9 | |
| 10 | class DeepStack { |
| 11 | int seedVal; |
| 12 | public: |
| 13 | DeepStack(int seed) : seedVal(seed) {} |
| 14 | |
| 15 | int shallowest( int x ) { return shallower(x + 1); } |
| 16 | int shallower ( int x ) { return shallow(x + 2); } |
| 17 | int shallow ( int x ) { return deep(x + 3); } |
| 18 | int deep ( int x ) { return deeper(x + 4); } |
| 19 | int deeper ( int x ) { return deepest(x + 6); } |
| 20 | int deepest ( int x ) { return x + 7; } |
| 21 | |
| 22 | int runit() { return shallowest(seedVal); } |
| 23 | }; |
| 24 | |
| 25 | int main ( int argc, char** argv) { |
| 26 | |
| 27 | DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); |
| 28 | return DS9.runit(); |
| 29 | } |