From: Ivo Raisr Date: Mon, 14 Dec 2015 20:14:44 +0000 (+0000) Subject: Fix expected output of massif/tests/mmapunmap on Solaris. X-Git-Tag: svn/VALGRIND_3_12_0~274 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=683c52fb7ed4ab1e73b049f5d7b2de8e8a6b88bc;p=thirdparty%2Fvalgrind.git Fix expected output of massif/tests/mmapunmap on Solaris. On Solaris and Linux, mmap() is an optimized function without prologue and epilogue. However, Solaris libc does not currently bear any DWARF CFI. Therefore stack chain unwinder grabs only two entries: IP inside mmap() and return address from the previous frame which points inside _start(), right after where main() is invoked. By introducing an intermediate function f(), main() is now visible in the stack trace even on Solaris. n-i-bz git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15749 --- diff --git a/massif/tests/mmapunmap.c b/massif/tests/mmapunmap.c index 4bb4e5a18e..d5fef5c475 100644 --- a/massif/tests/mmapunmap.c +++ b/massif/tests/mmapunmap.c @@ -4,13 +4,16 @@ #include #include "tests/sys_mman.h" -int main() +static void *f(void) { - void *m; + return mmap(NULL, 80 * 1000 * 1024, + PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, + -1, 0); +} - m = mmap(NULL, 80 * 1000 * 1024, - PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, - -1, 0); +int main() +{ + void *m = f(); munmap(m, 80 * 1000 * 1024); return 0; } diff --git a/massif/tests/mmapunmap.post.exp b/massif/tests/mmapunmap.post.exp index 50e5c6ea95..dd097373e2 100644 --- a/massif/tests/mmapunmap.post.exp +++ b/massif/tests/mmapunmap.post.exp @@ -1 +1 @@ - n0: 81920000 0x........: main (mmapunmap.c:11) + n0: 81920000 0x........: main (mmapunmap.c:16) diff --git a/massif/tests/mmapunmap.vgtest b/massif/tests/mmapunmap.vgtest index 3ad713fdb3..503b750f92 100644 --- a/massif/tests/mmapunmap.vgtest +++ b/massif/tests/mmapunmap.vgtest @@ -2,5 +2,5 @@ prog: mmapunmap vgopts: --pages-as-heap=yes --threshold=30.0 -q vgopts: --stacks=no --time-unit=B --depth=8 --massif-out-file=massif.out vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element -post: grep -A3 -e =peak massif.out | grep -e 'main (mmapunmap.c:11)' | ../../tests/filter_addresses +post: grep -A4 -e =peak massif.out | grep -e 'main (mmapunmap.c:16)' | tr -s ' ' | ../../tests/filter_addresses cleanup: rm massif.out