Author: njn Date: 2007-10-09 03:24:03 +0100 (Tue, 09 Oct 2007) New Revision: 6967
Log: - Added some tests for complicated stack trace cases. - Now allowing a stack trace with no entries, due to something like --alloc-main, whereas previously it was aborting. Unlikely in practice, pretty harmless, and seems better than aborting. Added: branches/MASSIF2/massif/tests/deep-A.post.exp branches/MASSIF2/massif/tests/deep-A.stderr.exp branches/MASSIF2/massif/tests/deep-A.vgtest branches/MASSIF2/massif/tests/deep-B.post.exp branches/MASSIF2/massif/tests/deep-B.stderr.exp branches/MASSIF2/massif/tests/deep-B.vgtest branches/MASSIF2/massif/tests/deep-C.post.exp branches/MASSIF2/massif/tests/deep-C.stderr.exp branches/MASSIF2/massif/tests/deep-C.vgtest branches/MASSIF2/massif/tests/deep-D.post.exp branches/MASSIF2/massif/tests/deep-D.stderr.exp branches/MASSIF2/massif/tests/deep-D.vgtest branches/MASSIF2/massif/tests/deep-E.post.exp branches/MASSIF2/massif/tests/deep-E.stderr.exp branches/MASSIF2/massif/tests/deep-E.vgtest branches/MASSIF2/massif/tests/deep.c Modified: branches/MASSIF2/massif/ms_main.c branches/MASSIF2/massif/tests/Makefile.am Modified: branches/MASSIF2/massif/ms_main.c =================================================================== --- branches/MASSIF2/massif/ms_main.c 2007-10-09 01:05:04 UTC (rev 6966) +++ branches/MASSIF2/massif/ms_main.c 2007-10-09 02:24:03 UTC (rev 6967) @@ -33,7 +33,7 @@ // Todo: // - do snapshots on client requests // - Add ability to draw multiple graphs, eg. heap-only, stack-only, total. -// Give each graph a title. +// Give each graph a title. (try to do it generically!) // - make file format more generic. Obstacles: // - unit prefixes are not generic // - preset column widths for stats are not generic @@ -42,10 +42,6 @@ // - consider 'instructions executed' as a time unit -- more regular than // ms, less artificial than B (bug #121629) // - do a graph-drawing test -// - do tests with complicated stack traces -- big ones, ones that require -// XCon_redo, ones that exceed --depth, etc. -// - test what happens when alloc-fns cover an entire trace -// (it aborts -- should give a warning and do something less drastic?) // - write a good basic test that shows how the tool works, suitable for // documentation // - make everything configurable, eg. min/max number of snapshots (which @@ -346,7 +342,7 @@ static Bool clo_heap = True; static UInt clo_heap_admin = 8; static Bool clo_stacks = True; -static UInt clo_depth = 8; +static UInt clo_depth = 8; // XXX: too low? static UInt clo_threshold = 100; // 100 == 1% static UInt clo_time_unit = TimeMS; @@ -650,10 +646,11 @@ } // Get the stack trace for an XCon, filtering out uninteresting entries: -// alloc-fns and entries above alloc-fns, and entries below -// main-or-below-main. -// Eg: alloc-fn1 / alloc-fn2 / a / b / main / (below main) / c -// becomes: a / b / main +// alloc-fns and entries above alloc-fns, and entries below main-or-below-main. +// Eg: alloc-fn1 / alloc-fn2 / a / b / main / (below main) / c +// becomes: a / b / main +// Nb: it's possible to end up with an empty trace, eg. if 'main' is marked +// as an alloc-fn. This is ok. static Int get_IPs( ThreadId tid, Bool is_custom_alloc, Addr ips[], Int max_ips) { @@ -678,6 +675,12 @@ // In other words, to redo, we'd have to get a stack trace as big as we // asked for, remove more than 'overestimate' alloc-fns, and not hit // main-or-below-main. + // + // Nb: it's possible that an alloc-fn may be found in the overestimate + // portion, in which case the trace will be shrunk, even though it + // arguably shouldn't. But it would require a very large chain of + // alloc-fns, and the best behaviour isn't all that clear, so we don't + // worry about it. // Main loop for (overestimate = 3; True; overestimate += 6) { @@ -686,13 +689,14 @@ if (overestimate > MAX_OVERESTIMATE) VG_(tool_panic)("get_IPs: ips[] too small, inc. MAX_OVERESTIMATE?"); - // Ask for more than clo_depth suggests we need. + // Ask for some more IPs than clo_depth suggests we need. n_ips = VG_(get_StackTrace)( tid, ips, clo_depth + overestimate ); tl_assert(n_ips > 0); // If we got fewer IPs than we asked for, redo=False - if (n_ips < clo_depth + overestimate) + if (n_ips < clo_depth + overestimate) { fewer_IPs_than_asked_for = True; + } // Filter uninteresting entries out of the stack trace. n_ips is // updated accordingly. @@ -714,17 +718,6 @@ // before it. if (is_alloc_fn(buf)) { Int j; - if (i+1 >= n_ips) { - // This occurs if removing an alloc-fn and entries above - // it results in an empty stack trace. - VG_(message)(Vg_UserMsg, - "User error: nothing but alloc-fns in stack trace"); - VG_(message)(Vg_UserMsg, - "Try removing --alloc-fn=%s option and try again.", buf); - VG_(message)(Vg_UserMsg, - "Exiting."); - VG_(exit)(1); - } n_alloc_fns_removed = i+1; // Shuffle the rest down. Modified: branches/MASSIF2/massif/tests/Makefile.am =================================================================== --- branches/MASSIF2/massif/tests/Makefile.am 2007-10-09 01:05:04 UTC (rev 6966) +++ branches/MASSIF2/massif/tests/Makefile.am 2007-10-09 02:24:03 UTC (rev 6967) @@ -8,6 +8,11 @@ alloc-fns-A.post.exp alloc-fns-A.stderr.exp alloc-fns-A.vgtest \ alloc-fns-B.post.exp alloc-fns-B.stderr.exp alloc-fns-B.vgtest \ basic.post.exp basic.stderr.exp basic.vgtest \ + deep-A.post.exp deep-A.stderr.exp deep-A.vgtest \ + deep-B.post.exp deep-B.stderr.exp deep-B.vgtest \ + deep-C.post.exp deep-C.stderr.exp deep-C.vgtest \ + deep-D.post.exp deep-D.stderr.exp deep-D.vgtest \ + deep-E.post.exp deep-E.stderr.exp deep-E.vgtest \ culling1.stderr.exp culling1.vgtest \ culling2.stderr.exp culling2.vgtest \ custom_alloc.post.exp custom_alloc.stderr.exp custom_alloc.vgtest @@ -38,6 +43,7 @@ basic \ culling1 culling2 \ custom_alloc \ + deep \ ignoring \ long-time \ null \ Added: branches/MASSIF2/massif/tests/deep-A.post.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-A.post.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-A.post.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,60 @@ +-------------------------------------------------------------------------------- +Command: ./deep +Massif arguments: --stacks=no --time-unit=B +ms_print arguments: massif.out +-------------------------------------------------------------------------------- + + + KB +1.055^ : + | : + | @ : + | @ : + | : @ : + | : @ : + | : : @ : + | : : @ : + | : : : @ : + | : : : @ : + | : : : : @ : + | : : : : @ : + | : : : : : @ : + | : : : : : @ : + | : : : : : : @ : + | : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : : @ : + | : : : : : : : : @ : + 0 [EMAIL PROTECTED]>KB + 0 1.055 + +Number of snapshots: 11 + Detailed snapshots: [9] +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 0 0 0 0 0 0 + 1 108 108 100 8 0 + 2 216 216 200 16 0 + 3 324 324 300 24 0 + 4 432 432 400 32 0 + 5 540 540 500 40 0 + 6 648 648 600 48 0 + 7 756 756 700 56 0 + 8 864 864 800 64 0 + 9 972 972 900 72 0 +92.59% (900B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. +->92.59% (900B) 0x804838D: a12 (deep.c:16) + ->92.59% (900B) 0x80483A3: a11 (deep.c:17) + ->92.59% (900B) 0x80483B9: a10 (deep.c:18) + ->92.59% (900B) 0x80483CF: a9 (deep.c:19) + ->92.59% (900B) 0x80483E5: a8 (deep.c:20) + ->92.59% (900B) 0x80483FB: a7 (deep.c:21) + ->92.59% (900B) 0x8048411: a6 (deep.c:22) + ->92.59% (900B) 0x8048427: a5 (deep.c:23) + +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 10 1,080 1,080 1,000 80 0 Added: branches/MASSIF2/massif/tests/deep-A.stderr.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-A.stderr.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-A.stderr.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,2 @@ + + Added: branches/MASSIF2/massif/tests/deep-A.vgtest =================================================================== --- branches/MASSIF2/massif/tests/deep-A.vgtest (rev 0) +++ branches/MASSIF2/massif/tests/deep-A.vgtest 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,4 @@ +prog: deep +vgopts: --stacks=no --time-unit=B +post: perl ../../massif/ms_print massif.out +cleanup: rm massif.out Added: branches/MASSIF2/massif/tests/deep-B.post.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-B.post.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-B.post.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,58 @@ +-------------------------------------------------------------------------------- +Command: ./deep +Massif arguments: --stacks=no --time-unit=B --alloc-fn=a6 +ms_print arguments: massif.out +-------------------------------------------------------------------------------- + + + KB +1.055^ : + | : + | @ : + | @ : + | : @ : + | : @ : + | : : @ : + | : : @ : + | : : : @ : + | : : : @ : + | : : : : @ : + | : : : : @ : + | : : : : : @ : + | : : : : : @ : + | : : : : : : @ : + | : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : : @ : + | : : : : : : : : @ : + 0 [EMAIL PROTECTED]>KB + 0 1.055 + +Number of snapshots: 11 + Detailed snapshots: [9] +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 0 0 0 0 0 0 + 1 108 108 100 8 0 + 2 216 216 200 16 0 + 3 324 324 300 24 0 + 4 432 432 400 32 0 + 5 540 540 500 40 0 + 6 648 648 600 48 0 + 7 756 756 700 56 0 + 8 864 864 800 64 0 + 9 972 972 900 72 0 +92.59% (900B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. +->92.59% (900B) 0x8048427: a5 (deep.c:23) + ->92.59% (900B) 0x804843D: a4 (deep.c:24) + ->92.59% (900B) 0x8048453: a3 (deep.c:25) + ->92.59% (900B) 0x8048469: a2 (deep.c:26) + ->92.59% (900B) 0x804847F: a1 (deep.c:27) + ->92.59% (900B) 0x80484B3: main (deep.c:35) + +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 10 1,080 1,080 1,000 80 0 Added: branches/MASSIF2/massif/tests/deep-B.stderr.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-B.stderr.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-B.stderr.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,37 @@ +Massif: alloc-fns: +Massif: 1: a6 +Massif: 2: calloc +Massif: 3: realloc +Massif: 4: memalign +Massif: 5: __builtin_new +Massif: 6: __builtin_vec_new +Massif: 7: malloc +Massif: startup S. 0 (t:0, hp:0, ad:0, st:0) +Massif: alloc S. 1 (t:108, hp:100, ad:8, st:0) +Massif: alloc S. 2 (t:216, hp:200, ad:16, st:0) +Massif: alloc S. 3 (t:324, hp:300, ad:24, st:0) +Massif: alloc S. 4 (t:432, hp:400, ad:32, st:0) +Massif: alloc S. 5 (t:540, hp:500, ad:40, st:0) +Massif: alloc S. 6 (t:648, hp:600, ad:48, st:0) +Massif: alloc S. 7 (t:756, hp:700, ad:56, st:0) +Massif: alloc S. 8 (t:864, hp:800, ad:64, st:0) +Massif: alloc Sd 9 (t:972, hp:900, ad:72, st:0) +Massif: alloc S. 10 (t:1080, hp:1000, ad:80, st:0) +Massif: allocs: 10 +Massif: zeroallocs: 0 (0%) +Massif: reallocs: 0 +Massif: frees: 0 +Massif: stack allocs: 0 +Massif: stack frees: 0 +Massif: XPts: 7 +Massif: top-XPts: 1 (14%) +Massif: dup'd XPts: 7 +Massif: dup'd/freed XPts: 0 +Massif: XPt-init-expansions: 6 +Massif: XPt-later-expansions: 0 +Massif: skipped snapshots: 0 +Massif: real snapshots: 11 +Massif: detailed snapshots: 1 +Massif: peak snapshots: 0 +Massif: cullings: 0 +Massif: XCon_redos: 10 Added: branches/MASSIF2/massif/tests/deep-B.vgtest =================================================================== --- branches/MASSIF2/massif/tests/deep-B.vgtest (rev 0) +++ branches/MASSIF2/massif/tests/deep-B.vgtest 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,5 @@ +prog: deep +vgopts: --stacks=no --time-unit=B --alloc-fn=a6 -v +stderr_filter: filter_verbose +post: perl ../../massif/ms_print massif.out +cleanup: rm massif.out Added: branches/MASSIF2/massif/tests/deep-C.post.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-C.post.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-C.post.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,55 @@ +-------------------------------------------------------------------------------- +Command: ./deep +Massif arguments: --stacks=no --time-unit=B --alloc-fn=a3 +ms_print arguments: massif.out +-------------------------------------------------------------------------------- + + + KB +1.055^ : + | : + | @ : + | @ : + | : @ : + | : @ : + | : : @ : + | : : @ : + | : : : @ : + | : : : @ : + | : : : : @ : + | : : : : @ : + | : : : : : @ : + | : : : : : @ : + | : : : : : : @ : + | : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : : @ : + | : : : : : : : : @ : + 0 [EMAIL PROTECTED]>KB + 0 1.055 + +Number of snapshots: 11 + Detailed snapshots: [9] +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 0 0 0 0 0 0 + 1 108 108 100 8 0 + 2 216 216 200 16 0 + 3 324 324 300 24 0 + 4 432 432 400 32 0 + 5 540 540 500 40 0 + 6 648 648 600 48 0 + 7 756 756 700 56 0 + 8 864 864 800 64 0 + 9 972 972 900 72 0 +92.59% (900B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. +->92.59% (900B) 0x8048469: a2 (deep.c:26) + ->92.59% (900B) 0x804847F: a1 (deep.c:27) + ->92.59% (900B) 0x80484B3: main (deep.c:35) + +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 10 1,080 1,080 1,000 80 0 Added: branches/MASSIF2/massif/tests/deep-C.stderr.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-C.stderr.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-C.stderr.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,37 @@ +Massif: alloc-fns: +Massif: 1: a3 +Massif: 2: calloc +Massif: 3: realloc +Massif: 4: memalign +Massif: 5: __builtin_new +Massif: 6: __builtin_vec_new +Massif: 7: malloc +Massif: startup S. 0 (t:0, hp:0, ad:0, st:0) +Massif: alloc S. 1 (t:108, hp:100, ad:8, st:0) +Massif: alloc S. 2 (t:216, hp:200, ad:16, st:0) +Massif: alloc S. 3 (t:324, hp:300, ad:24, st:0) +Massif: alloc S. 4 (t:432, hp:400, ad:32, st:0) +Massif: alloc S. 5 (t:540, hp:500, ad:40, st:0) +Massif: alloc S. 6 (t:648, hp:600, ad:48, st:0) +Massif: alloc S. 7 (t:756, hp:700, ad:56, st:0) +Massif: alloc S. 8 (t:864, hp:800, ad:64, st:0) +Massif: alloc Sd 9 (t:972, hp:900, ad:72, st:0) +Massif: alloc S. 10 (t:1080, hp:1000, ad:80, st:0) +Massif: allocs: 10 +Massif: zeroallocs: 0 (0%) +Massif: reallocs: 0 +Massif: frees: 0 +Massif: stack allocs: 0 +Massif: stack frees: 0 +Massif: XPts: 4 +Massif: top-XPts: 1 (25%) +Massif: dup'd XPts: 4 +Massif: dup'd/freed XPts: 0 +Massif: XPt-init-expansions: 3 +Massif: XPt-later-expansions: 0 +Massif: skipped snapshots: 0 +Massif: real snapshots: 11 +Massif: detailed snapshots: 1 +Massif: peak snapshots: 0 +Massif: cullings: 0 +Massif: XCon_redos: 10 Added: branches/MASSIF2/massif/tests/deep-C.vgtest =================================================================== --- branches/MASSIF2/massif/tests/deep-C.vgtest (rev 0) +++ branches/MASSIF2/massif/tests/deep-C.vgtest 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,5 @@ +prog: deep +vgopts: --stacks=no --time-unit=B --alloc-fn=a3 -v +stderr_filter: filter_verbose +post: perl ../../massif/ms_print massif.out +cleanup: rm massif.out Added: branches/MASSIF2/massif/tests/deep-D.post.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-D.post.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-D.post.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,60 @@ +-------------------------------------------------------------------------------- +Command: ./deep +Massif arguments: --stacks=no --time-unit=B --alloc-fn=main +ms_print arguments: massif.out +-------------------------------------------------------------------------------- + + + KB +1.055^ : + | : + | @ : + | @ : + | : @ : + | : @ : + | : : @ : + | : : @ : + | : : : @ : + | : : : @ : + | : : : : @ : + | : : : : @ : + | : : : : : @ : + | : : : : : @ : + | : : : : : : @ : + | : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : : @ : + | : : : : : : : : @ : + 0 [EMAIL PROTECTED]>KB + 0 1.055 + +Number of snapshots: 11 + Detailed snapshots: [9] +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 0 0 0 0 0 0 + 1 108 108 100 8 0 + 2 216 216 200 16 0 + 3 324 324 300 24 0 + 4 432 432 400 32 0 + 5 540 540 500 40 0 + 6 648 648 600 48 0 + 7 756 756 700 56 0 + 8 864 864 800 64 0 + 9 972 972 900 72 0 +92.59% (900B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. +->92.59% (900B) 0x804838D: a12 (deep.c:16) + ->92.59% (900B) 0x80483A3: a11 (deep.c:17) + ->92.59% (900B) 0x80483B9: a10 (deep.c:18) + ->92.59% (900B) 0x80483CF: a9 (deep.c:19) + ->92.59% (900B) 0x80483E5: a8 (deep.c:20) + ->92.59% (900B) 0x80483FB: a7 (deep.c:21) + ->92.59% (900B) 0x8048411: a6 (deep.c:22) + ->92.59% (900B) 0x8048427: a5 (deep.c:23) + +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 10 1,080 1,080 1,000 80 0 Added: branches/MASSIF2/massif/tests/deep-D.stderr.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-D.stderr.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-D.stderr.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,2 @@ + + Added: branches/MASSIF2/massif/tests/deep-D.vgtest =================================================================== --- branches/MASSIF2/massif/tests/deep-D.vgtest (rev 0) +++ branches/MASSIF2/massif/tests/deep-D.vgtest 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,4 @@ +prog: deep +vgopts: --stacks=no --time-unit=B --alloc-fn=main +post: perl ../../massif/ms_print massif.out +cleanup: rm massif.out Added: branches/MASSIF2/massif/tests/deep-E.post.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-E.post.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-E.post.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,52 @@ +-------------------------------------------------------------------------------- +Command: ./deep +Massif arguments: --stacks=no --time-unit=B --alloc-fn=main --depth=20 +ms_print arguments: massif.out +-------------------------------------------------------------------------------- + + + KB +1.055^ : + | : + | @ : + | @ : + | : @ : + | : @ : + | : : @ : + | : : @ : + | : : : @ : + | : : : @ : + | : : : : @ : + | : : : : @ : + | : : : : : @ : + | : : : : : @ : + | : : : : : : @ : + | : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : @ : + | : : : : : : : : @ : + | : : : : : : : : @ : + 0 [EMAIL PROTECTED]>KB + 0 1.055 + +Number of snapshots: 11 + Detailed snapshots: [9] +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 0 0 0 0 0 0 + 1 108 108 100 8 0 + 2 216 216 200 16 0 + 3 324 324 300 24 0 + 4 432 432 400 32 0 + 5 540 540 500 40 0 + 6 648 648 600 48 0 + 7 756 756 700 56 0 + 8 864 864 800 64 0 + 9 972 972 900 72 0 +92.59% (900B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc. + +-------------------------------------------------------------------------------- + n time(B) total(B) useful-heap(B) admin-heap(B) stacks(B) +-------------------------------------------------------------------------------- + 10 1,080 1,080 1,000 80 0 Added: branches/MASSIF2/massif/tests/deep-E.stderr.exp =================================================================== --- branches/MASSIF2/massif/tests/deep-E.stderr.exp (rev 0) +++ branches/MASSIF2/massif/tests/deep-E.stderr.exp 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,2 @@ + + Added: branches/MASSIF2/massif/tests/deep-E.vgtest =================================================================== --- branches/MASSIF2/massif/tests/deep-E.vgtest (rev 0) +++ branches/MASSIF2/massif/tests/deep-E.vgtest 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,4 @@ +prog: deep +vgopts: --stacks=no --time-unit=B --alloc-fn=main --depth=20 +post: perl ../../massif/ms_print massif.out +cleanup: rm massif.out Added: branches/MASSIF2/massif/tests/deep.c =================================================================== --- branches/MASSIF2/massif/tests/deep.c (rev 0) +++ branches/MASSIF2/massif/tests/deep.c 2007-10-09 02:24:03 UTC (rev 6967) @@ -0,0 +1,40 @@ +// 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, 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, 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. It would be an empty stack +// trace, except the default depth doesn't get us down to 'main'. +// - In deep-E.vgtest, we have --alloc-fn=main --depth=20, which means that +// we have an empty stack trace. That's ok. + +#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(100); + + return 0; +} ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers