]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcov-dump: Print PATHS tag
authorJørgen Kvalsvik <j@lambda.is>
Mon, 3 Nov 2025 23:05:04 +0000 (00:05 +0100)
committerJørgen Kvalsvik <j@lambda.is>
Fri, 30 Jan 2026 10:20:58 +0000 (11:20 +0100)
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.

gcc/gcov-dump.cc

index b3fc4279867c7a331c830067f54736029a32cef4..0f9992c60f1bffa4b1d9e21aeed109e9c7a6dd59 100644 (file)
@@ -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,