|
From: <sv...@va...> - 2009-08-11 00:52:55
|
Author: njn
Date: 2009-08-11 01:52:40 +0100 (Tue, 11 Aug 2009)
New Revision: 10773
Log:
Count error contexts properly in VG_(unique_error). Avoids the problem seen
of "5 errors from 0 contexts" with leak errors.
Modified:
trunk/NEWS
trunk/coregrind/m_errormgr.c
trunk/memcheck/mc_leakcheck.c
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-08-11 00:18:31 UTC (rev 10772)
+++ trunk/NEWS 2009-08-11 00:52:40 UTC (rev 10773)
@@ -77,6 +77,10 @@
- The default value for the --leak-resolution option has been changed from
"low" to "high". In general, this means that more leak reports will be
produced, but each leak report will describe fewer leaked blocks.
+ - "Definitely lost" and "possibly lost" leaks are now considered as normal
+ errors, ie. they are counted for the "ERROR SUMMARY" and
+ --error-exitcode. This is true even if their loss records aren't
+ printed, ie. if you run with --leak-check=summary.
- The documentation for the leak checker has also been improved.
* XXX: Atomic instructions are now handled properly...
Modified: trunk/coregrind/m_errormgr.c
===================================================================
--- trunk/coregrind/m_errormgr.c 2009-08-11 00:18:31 UTC (rev 10772)
+++ trunk/coregrind/m_errormgr.c 2009-08-11 00:52:40 UTC (rev 10773)
@@ -79,6 +79,13 @@
/* Running count of suppressed errors detected. */
static UInt n_errs_suppressed = 0;
+/* Running count of unsuppressed error contexts. */
+static UInt n_err_contexts = 0;
+
+/* Running count of suppressed error contexts. */
+static UInt n_supp_contexts = 0;
+
+
/* forwards ... */
static Supp* is_suppressible_error ( Error* err );
@@ -712,6 +719,7 @@
p->supp = is_suppressible_error(&err);
errors = p;
if (p->supp == NULL) {
+ n_err_contexts++;
n_errs_found++;
/* A bit of prettyprinting, to ensure there's a blank line
in between each error. */
@@ -727,6 +735,7 @@
is_first_shown_context = False;
n_errs_shown++;
} else {
+ n_supp_contexts++;
n_errs_suppressed++;
p->supp->count++;
}
@@ -760,8 +769,10 @@
su = is_suppressible_error(&err);
if (NULL == su) {
- if (count_error)
+ if (count_error) {
n_errs_found++;
+ n_err_contexts++;
+ }
if (print_error) {
/* A bit of prettyprinting, to ensure there's a blank line
@@ -782,6 +793,7 @@
} else {
n_errs_suppressed++;
+ n_supp_contexts++;
su->count++;
return True;
}
@@ -833,28 +845,13 @@
void VG_(show_all_errors) ( void )
{
Int i, n_min;
- Int n_err_contexts, n_supp_contexts;
Error *p, *p_min;
- Supp *su;
Bool any_supp;
if (VG_(clo_verbosity) == 0)
return;
- n_err_contexts = 0;
- for (p = errors; p != NULL; p = p->next) {
- if (p->supp == NULL)
- n_err_contexts++;
- }
-
- n_supp_contexts = 0;
- for (su = suppressions; su != NULL; su = su->next) {
- if (su->count > 0)
- n_supp_contexts++;
- }
-
- /* If we're printing XML, just show the suppressions and stop.
- */
+ /* If we're printing XML, just show the suppressions and stop. */
if (VG_(clo_xml)) {
(void)show_used_suppressions();
return;
Modified: trunk/memcheck/mc_leakcheck.c
===================================================================
--- trunk/memcheck/mc_leakcheck.c 2009-08-11 00:18:31 UTC (rev 10772)
+++ trunk/memcheck/mc_leakcheck.c 2009-08-11 00:52:40 UTC (rev 10773)
@@ -842,6 +842,9 @@
// includes indirectly lost blocks!
//
lr = lr_array[i];
+ // You could argue that indirect leaks should be counted as errors, but
+ // it seems better to make the counting criteria similar to the printing
+ // criteria. So we don't count them.
count_as_error = Unreached == lr->key.state ||
Possible == lr->key.state;
print_record = is_full_check &&
|