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 16void a12(int n) { malloc(n); } 17void a11(int n) { a12(n); } 18void a10(int n) { a11(n); } 19void a9 (int n) { a10(n); } 20void a8 (int n) { a9 (n); } 21void a7 (int n) { a8 (n); } 22void a6 (int n) { a7 (n); } 23void a5 (int n) { a6 (n); } 24void a4 (int n) { a5 (n); } 25void a3 (int n) { a4 (n); } 26void a2 (int n) { a3 (n); } 27void a1 (int n) { a2 (n); } 28 29int 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} 39