diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-06 14:51:48 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-06 14:51:48 +0000 |
commit | dd486eb27ce3fc75e02311d3e36d9e10a9f56eee (patch) | |
tree | a94f984308aa02ce879de7afc0672f6a1d92a100 /gcc/coverage.c | |
parent | c07e547752171cafffdbae0c46f90251d266141b (diff) | |
download | gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.zip gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.tar.gz gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.tar.bz2 |
gcov-io.h: Add a local time stamp.
* gcov-io.h: Add a local time stamp.
(struct gcov_info): Add stamp field.
(gcov_truncate): New.
* coverage.c (read_counts_file): Skip the stamp.
(coverage_begin_output): Write the stamp.
(build_gcov_info): Declare and init the stamp.
(coverage_finish): Only unlink data file, if stamp is zero.
* gcov-dump.c (dump_file): Dump the stamp.
* gcov.c (bbg_stamp): New.
(release_structures): Clear bbg_stamp.
(read_graph_file): Read stamp.
(read_count_file): Check stamp.
* libgcov.c (gcov_exit): Check stamp and truncate if needed.
From-SVN: r69006
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index 7f0aa8d..4a00332 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -182,6 +182,9 @@ read_counts_file (void) return; } + /* Read and discard the stamp. */ + gcov_read_unsigned (); + counts_hash = htab_create (10, htab_counts_entry_hash, htab_counts_entry_eq, htab_counts_entry_del); @@ -445,6 +448,7 @@ coverage_begin_output (void) { gcov_write_unsigned (GCOV_GRAPH_MAGIC); gcov_write_unsigned (GCOV_VERSION); + gcov_write_unsigned (local_tick); } bbg_file_opened = 1; } @@ -708,6 +712,14 @@ build_gcov_info (void) fields = field; value = tree_cons (field, null_pointer_node, value); + /* stamp */ + field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node); + TREE_CHAIN (field) = fields; + fields = field; + value = tree_cons (field, convert (unsigned_intSI_type_node, + build_int_2 (local_tick, 0)), + value); + /* Filename */ string_type = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST)); @@ -905,13 +917,9 @@ coverage_finish (void) if (error) unlink (bbg_file_name); -#if SELF_COVERAGE - /* If the compiler is instrumented, we should not - unconditionally remove the counts file, because we might be - recompiling ourselves. The .da files are all removed during - copying the stage1 files. */ - if (error) -#endif + if (!local_tick) + /* Only remove the da file, if we cannot stamp it. If we can + stamp it, libgcov will DTRT. */ unlink (da_file_name); } } |