|
From: <sv...@va...> - 2010-08-26 10:56:35
|
Author: bart
Date: 2010-08-26 11:56:27 +0100 (Thu, 26 Aug 2010)
New Revision: 11292
Log:
Added new memcheck command-line option --show-possibly-lost. Closes #201170.
Added:
trunk/memcheck/tests/leak-cases-possible.stderr.exp
trunk/memcheck/tests/leak-cases-possible.vgtest
Modified:
trunk/NEWS
trunk/docs/xml/FAQ.xml
trunk/memcheck/docs/mc-manual.xml
trunk/memcheck/mc_include.h
trunk/memcheck/mc_leakcheck.c
trunk/memcheck/mc_main.c
trunk/memcheck/tests/Makefile.am
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/NEWS 2010-08-26 10:56:27 UTC (rev 11292)
@@ -29,7 +29,9 @@
Both can be used for a better approximation of a "Cycle Estimation" as
derived event (you need to update the event formula in KCachegrind yourself).
+- Added new memcheck command-line option --show-possibly-lost.
+
Release 3.5.0 (19 August 2009)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3.5.0 is a feature release with many significant improvements and the
Modified: trunk/docs/xml/FAQ.xml
===================================================================
--- trunk/docs/xml/FAQ.xml 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/docs/xml/FAQ.xml 2010-08-26 10:56:27 UTC (rev 11292)
@@ -528,7 +528,10 @@
</listitem>
<listitem>
<para>"possibly lost" means your program is leaking
- memory, unless you're doing funny things with pointers.</para>
+ memory, unless you're doing funny things with pointers.
+ This is sometimes reasonable. Use
+ <option>--show-possibly-lost=no</option> if you don't want to see
+ these reports.</para>
</listitem>
<listitem>
<para>"still reachable" means your program is probably ok -- it
Modified: trunk/memcheck/docs/mc-manual.xml
===================================================================
--- trunk/memcheck/docs/mc-manual.xml 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/memcheck/docs/mc-manual.xml 2010-08-26 10:56:27 UTC (rev 11292)
@@ -620,6 +620,16 @@
</listitem>
</varlistentry>
+ <varlistentry id="opt.show-possibly-lost" xreflabel="--show-possibly-lost">
+ <term>
+ <option><![CDATA[--show-possibly-lost=<yes|no> [default: yes] ]]></option>
+ </term>
+ <listitem>
+ <para>When disabled, the memory leak detector will not show "possibly lost" blocks.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="opt.leak-resolution" xreflabel="--leak-resolution">
<term>
<option><![CDATA[--leak-resolution=<low|med|high> [default: high] ]]></option>
Modified: trunk/memcheck/mc_include.h
===================================================================
--- trunk/memcheck/mc_include.h 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/memcheck/mc_include.h 2010-08-26 10:56:27 UTC (rev 11292)
@@ -395,6 +395,9 @@
/* In leak check, show reachable-but-not-freed blocks? default: NO */
extern Bool MC_(clo_show_reachable);
+/* In leak check, show possibly-lost blocks? default: YES */
+extern Bool MC_(clo_show_possibly_lost);
+
/* Assume accesses immediately below %esp are due to gcc-2.96 bugs.
* default: NO */
extern Bool MC_(clo_workaround_gcc296_bugs);
Modified: trunk/memcheck/mc_leakcheck.c
===================================================================
--- trunk/memcheck/mc_leakcheck.c 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/memcheck/mc_leakcheck.c 2010-08-26 10:56:27 UTC (rev 11292)
@@ -845,7 +845,8 @@
print_record = is_full_check &&
( MC_(clo_show_reachable) ||
Unreached == lr->key.state ||
- Possible == lr->key.state );
+ ( MC_(clo_show_possibly_lost) &&
+ Possible == lr->key.state ) );
// We don't count a leaks as errors with --leak-check=summary.
// Otherwise you can get high error counts with few or no error
// messages, which can be confusing. Also, you could argue that
Modified: trunk/memcheck/mc_main.c
===================================================================
--- trunk/memcheck/mc_main.c 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/memcheck/mc_main.c 2010-08-26 10:56:27 UTC (rev 11292)
@@ -4744,6 +4744,7 @@
LeakCheckMode MC_(clo_leak_check) = LC_Summary;
VgRes MC_(clo_leak_resolution) = Vg_HighRes;
Bool MC_(clo_show_reachable) = False;
+Bool MC_(clo_show_possibly_lost) = True;
Bool MC_(clo_workaround_gcc296_bugs) = False;
Int MC_(clo_malloc_fill) = -1;
Int MC_(clo_free_fill) = -1;
@@ -4793,6 +4794,8 @@
if VG_BOOL_CLO(arg, "--partial-loads-ok", MC_(clo_partial_loads_ok)) {}
else if VG_BOOL_CLO(arg, "--show-reachable", MC_(clo_show_reachable)) {}
+ else if VG_BOOL_CLO(arg, "--show-possibly-lost",
+ MC_(clo_show_possibly_lost)) {}
else if VG_BOOL_CLO(arg, "--workaround-gcc296-bugs",
MC_(clo_workaround_gcc296_bugs)) {}
@@ -4863,6 +4866,8 @@
" --leak-check=no|summary|full search for memory leaks at exit? [summary]\n"
" --leak-resolution=low|med|high differentiation of leak stack traces [high]\n"
" --show-reachable=no|yes show reachable blocks in leak check? [no]\n"
+" --show-possibly-lost=no|yes show possibly lost blocks in leak check?\n"
+" [yes]\n"
" --undef-value-errors=no|yes check for undefined value errors [yes]\n"
" --track-origins=no|yes show origins of undefined values? [no]\n"
" --partial-loads-ok=no|yes too hard to explain here; see manual [no]\n"
Modified: trunk/memcheck/tests/Makefile.am
===================================================================
--- trunk/memcheck/tests/Makefile.am 2010-08-26 09:41:18 UTC (rev 11291)
+++ trunk/memcheck/tests/Makefile.am 2010-08-26 10:56:27 UTC (rev 11292)
@@ -74,6 +74,7 @@
inline.stderr.exp inline.stdout.exp inline.vgtest \
leak-0.vgtest leak-0.stderr.exp \
leak-cases-full.vgtest leak-cases-full.stderr.exp \
+ leak-cases-possible.vgtest leak-cases-possible.stderr.exp \
leak-cases-summary.vgtest leak-cases-summary.stderr.exp \
leak-cycle.vgtest leak-cycle.stderr.exp \
leak-pool-0.vgtest leak-pool-0.stderr.exp \
Added: trunk/memcheck/tests/leak-cases-possible.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-cases-possible.stderr.exp (rev 0)
+++ trunk/memcheck/tests/leak-cases-possible.stderr.exp 2010-08-26 10:56:27 UTC (rev 11292)
@@ -0,0 +1,22 @@
+leaked: 80 bytes in 5 blocks
+dubious: 96 bytes in 6 blocks
+reachable: 64 bytes in 4 blocks
+suppressed: 0 bytes in 0 blocks
+16 bytes in 1 blocks are definitely lost in loss record ... of ...
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: mk (leak-cases.c:52)
+ by 0x........: f (leak-cases.c:74)
+ by 0x........: main (leak-cases.c:107)
+
+32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: mk (leak-cases.c:52)
+ by 0x........: f (leak-cases.c:76)
+ by 0x........: main (leak-cases.c:107)
+
+32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record ... of ...
+ at 0x........: malloc (vg_replace_malloc.c:...)
+ by 0x........: mk (leak-cases.c:52)
+ by 0x........: f (leak-cases.c:91)
+ by 0x........: main (leak-cases.c:107)
+
Added: trunk/memcheck/tests/leak-cases-possible.vgtest
===================================================================
--- trunk/memcheck/tests/leak-cases-possible.vgtest (rev 0)
+++ trunk/memcheck/tests/leak-cases-possible.vgtest 2010-08-26 10:56:27 UTC (rev 11292)
@@ -0,0 +1,2 @@
+prog: leak-cases
+vgopts: -q --leak-check=full --leak-resolution=high --show-possibly-lost=no
|