[PATCH] gcov-dump: Print start-position for conditions

Jørgen Kvalsvik j@lambda.is
Tue Oct 14 09:05:28 GMT 2025


The printed position should be the start of the record, as is the case
with lines.

Before:
ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
ex.gcno:  811:                  block 2: 1
ex.gcno:  819:                  block 5: 1
ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...

After:
ex.gcno:  795:    01470000:  16:CONDITIONS 2 conditions
ex.gcno:  803:                  block 2: 1
ex.gcno:  811:                  block 5: 1
ex.gcno:  819:    01000000:  50:FUNCTION ... `main' ...

gcc/ChangeLog:

	* gcov-dump.cc (tag_conditions):  Read position before blocks,
	terms.
---
 gcc/gcov-dump.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc
index cc7f8a9ebfb..180080eb0e6 100644
--- a/gcc/gcov-dump.cc
+++ b/gcc/gcov-dump.cc
@@ -406,11 +406,12 @@ tag_conditions (const char *filename, unsigned /* tag */, int length,
     {
       for (unsigned ix = 0; ix != n_conditions; ix++)
 	{
+	  const gcov_position_t position = gcov_position ();
 	  const unsigned blockno = gcov_read_unsigned ();
 	  const unsigned nterms = gcov_read_unsigned ();
 
 	  printf ("\n");
-	  print_prefix (filename, depth, gcov_position ());
+	  print_prefix (filename, depth, position);
 	  printf (VALUE_PADDING_PREFIX "block %u:", blockno);
 	  printf (" %u", nterms);
 	}
-- 
2.39.5



More information about the Gcc-patches mailing list