aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-12-29 10:29:21 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-12-29 09:29:21 +0000
commit24a4a0338aa591091fbbaaf39de0e31529600bbd (patch)
tree065b7688977c1e6f73e8de2bd3f41a33f5c9dc88 /gcc/coverage.c
parentf46a52d25219bfbdb22f8b8edb22c00f53490c33 (diff)
downloadgcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.zip
gcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.tar.gz
gcc-24a4a0338aa591091fbbaaf39de0e31529600bbd.tar.bz2
coverage.c (read_counts_file): Better error messages...
* coverage.c (read_counts_file): Better error messages; cause corrupted profiles to produce hard errors, not just warnings (get_coverage_counts): Similarly. From-SVN: r75198
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 9e25413..8b43d6a 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -154,7 +154,7 @@ read_counts_file (void)
counts_entry_t *summaried = NULL;
unsigned seen_summary = 0;
gcov_unsigned_t tag;
- int error = 0;
+ int is_error = 0;
if (!gcov_open (da_file_name, 1))
return;
@@ -250,17 +250,26 @@ read_counts_file (void)
entry->summary.num = n_counts;
entry->counts = xcalloc (n_counts, sizeof (gcov_type));
}
- else if (entry->checksum != checksum
- || entry->summary.num != n_counts)
+ else if (entry->checksum != checksum)
{
- warning ("coverage mismatch for function %u", fn_ident);
+ error ("coverage mismatch for function %u while reading execution counters.",
+ fn_ident);
+ error ("checksum is %x instead of %x", entry->checksum, checksum);
+ htab_delete (counts_hash);
+ break;
+ }
+ else if (entry->summary.num != n_counts)
+ {
+ error ("coverage mismatch for function %u while reading execution counters.",
+ fn_ident);
+ error ("number of counters is %d instead of %d", entry->summary.num, n_counts);
htab_delete (counts_hash);
break;
}
else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE)
{
- warning ("cannot merge separate %s counters for function %u",
- ctr_names[elt.ctr], fn_ident);
+ error ("cannot merge separate %s counters for function %u",
+ ctr_names[elt.ctr], fn_ident);
goto skip_merge;
}
@@ -278,14 +287,14 @@ read_counts_file (void)
skip_merge:;
}
gcov_sync (offset, length);
- if ((error = gcov_is_error ()))
+ if ((is_error = gcov_is_error ()))
break;
}
if (!gcov_is_eof ())
{
- warning (error < 0 ? "`%s' has overflowed" : "`%s' is corrupted",
- da_file_name);
+ error (is_error < 0 ? "`%s' has overflowed" : "`%s' is corrupted",
+ da_file_name);
htab_delete (counts_hash);
}
@@ -299,6 +308,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
const struct gcov_ctr_summary **summary)
{
counts_entry_t *entry, elt;
+ gcov_unsigned_t checksum = -1;
/* No hash table, no counts. */
if (!counts_hash)
@@ -321,12 +331,22 @@ get_coverage_counts (unsigned counter, unsigned expected,
return 0;
}
- if (expected != entry->summary.num
- || compute_checksum () != entry->checksum)
+ checksum = compute_checksum ();
+ if (entry->checksum != checksum)
{
- warning ("coverage mismatch for `%s'", IDENTIFIER_POINTER
- (DECL_ASSEMBLER_NAME (current_function_decl)));
- return NULL;
+ error ("coverage mismatch for function '%s' while reading counter '%s'.",
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
+ ctr_names[counter]);
+ error ("checksum is %x instead of %x", entry->checksum, checksum);
+ return 0;
+ }
+ else if (entry->summary.num != expected)
+ {
+ error ("coverage mismatch for function '%s' while reading counter '%s'.",
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
+ ctr_names[counter]);
+ error ("number of counters is %d instead of %d", entry->summary.num, expected);
+ return 0;
}
if (summary)