[RFC/gcov,00/12] Add merge-stream subcommand to gcov-tool

Message ID 20220331113515.35764-1-sebastian.huber@embedded-brains.de
Headers
Series Add merge-stream subcommand to gcov-tool |

Message

Sebastian Huber March 31, 2022, 11:35 a.m. UTC
  This patch set is a proof of concept.

The aim is to better support gcov in free-standing environments. For example,
you can run a test executable which dumps all gcov info objects in a serial
data stream using __gcov_info_to_gcda() and the new __gcov_filename_to_gcfn().
It could be encoded as base64. It could be also compressed. On the host you
unpack the encoded data stream and feed it into gcov-tool using the new
"merge-stream" subcommand:

gcov-tool --help
Usage: gcov-tool [OPTION]... SUB_COMMAND [OPTION]...

Offline tool to handle gcda counts

  -h, --help                            Print this help, then exit
  -v, --version                         Print version number, then exit
  merge-stream [options] [stream-file]  Merge coverage stream file (or stdin)
                                        and coverage file contents
    -v, --verbose                       Verbose mode
    -w, --weight <w1,w2>                Set weights (float point values)

Example:

base64 -d log.txt | gcov-tool merge-stream

The patch set does not change the format of gcda files.

TODO:

* Documentation
* Tests

Sebastian Huber (12):
  gcov-tool: Allow merging of empty profile lists
  gcov: Add mode to all gcov_open()
  gcov: Add open mode parameter to gcov_do_dump()
  gcov: Make gcov_seek() static
  gcov: Add __gcov_filename_to_gcfn()
  gcov-tool: Support file input from stdin
  gcov: Use xstrdup()
  gcov: Move prepend to list to read_gcda_file()
  gcov: Move gcov_open() to caller of read_gcda_file()
  gcov: Fix integer types in ftw_read_file()
  gcov: Record EOF error during read
  gcov-tool: Add merge-stream subcommand

 gcc/gcov-io.cc                 |  76 ++++++++++++++-----
 gcc/gcov-io.h                  |  35 +++++----
 gcc/gcov-tool.cc               | 107 +++++++++++++++++++++-----
 libgcc/gcov.h                  |  17 ++++-
 libgcc/libgcov-driver-system.c |   7 +-
 libgcc/libgcov-driver.c        |  42 ++++++++--
 libgcc/libgcov-util.c          | 135 +++++++++++++++++++++++++--------
 libgcc/libgcov.h               |   3 -
 8 files changed, 326 insertions(+), 96 deletions(-)
  

Comments

Martin Liška April 7, 2022, 8:38 a.m. UTC | #1
On 3/31/22 13:35, Sebastian Huber wrote:
> This patch set is a proof of concept.
> 
> The aim is to better support gcov in free-standing environments. For example,
> you can run a test executable which dumps all gcov info objects in a serial
> data stream using __gcov_info_to_gcda() and the new __gcov_filename_to_gcfn().
> It could be encoded as base64. It could be also compressed. On the host you
> unpack the encoded data stream and feed it into gcov-tool using the new
> "merge-stream" subcommand:

Hello.

The patch set is approved with the nits provided. Please install the patches
once stage1 opens.

> 
> gcov-tool --help
> Usage: gcov-tool [OPTION]... SUB_COMMAND [OPTION]...
> 
> Offline tool to handle gcda counts
> 
>    -h, --help                            Print this help, then exit
>    -v, --version                         Print version number, then exit
>    merge-stream [options] [stream-file]  Merge coverage stream file (or stdin)
>                                          and coverage file contents
>      -v, --verbose                       Verbose mode
>      -w, --weight <w1,w2>                Set weights (float point values)
> 
> Example:
> 
> base64 -d log.txt | gcov-tool merge-stream
> 
> The patch set does not change the format of gcda files.
> 
> TODO:
> 
> * Documentation

I would install the patches with documentation change bits.

> * Tests

Tests can be added after that.

Thank you for the functionality.
Cheers,
Martin

> 
> Sebastian Huber (12):
>    gcov-tool: Allow merging of empty profile lists
>    gcov: Add mode to all gcov_open()
>    gcov: Add open mode parameter to gcov_do_dump()
>    gcov: Make gcov_seek() static
>    gcov: Add __gcov_filename_to_gcfn()
>    gcov-tool: Support file input from stdin
>    gcov: Use xstrdup()
>    gcov: Move prepend to list to read_gcda_file()
>    gcov: Move gcov_open() to caller of read_gcda_file()
>    gcov: Fix integer types in ftw_read_file()
>    gcov: Record EOF error during read
>    gcov-tool: Add merge-stream subcommand
> 
>   gcc/gcov-io.cc                 |  76 ++++++++++++++-----
>   gcc/gcov-io.h                  |  35 +++++----
>   gcc/gcov-tool.cc               | 107 +++++++++++++++++++++-----
>   libgcc/gcov.h                  |  17 ++++-
>   libgcc/libgcov-driver-system.c |   7 +-
>   libgcc/libgcov-driver.c        |  42 ++++++++--
>   libgcc/libgcov-util.c          | 135 +++++++++++++++++++++++++--------
>   libgcc/libgcov.h               |   3 -
>   8 files changed, 326 insertions(+), 96 deletions(-)
>
  
Sebastian Huber April 7, 2022, 9:05 a.m. UTC | #2
Hello Martin,

thanks for the review. I am not really used to write func ().

On 07/04/2022 10:38, Martin Liška wrote:
>>
>> TODO:
>>
>> * Documentation
> 
> I would install the patches with documentation change bits.

Ok, I will add some documentation changes and send them with a v2 of the 
patch set after stage 0 opens.

I would like to add a chapter about the use of gcov in systems without a 
file system.

> 
>> * Tests
> 
> Tests can be added after that.

Ok, good.