From: Nicholas Nethercote Date: Wed, 1 Jul 2009 02:44:12 +0000 (+0000) Subject: Add some more functions to the default --alloc-fns list. Had to tweak how X-Git-Tag: svn/VALGRIND_3_5_0~457 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b22bb6d5b913aac058f252be3b568825e8f97902;p=thirdparty%2Fvalgrind.git Add some more functions to the default --alloc-fns list. Had to tweak how verbose output is printed so that the tests would be ok, now that different platforms have different alloc-fns lists. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10389 --- diff --git a/massif/ms_main.c b/massif/ms_main.c index f3d46feb9a..4b64bbd220 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -298,7 +298,7 @@ static void init_alloc_fns(void) VG_(free), sizeof(Char*)); #define DO(x) { Char* s = x; VG_(addToXA)(alloc_fns, &s); } - // Ordered according to (presumed) frequency. + // Ordered roughly according to (presumed) frequency. // Nb: The C++ "operator new*" ones are overloadable. We include them // always anyway, because even if they're overloaded, it would be a // prodigiously stupid overloading that caused them to not allocate @@ -313,10 +313,24 @@ static void init_alloc_fns(void) DO("calloc" ); DO("realloc" ); DO("memalign" ); + DO("posix_memalign" ); + DO("valloc" ); DO("operator new(unsigned, std::nothrow_t const&)" ); DO("operator new[](unsigned, std::nothrow_t const&)" ); DO("operator new(unsigned long, std::nothrow_t const&)" ); DO("operator new[](unsigned long, std::nothrow_t const&)"); +#if defined(VGP_ppc32_aix5) || defined(VGP_ppc64_aix5) + DO("malloc_common" ); + DO("calloc_common" ); + DO("realloc_common" ); + DO("memalign_common" ); +#elif defined(VGO_darwin) + DO("malloc_zone_malloc" ); + DO("malloc_zone_calloc" ); + DO("malloc_zone_realloc" ); + DO("malloc_zone_memalign" ); + DO("malloc_zone_valloc" ); +#endif } static void init_ignore_fns(void) @@ -2251,7 +2265,7 @@ static void ms_post_clo_init(void) VERB(1, "alloc-fns:"); for (i = 0; i < VG_(sizeXA)(alloc_fns); i++) { Char** fn_ptr = VG_(indexXA)(alloc_fns, i); - VERB(1, " %d: %s", i, *fn_ptr); + VERB(1, " %s", *fn_ptr); } VERB(1, "ignore-fns:"); diff --git a/massif/tests/culling1.stderr.exp b/massif/tests/culling1.stderr.exp index 566b130a12..a4a91e21fd 100644 --- a/massif/tests/culling1.stderr.exp +++ b/massif/tests/culling1.stderr.exp @@ -1,18 +1,20 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale diff --git a/massif/tests/culling2.stderr.exp b/massif/tests/culling2.stderr.exp index a928a135d7..b5fdf361dd 100644 --- a/massif/tests/culling2.stderr.exp +++ b/massif/tests/culling2.stderr.exp @@ -1,18 +1,20 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale diff --git a/massif/tests/deep-B.stderr.exp b/massif/tests/deep-B.stderr.exp index 59fe6eec1f..e4b20e8d87 100644 --- a/massif/tests/deep-B.stderr.exp +++ b/massif/tests/deep-B.stderr.exp @@ -1,25 +1,27 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) -Massif: 14: a6 -Massif: 15: a7 -Massif: 16: a8 -Massif: 17: a9 -Massif: 18: a10 -Massif: 19: a11 -Massif: 20: a12 +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) +Massif: a6 +Massif: a7 +Massif: a8 +Massif: a9 +Massif: a10 +Massif: a11 +Massif: a12 Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale diff --git a/massif/tests/deep-C.stderr.exp b/massif/tests/deep-C.stderr.exp index 3577914505..3243ca6102 100644 --- a/massif/tests/deep-C.stderr.exp +++ b/massif/tests/deep-C.stderr.exp @@ -1,28 +1,30 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) -Massif: 14: a3 -Massif: 15: a4 -Massif: 16: a5 -Massif: 17: a6 -Massif: 18: a7 -Massif: 19: a8 -Massif: 20: a9 -Massif: 21: a10 -Massif: 22: a11 -Massif: 23: a12 +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) +Massif: a3 +Massif: a4 +Massif: a5 +Massif: a6 +Massif: a7 +Massif: a8 +Massif: a9 +Massif: a10 +Massif: a11 +Massif: a12 Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale diff --git a/massif/tests/filter_stderr b/massif/tests/filter_stderr index e9d50df8d9..fe9be68bc1 100755 --- a/massif/tests/filter_stderr +++ b/massif/tests/filter_stderr @@ -5,5 +5,12 @@ dir=`dirname $0` $dir/../../tests/filter_stderr_basic | # Remove "Massif, ..." line and the following copyright line. -sed "/^Massif, a heap profiler./ , /./ d" +sed "/^Massif, a heap profiler./ , /./ d" | + +# Remove AIX-only alloc-fns +perl -n -e 'print if !/^Massif: (malloc|calloc|realloc|memalign)_common$/' | + +# Remove Darwin-only alloc-fns +perl -n -e 'print if !/^Massif: malloc_zone_(malloc|calloc|realloc|memalign|valloc)$/' + diff --git a/massif/tests/peak2.stderr.exp b/massif/tests/peak2.stderr.exp index 39527b0ca1..b5f190c0ee 100644 --- a/massif/tests/peak2.stderr.exp +++ b/massif/tests/peak2.stderr.exp @@ -1,18 +1,20 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale diff --git a/massif/tests/realloc.stderr.exp b/massif/tests/realloc.stderr.exp index d8fcf7ef17..2df136d34a 100644 --- a/massif/tests/realloc.stderr.exp +++ b/massif/tests/realloc.stderr.exp @@ -1,18 +1,20 @@ Massif: alloc-fns: -Massif: 0: malloc -Massif: 1: __builtin_new -Massif: 2: operator new(unsigned) -Massif: 3: operator new(unsigned long) -Massif: 4: __builtin_vec_new -Massif: 5: operator new[](unsigned) -Massif: 6: operator new[](unsigned long) -Massif: 7: calloc -Massif: 8: realloc -Massif: 9: memalign -Massif: 10: operator new(unsigned, std::nothrow_t const&) -Massif: 11: operator new[](unsigned, std::nothrow_t const&) -Massif: 12: operator new(unsigned long, std::nothrow_t const&) -Massif: 13: operator new[](unsigned long, std::nothrow_t const&) +Massif: malloc +Massif: __builtin_new +Massif: operator new(unsigned) +Massif: operator new(unsigned long) +Massif: __builtin_vec_new +Massif: operator new[](unsigned) +Massif: operator new[](unsigned long) +Massif: calloc +Massif: realloc +Massif: memalign +Massif: posix_memalign +Massif: valloc +Massif: operator new(unsigned, std::nothrow_t const&) +Massif: operator new[](unsigned, std::nothrow_t const&) +Massif: operator new(unsigned long, std::nothrow_t const&) +Massif: operator new[](unsigned long, std::nothrow_t const&) Massif: ignore-fns: Massif: 0: __part_load_locale Massif: 1: __time_load_locale