aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/gcov-dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/gcov-dump.c')
-rw-r--r--gcc-4.9/gcc/gcov-dump.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/gcc-4.9/gcc/gcov-dump.c b/gcc-4.9/gcc/gcov-dump.c
index 7df649466..bb1fd3378 100644
--- a/gcc-4.9/gcc/gcov-dump.c
+++ b/gcc-4.9/gcc/gcov-dump.c
@@ -42,6 +42,8 @@ static void tag_summary (const char *, unsigned, unsigned);
static void tag_module_info (const char *, unsigned, unsigned);
static void dump_working_sets (const char *filename ATTRIBUTE_UNUSED,
const struct gcov_ctr_summary *summary);
+static void tag_zero_fixup (const char *, unsigned, unsigned);
+static void tag_build_info (const char *, unsigned, unsigned);
extern int main (int, char **);
typedef struct tag_format
@@ -56,6 +58,9 @@ static int flag_dump_positions = 0;
static int flag_dump_aux_modules_only = 0;
static int flag_dump_working_sets = 0;
+static unsigned num_fn_info;
+static int *zero_fixup_flags = NULL;
+
static const struct option options[] =
{
{ "help", no_argument, NULL, 'h' },
@@ -78,6 +83,8 @@ static const tag_format_t tag_table[] =
{GCOV_TAG_OBJECT_SUMMARY, "OBJECT_SUMMARY", tag_summary},
{GCOV_TAG_PROGRAM_SUMMARY, "PROGRAM_SUMMARY", tag_summary},
{GCOV_TAG_MODULE_INFO, "MODULE INFO", tag_module_info},
+ {GCOV_TAG_COMDAT_ZERO_FIXUP, "ZERO FIXUP", tag_zero_fixup},
+ {GCOV_TAG_BUILD_INFO, "BUILD INFO", tag_build_info},
{0, NULL, NULL}
};
@@ -272,6 +279,8 @@ dump_gcov_file (const char *filename)
printf ("%s:stamp %lu\n", filename, (unsigned long)stamp);
}
+ num_fn_info = 0;
+
while (1)
{
gcov_position_t base, position = gcov_position ();
@@ -339,6 +348,7 @@ dump_gcov_file (const char *filename)
break;
}
}
+ free (zero_fixup_flags);
gcov_close ();
}
@@ -352,7 +362,9 @@ tag_function (const char *filename ATTRIBUTE_UNUSED,
printf (" placeholder");
else
{
- printf (" ident=%u", gcov_read_unsigned ());
+ int had_fixup = zero_fixup_flags && zero_fixup_flags[num_fn_info];
+ printf (" ident=%u%s", gcov_read_unsigned (),
+ had_fixup ? " (Was 0-count COMDAT)" : "");
printf (", lineno_checksum=0x%08x", gcov_read_unsigned ());
printf (", cfg_checksum=0x%08x", gcov_read_unsigned ());
@@ -367,6 +379,7 @@ tag_function (const char *filename ATTRIBUTE_UNUSED,
printf (":%u", gcov_read_unsigned ());
}
}
+ num_fn_info++;
}
static void
@@ -598,6 +611,54 @@ tag_module_info (const char *filename ATTRIBUTE_UNUSED,
}
static void
+tag_zero_fixup (const char *filename,
+ unsigned tag ATTRIBUTE_UNUSED, unsigned length)
+{
+ gcov_unsigned_t num_fns = 0;
+ zero_fixup_flags = gcov_read_comdat_zero_fixup (length, &num_fns);
+ if (!zero_fixup_flags)
+ {
+ printf ("%s:error reading zero fixup flags\n", filename);
+ return;
+ }
+ printf (" num_fns=%u", num_fns);
+ for (unsigned i = 0; i < num_fns; i++)
+ {
+ if (!(i % 32))
+ {
+ printf ("\n");
+ print_prefix (filename, 0, 0);
+ printf ("\t\t");
+ }
+ if (!(i % 8))
+ printf ("%s%4u:", (i%32)?" ":"", i);
+ printf ("%u", zero_fixup_flags[i]);
+ }
+}
+
+static void
+tag_build_info (const char *filename,
+ unsigned tag ATTRIBUTE_UNUSED, unsigned length)
+{
+ gcov_unsigned_t num_strings = 0;
+ char **build_info_strings = gcov_read_build_info (length, &num_strings);
+ if (!build_info_strings)
+ {
+ printf ("%s:error reading build info\n", filename);
+ return;
+ }
+ printf (" num_strings=%u", num_strings);
+ for (unsigned i = 0; i < num_strings; i++)
+ {
+ printf ("\n");
+ print_prefix (filename, 0, 0);
+ printf ("\t\t%s", build_info_strings[i]);
+ free (build_info_strings[i]);
+ }
+ free (build_info_strings);
+}
+
+static void
dump_working_sets (const char *filename ATTRIBUTE_UNUSED,
const struct gcov_ctr_summary *summary)
{