diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-06 14:51:48 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-06 14:51:48 +0000 |
commit | 42fa384f7f1d12e02987b17d2650e2136b38fa00 (patch) | |
tree | a94f984308aa02ce879de7afc0672f6a1d92a100 /gcc/coverage.c | |
parent | b80f1d67f4ed212faa54034bed77dec05afdad97 (diff) | |
download | gcc-42fa384f7f1d12e02987b17d2650e2136b38fa00.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69006 138bc75d-0d04-0410-961f-82ee72b054a4
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 7f0aa8da012..4a0033247ad 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); } } |