X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgcov-dump.c;h=859fdb7331048f957b313c29bfa8aff41c736a41;hb=300ed5f295507ceff5167189acfb606174cf2a9c;hp=86834e25b7b4bee948818270c3d645fa3e4db1a4;hpb=952f00483ebc3e30bc9f0f76f4b80258e4fcef43;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c index 86834e25b7b..859fdb73310 100644 --- a/gcc/gcov-dump.c +++ b/gcc/gcov-dump.c @@ -1,5 +1,5 @@ /* Dump a gcov file, for debugging use. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Nathan Sidwell Gcov is free software; you can redistribute it and/or modify @@ -117,16 +117,11 @@ print_usage (void) static void print_version (void) { - char v[4]; - unsigned version = GCOV_VERSION; - unsigned ix; - - for (ix = 4; ix--; version >>= 8) - v[ix] = version; - printf ("gcov %.4s (GCC %s)\n", v, version_string); - printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); - printf ("This is free software; see the source for copying conditions. There is NO\n\ -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); + printf ("gcov-dump (GCC) %s\n", version_string); + printf ("Copyright (C) 2003 Free Software Foundation, Inc.\n"); + printf ("This is free software; see the source for copying conditions.\n" + "There is NO warranty; not even for MERCHANTABILITY or \n" + "FITNESS FOR A PARTICULAR PURPOSE.\n\n"); } static void @@ -155,35 +150,43 @@ dump_file (const char *filename) /* magic */ { unsigned magic = gcov_read_unsigned (); - unsigned version = gcov_read_unsigned (); + unsigned version; const char *type = NULL; - char e[4], v[4], m[4]; - unsigned expected = GCOV_VERSION; - unsigned ix; - int different = version != GCOV_VERSION; - - if (magic == GCOV_DATA_MAGIC) + int endianness = 0; + char m[4], v[4]; + + if ((endianness = gcov_magic (magic, GCOV_DATA_MAGIC))) type = "data"; - else if (magic == GCOV_GRAPH_MAGIC) - type = "graph"; + else if ((endianness = gcov_magic (magic, GCOV_NOTE_MAGIC))) + type = "note"; else { printf ("%s:not a gcov file\n", filename); gcov_close (); return; } - for (ix = 4; ix--; expected >>= 8, version >>= 8, magic >>= 8) + version = gcov_read_unsigned (); + GCOV_UNSIGNED2STRING (v, version); + GCOV_UNSIGNED2STRING (m, magic); + + printf ("%s:%s:magic `%.4s':version `%.4s'%s\n", filename, type, + m, v, endianness < 0 ? " (swapped endianness)" : ""); + if (version != GCOV_VERSION) { - e[ix] = expected; - v[ix] = version; - m[ix] = magic; + char e[4]; + + GCOV_UNSIGNED2STRING (e, GCOV_VERSION); + printf ("%s:warning:current version is `%.4s'\n", filename, e); } - - printf ("%s:%s:magic `%.4s':version `%.4s'\n", filename, type, m, v); - if (different) - printf ("%s:warning:current version is `%.4s'\n", filename, e); } + /* stamp */ + { + unsigned stamp = gcov_read_unsigned (); + + printf ("%s:stamp %lu\n", filename, (unsigned long)stamp); + } + while (1) { gcov_position_t base, position = gcov_position (); @@ -251,8 +254,6 @@ dump_file (const char *filename) break; } } - if (!gcov_is_eof ()) - printf ("%s:early end of file\n", filename); gcov_close (); } @@ -281,7 +282,7 @@ static void tag_blocks (const char *filename ATTRIBUTE_UNUSED, unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED) { - unsigned n_blocks = length / 4; + unsigned n_blocks = GCOV_TAG_BLOCKS_NUM (length); printf (" %u blocks", n_blocks); @@ -306,7 +307,7 @@ static void tag_arcs (const char *filename ATTRIBUTE_UNUSED, unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED) { - unsigned n_arcs = (length - 4) / 8; + unsigned n_arcs = GCOV_TAG_ARCS_NUM (length); printf (" %u arcs", n_arcs); if (flag_dump_contents) @@ -380,7 +381,7 @@ tag_counters (const char *filename ATTRIBUTE_UNUSED, unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED) { static const char *const counter_names[] = GCOV_COUNTER_NAMES; - unsigned n_counts = length / 8; + unsigned n_counts = GCOV_TAG_COUNTER_NUM (length); printf (" %s %u counts", counter_names[GCOV_COUNTER_FOR_TAG (tag)], n_counts);