]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/massif/tests/deep.c
Inital import
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / massif / tests / deep.c
1 // This is a test for complicated stack traces.
2 //
3 // - In deep-A.vgtest, the stack trace is larger than the asked-for depth
4 //   (12 vs. 8) so not all of the trace is shown.
5 // - In deep-B.vgtest, we have --alloc-fn=a6..a12, which means that get_XCon
6 //   needs to redo the IP getting, because 7 functions get removed from the
7 //   trace, which is more than the initial overestimate of 3.
8 // - In deep-C.vgtest, we have --alloc-fn=a3..a12, which means that get_XCon
9 //   ends up with an empty stack trace after removing all the alloc-fns.
10 //   It then redoes it. 
11 // - In deep-D.vgtest, we have --alloc-fn=main..a12, which means we have a
12 //   stack trace with a single "(below main)" entry.
13
14 #include <stdlib.h>
15
16 void a12(int n) { malloc(n); }
17 void a11(int n) { a12(n); }
18 void a10(int n) { a11(n); }
19 void a9 (int n) { a10(n); }
20 void a8 (int n) { a9 (n); }
21 void a7 (int n) { a8 (n); }
22 void a6 (int n) { a7 (n); }
23 void a5 (int n) { a6 (n); }
24 void a4 (int n) { a5 (n); }
25 void a3 (int n) { a4 (n); }
26 void a2 (int n) { a3 (n); }
27 void a1 (int n) { a2 (n); }
28
29 int main(void)
30 {
31    int i;
32
33    // This one exceeds the default --depth.
34    for (i = 0; i < 10; i++)
35       a1(400);    // divisible by 16 -- no slop
36
37    return 0;
38 }