|
From: <sv...@va...> - 2007-01-12 23:59:55
|
Author: njn
Date: 2007-01-12 23:59:50 +0000 (Fri, 12 Jan 2007)
New Revision: 6514
Log:
Fix a bug reported by Bruce Lowekamp involving the interaction of
--gen-suppressions with leak checking. Added a regtest for it.
Added:
trunk/memcheck/tests/nanoleak2.c
trunk/memcheck/tests/nanoleak2.stderr.exp
trunk/memcheck/tests/nanoleak2.vgtest
Modified:
trunk/coregrind/m_errormgr.c
trunk/memcheck/tests/Makefile.am
Modified: trunk/coregrind/m_errormgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_errormgr.c 2007-01-12 22:11:45 UTC (rev 6513)
+++ trunk/coregrind/m_errormgr.c 2007-01-12 23:59:50 UTC (rev 6514)
@@ -474,6 +474,8 @@
just for pretty printing purposes. */
static Bool is_first_shown_context =3D True;
=20
+static Int n_errs_shown =3D 0;
+
/* Top-level entry point to the error management subsystem.
All detected errors are notified here; this routine decides if/when t=
he
user should see the error. */
@@ -487,7 +489,6 @@
VgRes exe_res =3D Vg_MedRes;
static Bool stopping_message =3D False;
static Bool slowdown_message =3D False;
- static Int n_errs_shown =3D 0;
=20
/* After M_COLLECT_NO_ERRORS_AFTER_SHOWN different errors have
been found, or M_COLLECT_NO_ERRORS_AFTER_FOUND total errors
@@ -649,7 +650,8 @@
void* extra, ExeContext* where, Bool print_erro=
r,
Bool allow_db_attach, Bool count_error )
{
- Error err;
+ Error err;
+ Supp *su;
=20
/* Build ourselves the error */
construct_error ( &err, tid, ekind, a, s, extra, where );
@@ -663,7 +665,8 @@
not copying 'extra'. */
(void)VG_TDICT_CALL(tool_update_extra, &err);
=20
- if (NULL =3D=3D is_suppressible_error(&err)) {
+ su =3D is_suppressible_error(&err);
+ if (NULL =3D=3D su) {
if (count_error)
n_errs_found++;
=20
@@ -672,13 +675,14 @@
VG_(message)(Vg_UserMsg, "");
pp_Error(&err);
is_first_shown_context =3D False;
+ n_errs_shown++;
+ do_actions_on_error(&err, allow_db_attach);
}
- do_actions_on_error(&err, allow_db_attach);
-
return False;
=20
} else {
n_errs_suppressed++;
+ su->count++;
return True;
}
}
Modified: trunk/memcheck/tests/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/Makefile.am 2007-01-12 22:11:45 UTC (rev 6513)
+++ trunk/memcheck/tests/Makefile.am 2007-01-12 23:59:50 UTC (rev 6514)
@@ -81,6 +81,7 @@
mmaptest.stderr.exp mmaptest.vgtest \
nanoleak.stderr.exp nanoleak.vgtest \
nanoleak_supp.stderr.exp nanoleak_supp.vgtest nanoleak.supp \
+ nanoleak2.stderr.exp nanoleak2.vgtest \
new_nothrow.stderr.exp new_nothrow.vgtest \
new_override.stderr.exp new_override.stdout.exp new_override.vgtest \
null_socket.stderr.exp null_socket.vgtest \
@@ -155,7 +156,7 @@
malloc_usable malloc1 malloc2 malloc3 manuel1 manuel2 manuel3 \
match-overrun \
memalign_test memalign2 memcmptest mempool mmaptest \
- nanoleak new_nothrow \
+ nanoleak nanoleak2 new_nothrow \
null_socket oset_test overlap \
partiallydefinedeq \
partial_load pdb-realloc pdb-realloc2 \
Added: trunk/memcheck/tests/nanoleak2.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/nanoleak2.c (rev 0)
+++ trunk/memcheck/tests/nanoleak2.c 2007-01-12 23:59:50 UTC (rev 6514)
@@ -0,0 +1,19 @@
+
+// Bruce Lowekamp <low...@si...> reported that in a program wi=
th a
+// reachable leak, if you do:
+//
+// valgrind --leak-check=3Dyes --gen-suppressions=3Dyes --show-reachab=
le=3Dno -q
+//
+// it gives the y/n/c suppression prompt for errors that aren't shown. =
This
+// test checks that is fixed.
+
+#include <stdlib.h>
+
+int* a;
+
+int main ( void )
+{
+ a =3D malloc(1000); // Becomes a reachable leak.
+ a[0] =3D 0;
+ return a[0];
+}
Added: trunk/memcheck/tests/nanoleak2.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Added: trunk/memcheck/tests/nanoleak2.vgtest
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/nanoleak2.vgtest (rev 0)
+++ trunk/memcheck/tests/nanoleak2.vgtest 2007-01-12 23:59:50 UTC (rev 65=
14)
@@ -0,0 +1,2 @@
+vgopts: --leak-check=3Dyes --gen-suppressions=3Dyes --show-reachable=3Dn=
o -q
+prog: nanoleak2
|