blob: fcc8c20d1917c43418bb890ba241389400434d5f [file] [log] [blame]
Reid Spencerea303382006-11-07 07:31:37 +00001// 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
10class DeepStack {
11 int seedVal;
12public:
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
25int main ( int argc, char** argv) {
26
27 DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) );
28 return DS9.runit();
29}