Commit 24a4a033 by Jan Hubicka Committed by Jan Hubicka

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
parent f46a52d2
2003-12-29 Jan Hubicka <jh@suse.cz> 2003-12-29 Jan Hubicka <jh@suse.cz>
* coverage.c (read_counts_file): Better error messages; cause corrupted
profiles to produce hard errors, not just warnings
(get_coverage_counts): Similarly.
* toplev.c (rest_of_handle_loop_optimize): Enable LOOP_AUTO_UNROLL. * toplev.c (rest_of_handle_loop_optimize): Enable LOOP_AUTO_UNROLL.
2003-12-29 Phil Edwards <phil@codesourcery.com> 2003-12-29 Phil Edwards <phil@codesourcery.com>
......
...@@ -154,7 +154,7 @@ read_counts_file (void) ...@@ -154,7 +154,7 @@ read_counts_file (void)
counts_entry_t *summaried = NULL; counts_entry_t *summaried = NULL;
unsigned seen_summary = 0; unsigned seen_summary = 0;
gcov_unsigned_t tag; gcov_unsigned_t tag;
int error = 0; int is_error = 0;
if (!gcov_open (da_file_name, 1)) if (!gcov_open (da_file_name, 1))
return; return;
...@@ -250,17 +250,26 @@ read_counts_file (void) ...@@ -250,17 +250,26 @@ read_counts_file (void)
entry->summary.num = n_counts; entry->summary.num = n_counts;
entry->counts = xcalloc (n_counts, sizeof (gcov_type)); entry->counts = xcalloc (n_counts, sizeof (gcov_type));
} }
else if (entry->checksum != checksum else if (entry->checksum != checksum)
|| entry->summary.num != n_counts)
{ {
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); htab_delete (counts_hash);
break; break;
} }
else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE) else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE)
{ {
warning ("cannot merge separate %s counters for function %u", error ("cannot merge separate %s counters for function %u",
ctr_names[elt.ctr], fn_ident); ctr_names[elt.ctr], fn_ident);
goto skip_merge; goto skip_merge;
} }
...@@ -278,14 +287,14 @@ read_counts_file (void) ...@@ -278,14 +287,14 @@ read_counts_file (void)
skip_merge:; skip_merge:;
} }
gcov_sync (offset, length); gcov_sync (offset, length);
if ((error = gcov_is_error ())) if ((is_error = gcov_is_error ()))
break; break;
} }
if (!gcov_is_eof ()) if (!gcov_is_eof ())
{ {
warning (error < 0 ? "`%s' has overflowed" : "`%s' is corrupted", error (is_error < 0 ? "`%s' has overflowed" : "`%s' is corrupted",
da_file_name); da_file_name);
htab_delete (counts_hash); htab_delete (counts_hash);
} }
...@@ -299,6 +308,7 @@ get_coverage_counts (unsigned counter, unsigned expected, ...@@ -299,6 +308,7 @@ get_coverage_counts (unsigned counter, unsigned expected,
const struct gcov_ctr_summary **summary) const struct gcov_ctr_summary **summary)
{ {
counts_entry_t *entry, elt; counts_entry_t *entry, elt;
gcov_unsigned_t checksum = -1;
/* No hash table, no counts. */ /* No hash table, no counts. */
if (!counts_hash) if (!counts_hash)
...@@ -321,12 +331,22 @@ get_coverage_counts (unsigned counter, unsigned expected, ...@@ -321,12 +331,22 @@ get_coverage_counts (unsigned counter, unsigned expected,
return 0; return 0;
} }
if (expected != entry->summary.num checksum = compute_checksum ();
|| compute_checksum () != entry->checksum) if (entry->checksum != checksum)
{ {
warning ("coverage mismatch for `%s'", IDENTIFIER_POINTER error ("coverage mismatch for function '%s' while reading counter '%s'.",
(DECL_ASSEMBLER_NAME (current_function_decl))); IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
return NULL; 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) if (summary)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment