From: Tom Hughes Date: Fri, 18 Jul 2008 08:48:04 +0000 (+0000) Subject: When the leak checker finds overlapping blocks report the details X-Git-Tag: svn/VALGRIND_3_4_0~321 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a4475c1296ca5a98bb501a398bfdb3e20c538ed;p=thirdparty%2Fvalgrind.git When the leak checker finds overlapping blocks report the details before asserting. Based on patch from John Reiser . git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8441 --- diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 3a7fa65eaf..d9dc42f2d3 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -704,14 +704,20 @@ void MC_(do_detect_memory_leaks) ( to screw up is to use VALGRIND_MALLOCLIKE_BLOCK for stack locations; again nonsensical. */ for (i = 0; i < lc_n_shadows-1; i++) { - tl_assert( /* normal case - no overlap */ - (lc_shadows[i]->data + lc_shadows[i]->szB - <= lc_shadows[i+1]->data ) - || - /* degenerate case: exact duplicates */ - (lc_shadows[i]->data == lc_shadows[i+1]->data - && lc_shadows[i]->szB == lc_shadows[i+1]->szB) - ); + Bool nonsense_overlap = ! ( + /* normal case - no overlap */ + (lc_shadows[i]->data + lc_shadows[i]->szB <= lc_shadows[i+1]->data) + || + /* degenerate case: exact duplicates */ + (lc_shadows[i]->data == lc_shadows[i+1]->data + && lc_shadows[i]->szB == lc_shadows[i+1]->szB) + ); + if (nonsense_overlap) { + VG_(message)(Vg_UserMsg, "Block [0x%lx, 0x%lx) overlaps with block [0x%lx, 0x%lx)", + lc_shadows[ i]->data, (lc_shadows[ i]->data + lc_shadows[ i]->szB), + lc_shadows[1+ i]->data, (lc_shadows[1+ i]->data + lc_shadows[1+ i]->szB) ); + } + tl_assert (!nonsense_overlap); } if (lc_n_shadows == 0) {