From 8da47ac82ecac7892466421279d33725e17b531c Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Mon, 18 Aug 2014 20:47:32 +0000 Subject: [PATCH] profile: Improve error messages on bad GCDA files llvm-svn: 215933 --- compiler-rt/lib/profile/GCDAProfiling.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index 5cd22c78a8fd..45fbd07e544b 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c @@ -389,13 +389,17 @@ void llvm_gcda_emit_arcs(uint32_t num_counters, uint64_t *counters) { if (val != (uint32_t)-1) { /* There are counters present in the file. Merge them. */ if (val != 0x01a10000) { - fprintf(stderr, "profiling:invalid arc tag (0x%08x)\n", val); + fprintf(stderr, "profiling: %s: cannot merge previous GCDA file: " + "corrupt arc tag (0x%08x)\n", + filename, val); return; } val = read_32bit_value(); if (val == (uint32_t)-1 || val / 2 != num_counters) { - fprintf(stderr, "profiling:invalid number of counters (%d)\n", val); + fprintf(stderr, "profiling: %s: cannot merge previous GCDA file: " + "mismatched number of counters (%d)\n", + filename, val); return; } @@ -437,13 +441,17 @@ void llvm_gcda_summary_info() { if (val != (uint32_t)-1) { /* There are counters present in the file. Merge them. */ if (val != 0xa1000000) { - fprintf(stderr, "profiling:invalid object tag (0x%08x)\n", val); + fprintf(stderr, "profiling: %s: cannot merge previous run count: " + "corrupt object tag (0x%08x)\n", + filename, val); return; } val = read_32bit_value(); /* length */ if (val != obj_summary_len) { - fprintf(stderr, "profiling:invalid object length (%d)\n", val); + fprintf(stderr, "profiling: %s: cannot merge previous run count: " + "mismatched object length (%d)\n", + filename, val); return; }