|
From: Nuno L. <nun...@sa...> - 2006-12-17 16:26:42
|
Hi, First of all let me thank you for this wonderful tool ;) I work in the PHP project and we are using valgrind in our automated test suite (http://gcov.php.net). It tests several extensions, which makes PHP to be linked with several libraries (each one with its own leaks and similar stuff). I'm currently having some difficulties in suppressing all those errors that come from external libraries, expecially after I added the oracle lib to the build (it has some optimizations that seem to confuse valgrind). For example this report http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=v8a0751b5763509f655d06762b4300b41 says: ==31871== Invalid free() / delete / delete[] ==31871== at 0x401D39E: free (vg_replace_malloc.c:233) ==31871== by 0x59BB11B: (within /lib/libc-2.3.2.so) ==31871== by 0x59BAE64: __libc_freeres (in /lib/libc-2.3.2.so) ==31871== by 0x40184C1: _vgnU_freeres (vg_preloaded.c:60) ==31871== by 0x58DAB17: exit (in /lib/libc-2.3.2.so) ==31871== by 0x58C4E3D: (below main) (in /lib/libc-2.3.2.so) ==31871== Address 0x59E2E90 is not stack'd, malloc'd or (recently) free'd --gen-suppressions=all produces: { <insert a suppression name here> Memcheck:Free fun:_vgrZU_libcZdsoZa_free obj:/lib/libc-2.3.2.so fun:__libc_freeres fun:_vgnU_freeres fun:exit fun:__libc_start_main } The problem is that this doesn't suppress the error. I don't know if you are aware of this problem, but I ran in a few similar issues in the server (some I could fix by replacing '_vgrZU_libcZdsoZa_free' with 'free', but not this one). If you need more details about the tests, just ask ;) BTW, just another question: is it possible to add support to silent the errors from an entire lib or for example use wilcards in the function trace (this would be very useful for us, as for example in php 4 and php 5 the entry point function has different names and thus I need two entries in the suppression file that only differ in that entry point function name.) Thanks in advance, Nuno |
|
From: Julian S. <js...@ac...> - 2006-12-17 16:50:42
|
> For example this report > http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=v8a0751b5 >763509f655d06762b4300b41 says: > > ==31871== Invalid free() / delete / delete[] > ==31871== at 0x401D39E: free (vg_replace_malloc.c:233) > ==31871== by 0x59BB11B: (within /lib/libc-2.3.2.so) > ==31871== by 0x59BAE64: __libc_freeres (in /lib/libc-2.3.2.so) > ==31871== by 0x40184C1: _vgnU_freeres (vg_preloaded.c:60) > ==31871== by 0x58DAB17: exit (in /lib/libc-2.3.2.so) > ==31871== by 0x58C4E3D: (below main) (in /lib/libc-2.3.2.so) > ==31871== Address 0x59E2E90 is not stack'd, malloc'd or (recently) free'd Hi. There was a bug with --gen-suppressions=all, which will be fixed in V 3.2.2. See patches below. However, that probably won't fix the above. Try running with --run-libc-freeres=no, and see http://www.valgrind.org/docs/manual/manual-core.html#manual-core.flags for background on it. > BTW, just another question: is it possible to add support to silent the > errors from an entire lib or for example use wilcards in the function trace > (this would be very useful for us, as for example in php 4 and php 5 the > entry point function has different names and thus I need two entries in the > suppression file that only differ in that entry point function name.) See http://www.valgrind.org/docs/manual/manual-core.html#manual-core.suppress You can use function names or object names. And you can use use ? and * in those names. That gives some level of flexibility. J Author: sewardj Date: 2006-12-06 03:35:38 +0000 (Wed, 06 Dec 2006) New Revision: 6377 Log: When generating suppressions, remember to Z-demangle function names, since the suppression-matching machinery does the same. Not doing so causes auto-generated suppressions involving Z-mangled fn names to not work. Modified: trunk/coregrind/m_errormgr.c Modified: trunk/coregrind/m_errormgr.c =================================================================== --- trunk/coregrind/m_errormgr.c 2006-12-01 18:48:56 UTC (rev 6376) +++ trunk/coregrind/m_errormgr.c 2006-12-06 03:35:38 UTC (rev 6377) @@ -402,7 +402,7 @@ { static UChar buf[ERRTXT_LEN]; - if ( VG_(get_fnname_nodemangle) (ip, buf, ERRTXT_LEN) ) { + if ( VG_(get_fnname_Z_demangle_only) (ip, buf, ERRTXT_LEN) ) { VG_(printf)(" fun:%s\n", buf); } else if ( VG_(get_objname)(ip, buf, ERRTXT_LEN) ) { VG_(printf)(" obj:%s\n", buf); Author: sewardj Date: 2006-12-06 03:36:24 +0000 (Wed, 06 Dec 2006) New Revision: 6378 Log: Fix suppression-matching bogon (Paul Floyd). Modified: trunk/memcheck/mc_main.c Modified: trunk/memcheck/mc_main.c =================================================================== --- trunk/memcheck/mc_main.c 2006-12-06 03:35:38 UTC (rev 6377) +++ trunk/memcheck/mc_main.c 2006-12-06 03:36:24 UTC (rev 6378) @@ -3437,7 +3437,7 @@ return (ekind == FreeErr || ekind == FreeMismatchErr); case OverlapSupp: - return (ekind = OverlapErr); + return (ekind == OverlapErr); case LeakSupp: return (ekind == LeakErr); |
|
From: Nuno L. <nun...@sa...> - 2006-12-17 23:05:16
|
>> For example this report >> http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=v8a0751b5 >>763509f655d06762b4300b41 says: >> >> ==31871== Invalid free() / delete / delete[] >> ==31871== at 0x401D39E: free (vg_replace_malloc.c:233) >> ==31871== by 0x59BB11B: (within /lib/libc-2.3.2.so) >> ==31871== by 0x59BAE64: __libc_freeres (in /lib/libc-2.3.2.so) >> ==31871== by 0x40184C1: _vgnU_freeres (vg_preloaded.c:60) >> ==31871== by 0x58DAB17: exit (in /lib/libc-2.3.2.so) >> ==31871== by 0x58C4E3D: (below main) (in /lib/libc-2.3.2.so) >> ==31871== Address 0x59E2E90 is not stack'd, malloc'd or (recently) >> free'd > > Hi. There was a bug with --gen-suppressions=all, which will be fixed > in V 3.2.2. See patches below. However, that probably won't fix the > above. Try running with --run-libc-freeres=no, and see > http://www.valgrind.org/docs/manual/manual-core.html#manual-core.flags > for background on it. Many thanks for your fast answer. The patches applied cleanly and valgrind is now generating suppressions correctly (I'll let you know if I find further problems). >> BTW, just another question: is it possible to add support to silent the >> errors from an entire lib or for example use wilcards in the function >> trace >> (this would be very useful for us, as for example in php 4 and php 5 the >> entry point function has different names and thus I need two entries in >> the >> suppression file that only differ in that entry point function name.) > > See > http://www.valgrind.org/docs/manual/manual-core.html#manual-core.suppress > > You can use function names or object names. And you can use use ? and * > in those names. That gives some level of flexibility. Ah, ups.. I didn't read that page before. Now my suppressions file is much smaller and easier to maintain :) BTW, just a small note: on the page you mention above, it is written the following: "Remaining lines: This is the calling context for the error -- the chain of function calls that led to it. There can be up to four of these lines". This is clearly not true.. at least valgrind generates frequently suppressions with a much bigger stack trace. Thanks, Nuno |