Nicholas Nethercote d95559802b Changed Massif to record the 'slop' heap bytes caused by rounding asked-for
sizes up to a multiple of 8 (or whatever --alignment is).  This is combined
with the "admin" bytes, resulting in the "extra" bytes.  Added
VG_(malloc_usable_size) to the tool interface to support this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7133
2007-11-10 04:08:08 +00:00

39 lines
1.2 KiB
C

// This is a test for complicated stack traces.
//
// - In deep-A.vgtest, the stack trace is larger than the asked-for depth
// (12 vs. 8) so not all of the trace is shown.
// - In deep-B.vgtest, we have --alloc-fn=a6..a12, which means that get_XCon
// needs to redo the IP getting, because 7 functions get removed from the
// trace, which is more than the initial overestimate of 3.
// - In deep-C.vgtest, we have --alloc-fn=a3..a12, which means that get_XCon
// ends up with an empty stack trace after removing all the alloc-fns.
// It then redoes it.
// - In deep-D.vgtest, we have --alloc-fn=main..a12, which means we have a
// stack trace with a single "(below main)" entry.
#include <stdlib.h>
void a12(int n) { malloc(n); }
void a11(int n) { a12(n); }
void a10(int n) { a11(n); }
void a9 (int n) { a10(n); }
void a8 (int n) { a9 (n); }
void a7 (int n) { a8 (n); }
void a6 (int n) { a7 (n); }
void a5 (int n) { a6 (n); }
void a4 (int n) { a5 (n); }
void a3 (int n) { a4 (n); }
void a2 (int n) { a3 (n); }
void a1 (int n) { a2 (n); }
int main(void)
{
int i;
// This one exceeds the default --depth.
for (i = 0; i < 10; i++)
a1(200); // divisible by 8 -- no slop
return 0;
}