[PATCH 08/12] gcov: Add functions to dump the gcov information

Chris Johns chrisj at rtems.org
Fri Jul 1 00:37:49 UTC 2022


On 29/6/2022 4:30 pm, Sebastian Huber wrote:
> Update #4670.
> ---
>  cpukit/include/rtems/score/io.h         |   4 +
>  cpukit/include/rtems/test-info.h        |   6 ++
>  cpukit/libtest/testgcovdumpinfo.c       |  66 ++++++++++++++
>  cpukit/score/src/iogcovdumpinfo.c       | 101 +++++++++++++++++++++
>  cpukit/score/src/iogcovdumpinfobase64.c | 111 ++++++++++++++++++++++++
>  spec/build/cpukit/librtemscpu.yml       |   2 +
>  spec/build/cpukit/librtemstest.yml      |   1 +
>  testsuites/validation/tc-terminate.c    |   3 +-
>  8 files changed, 293 insertions(+), 1 deletion(-)
>  create mode 100644 cpukit/libtest/testgcovdumpinfo.c
>  create mode 100644 cpukit/score/src/iogcovdumpinfo.c
>  create mode 100644 cpukit/score/src/iogcovdumpinfobase64.c
> 
> diff --git a/cpukit/include/rtems/score/io.h b/cpukit/include/rtems/score/io.h
> index 106418f185..097cb9bdfe 100644
> --- a/cpukit/include/rtems/score/io.h
> +++ b/cpukit/include/rtems/score/io.h
> @@ -141,6 +141,10 @@ int _IO_Base64url(
>   */
>  void _IO_Relax( void );
>  
> +void _IO_Gcov_dump_info( IO_Put_char put_char, void *arg );
> +
> +void _IO_Gcov_dump_info_base64( IO_Put_char put_char, void *arg );
> +

Why just a per char interface? Given this is in the score a buffer plus length
interface would make more sense? It would make the interface more efficient.

The per char could be a convenience function version of the buffer and length
call for those use cases than want it, ie ....

> +static void _IO_Gcov_dump( const void *data, unsigned length, void *arg )
> +{
> +  IO_Gcov_context *ctx;
> +  IO_Put_char      put_char;
> +  void            *ctx_arg;
> +  const char      *in;
> +  const void      *end;
> +
> +  ctx = arg;
> +  in = data;
> +  end = in + length;
> +  put_char = ctx->put_char;
> +  ctx_arg = ctx->arg;
> +
> +  while ( in != end ) {
> +    ( *put_char )( *in, ctx_arg );
> +    ++in;
> +  }
> +}

Chris


More information about the devel mailing list