https://gcc.gnu.org/g:5380be91759731d8fc4a8d5728b672aacbdb2173

commit r16-7179-g5380be91759731d8fc4a8d5728b672aacbdb2173
Author: Jørgen Kvalsvik <[email protected]>
Date:   Tue Nov 4 00:05:04 2025 +0100

    gcov-dump: Print PATHS tag
    
    Print the record associated with the PATHS tag.  While it just prints
    the number of prime paths for the function, this is more useful than
    the UNKNOWN it would otherwise print.
    
    Before:
    ...
    demo.gcno:    01450000:  31:LINES
    demo.gcno:                  block 6:`demo.c':13
    demo.gcno:    01490000:   4:UNKNOWN
    
    After:
    ...
    demo.gcno:    01450000:  31:LINES
    demo.gcno:                  block 6:`demo.c':13
    demo.gcno:    01490000:   4:PATHS 5 paths
    
    gcc/ChangeLog:
    
            * gcov-dump.cc (tag_paths): New function.

Diff:
---
 gcc/gcov-dump.cc | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gcc/gcov-dump.cc b/gcc/gcov-dump.cc
index b3fc4279867c..0f9992c60f1b 100644
--- a/gcc/gcov-dump.cc
+++ b/gcc/gcov-dump.cc
@@ -39,6 +39,7 @@ static void tag_function (const char *, unsigned, int, 
unsigned);
 static void tag_blocks (const char *, unsigned, int, unsigned);
 static void tag_arcs (const char *, unsigned, int, unsigned);
 static void tag_conditions (const char *, unsigned, int, unsigned);
+static void tag_paths (const char *, unsigned, int, unsigned);
 static void tag_lines (const char *, unsigned, int, unsigned);
 static void tag_counters (const char *, unsigned, int, unsigned);
 static void tag_summary (const char *, unsigned, int, unsigned);
@@ -79,6 +80,7 @@ static const tag_format_t tag_table[] =
   {GCOV_TAG_BLOCKS, "BLOCKS", tag_blocks},
   {GCOV_TAG_ARCS, "ARCS", tag_arcs},
   {GCOV_TAG_CONDS, "CONDITIONS", tag_conditions},
+  {GCOV_TAG_PATHS, "PATHS", tag_paths},
   {GCOV_TAG_LINES, "LINES", tag_lines},
   {GCOV_TAG_OBJECT_SUMMARY, "OBJECT_SUMMARY", tag_summary},
   {0, NULL, NULL}
@@ -417,6 +419,15 @@ tag_conditions (const char *filename, unsigned /* tag */, 
int length,
        }
     }
 }
+
+static void
+tag_paths (const char *filename ATTRIBUTE_UNUSED,
+          unsigned tag ATTRIBUTE_UNUSED, int length ATTRIBUTE_UNUSED,
+          unsigned depth ATTRIBUTE_UNUSED)
+{
+  printf (" %u paths", gcov_read_unsigned ());
+}
+
 static void
 tag_lines (const char *filename ATTRIBUTE_UNUSED,
           unsigned tag ATTRIBUTE_UNUSED, int length ATTRIBUTE_UNUSED,

Reply via email to