aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-05-14 16:01:20 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-05-14 16:01:20 +0000
commit7d63a2fae019a83772ebae65689f4113a0eb4bec (patch)
tree1253c5f7880fe8708b5e0666b848785f27dcd9cc /gcc/gcov.c
parent990f4800f2228c94b23362016ddcb11401a8e5d6 (diff)
downloadgcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.zip
gcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.tar.gz
gcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.tar.bz2
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here. (GCOV_TAG_*) Force type to gcov_unsigned_t. (GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New. (struct gcov_var): Remove modified. Add start, length, offset, overread. Have buffer array for libgcov. (gcov_sync, gcov_seek): Definitions moved to gcov-io.c. (gcov_position, gcov_rewrite, gcov_is_eof): Adjust. * gcov-io.c (gcov_open): Set mode, do not read anything. (gcov_close): Write final block. (gcov_write_block, gcov_allocate): New. (gcov_write_bytes): Make static. Write or allocate buffer. (gcov_write_unsigned, gcov_write_counter): Buffer can never be null. (gcov_write_string): Adjust. (gcov_write_tag) (gcov_write_length): Adjust. Flush the block. (gcov_write_tag_length): Buffer can never be null. (gcov_read_bytes): Make static. Read in block. (gcov_sync): Moved here. Adjust. (gcov_seek): Moved here. Adjust. * coverage.c (read_counts_file): Adjust. * gcov-dump.c (print_prefix): Add position parameter. (flag_dump_positions): New flag. (options, main, print_usage): Add it. (dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters, tag_summary): Adjust. * gcov.c (read_graph_file, read_count_file): Adjust. * libgcov.c (gcov_exit): Adjust. From-SVN: r66805
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 2225f02..32590cb 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -711,7 +711,8 @@ read_graph_file ()
struct function_info *fn = NULL;
source_t *src = NULL;
unsigned ix;
-
+ unsigned tag;
+
if (!gcov_open (bbg_file_name, 1))
{
fnotice (stderr, "%s:cannot open graph file\n", bbg_file_name);
@@ -740,11 +741,10 @@ read_graph_file ()
bbg_file_name, v, e);
}
- while (!gcov_is_eof ())
+ while ((tag = gcov_read_unsigned ()))
{
- unsigned tag = gcov_read_unsigned ();
unsigned length = gcov_read_unsigned ();
- unsigned long base = gcov_position ();
+ gcov_position_t base = gcov_position ();
if (tag == GCOV_TAG_FUNCTION)
{
@@ -906,12 +906,14 @@ read_graph_file ()
}
gcov_sync (base, length);
if (gcov_is_error ())
- {
- corrupt:;
- fnotice (stderr, "%s:corrupted\n", bbg_file_name);
- gcov_close ();
- return 1;
- }
+ break;
+ }
+ if (!gcov_is_eof ())
+ {
+ corrupt:;
+ fnotice (stderr, "%s:corrupted\n", bbg_file_name);
+ gcov_close ();
+ return 1;
}
gcov_close ();
@@ -976,7 +978,9 @@ read_count_file ()
{
unsigned ix;
unsigned version;
+ unsigned tag;
function_t *fn = NULL;
+ int error = 0;
if (!gcov_open (da_file_name, 1))
{
@@ -1005,12 +1009,10 @@ read_count_file ()
da_file_name, v, e);
}
- while (!gcov_is_eof ())
+ while ((tag = gcov_read_unsigned ()))
{
- unsigned tag = gcov_read_unsigned ();
unsigned length = gcov_read_unsigned ();
unsigned long base = gcov_position ();
- int error;
if (tag == GCOV_TAG_OBJECT_SUMMARY)
gcov_read_summary (&object_summary);
@@ -1061,13 +1063,16 @@ read_count_file ()
}
gcov_sync (base, length);
if ((error = gcov_is_error ()))
- {
- fnotice (stderr, error < 0
- ? "%s:overflowed\n" : "%s:corrupted\n", da_file_name);
- goto cleanup;
- }
+ break;
}
+ if (!gcov_is_eof ())
+ {
+ fnotice (stderr, error < 0 ? "%s:overflowed\n" : "%s:corrupted\n",
+ da_file_name);
+ goto cleanup;
+ }
+
gcov_close ();
return 0;
}