This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gcov-dump should print summary only for GCOV_COUNTERS_SUMMABLE


I will check this in tomorrow as obvious unless someone objects.

The array summary.crtrs only contains GCOV_COUNTERS_SUMMABLE (1) elements yet
we access GCOV_COUNTERS (5) elements.  The consequence is that we print bogus
output for the *_SUMMARY sections which made me think hard the first time I
saw it:

  inliner-1.gcda:data:magic `adcg':version `401*' (swapped endianness)
  inliner-1.gcda:stamp 1350556960
  inliner-1.gcda: 01000000:   2:FUNCTION ident=5, checksum=0x85d89dd8
  inliner-1.gcda:  01a10000:   8:COUNTERS arcs 4 counts
  inliner-1.gcda:           0 0 1 0 1
  inliner-1.gcda:  01a70000:   0:COUNTERS single 0 counts
  inliner-1.gcda: 01000000:   2:FUNCTION ident=4, checksum=0x3b2d5537
  inliner-1.gcda:  01a10000:   6:COUNTERS arcs 3 counts
  inliner-1.gcda:           0 99 99 1
  inliner-1.gcda:  01a70000:   6:COUNTERS single 3 counts
  inliner-1.gcda:           0 1 99 99
  inliner-1.gcda: 01000000:   2:FUNCTION ident=3, checksum=0x84df57b1
  inliner-1.gcda:  01a10000:   6:COUNTERS arcs 3 counts
  inliner-1.gcda:           0 0 0 0
  inliner-1.gcda:  01a70000:   6:COUNTERS single 3 counts
  inliner-1.gcda:           0 0 0 0
  inliner-1.gcda: a1000000:   9:OBJECT_SUMMARY checksum=0x00000000
  inliner-1.gcda:           counts=10, runs=1, sum_all=201, run_max=99, sum_max=99
  inliner-1.gcda:           counts=4196529, runs=0, sum_all=2701131776, run_max=4531816, sum_max=1
  inliner-1.gcda:           counts=4197440, runs=0, sum_all=4294967296, run_max=548682070723, sum_max=548682070016
  inliner-1.gcda:           counts=1734567009, runs=707866676, sum_all=119063917849739264, run_max=548682070152, sum_max=3
  inliner-1.gcda:           counts=3221223560, runs=127, sum_all=3, run_max=53, sum_max=548682070152
  inliner-1.gcda: a3000000:   9:PROGRAM_SUMMARY checksum=0xfa48aabd
  inliner-1.gcda:           counts=10, runs=1, sum_all=201, run_max=99, sum_max=99
  inliner-1.gcda:           counts=4196529, runs=0, sum_all=2734686208, run_max=4531840, sum_max=1
  inliner-1.gcda:           counts=4197440, runs=0, sum_all=4294967296, run_max=548682070723, sum_max=548682070016
  inliner-1.gcda:           counts=1734567009, runs=707866676, sum_all=119063917883293696, run_max=548682070152, sum_max=3
  inliner-1.gcda:           counts=3221223560, runs=127, sum_all=3, run_max=53, sum_max=548682070152

We now print the summary part correctly as:

  inliner-1.gcda: a1000000:   9:OBJECT_SUMMARY checksum=0x00000000
  inliner-1.gcda:           counts=10, runs=1, sum_all=201, run_max=99, sum_max=99
  inliner-1.gcda: a3000000:   9:PROGRAM_SUMMARY checksum=0xfa48aabd
  inliner-1.gcda:           counts=10, runs=1, sum_all=201, run_max=99, sum_max=99

Tested with mipsisa64-elf (although I don't think there are tests for
gcov-dump).

Adam

	* gcov-dump.c (tag_summary): Only print summaries for the first
	GCOV_COUNTERS_SUMMABLE counters.

Index: gcov-dump.c
===================================================================
--- gcov-dump.c	(revision 133756)
+++ gcov-dump.c	(working copy)
@@ -420,7 +420,7 @@ tag_summary (const char *filename ATTRIB
   gcov_read_summary (&summary);
   printf (" checksum=0x%08x", summary.checksum);
 
-  for (ix = 0; ix != GCOV_COUNTERS; ix++)
+  for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++)
     {
       printf ("\n");
       print_prefix (filename, 0, 0);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]